From 0ac29783b95e2799d851d758363d8bd9394592d1 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 17 Sep 2024 16:50:59 -0700 Subject: [PATCH] config: fix regression for recursive config-files from 5ff0841ee65 --- src/config/Config.zig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/config/Config.zig b/src/config/Config.zig index 4a092a09f..0aa29addd 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -2262,7 +2262,12 @@ pub fn loadRecursiveFiles(self: *Config, alloc_gpa: Allocator) !void { defer loaded.deinit(); const cwd = std.fs.cwd(); - for (0..self.@"config-file".value.list.items.len) |i| { + + // We must use a while below and not a for(items) because we + // may add items to the list while iterating for recursive + // config-file entries. + var i: usize = 0; + while (i < self.@"config-file".value.list.items.len) : (i += 1) { const optional, const path = blk: { const path = self.@"config-file".value.list.items[i]; if (path.len == 0) {