authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-07-01 19:29:56-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-07-01 20:03:17-07:00
log3889112380e1c14978d8be512068b99d2a7f774b
treefbe1c4301e61c7e4c753919b08a1f842fa775949
parentd5c83bafad0842a3020eabfa1d9f198413340e56

Maker: fix invalid --cache-poison args getting cached


2 files changed, 7 insertions(+), 7 deletions(-)

lib/compiler/Maker.zig+5-5
......@@ -283,11 +283,11 @@ pub fn main(init: process.Init.Minimal) !void {
283283 cache_poison = .poisoned;
284284 configure_argv.appendAssumeCapacity("--cache-poison=poisoned");
285285 } else if (mem.cutPrefix(u8, arg, "--cache-poison=")) |rest| {
286 // Allow the configurer process to report parse failure.
287 if (stringToEnum(std.Build.Graph.CachePoison, rest)) |poison| {
288 cache_poison = poison;
289 }
290 configure_argv.appendAssumeCapacity(arg);
286 // We have to report parse failure here otherwise we would
287 // potentially get false positive cache hits for misspellings.
288 cache_poison = stringToEnum(std.Build.Graph.CachePoison, rest) orelse
289 fatalWithHint("expected --cache-poison=[pure|poisoned|disallowed|ignored]; found: {s}", .{arg});
290 if (cache_poison != .pure) configure_argv.appendAssumeCapacity(arg);
291291 } else if (mem.eql(u8, arg, "--verbose")) {
292292 // Intentionally is added both to make and configure but
293293 // does not go into the cache hash.
lib/compiler/configurer.zig+2-2
......@@ -113,8 +113,8 @@ pub fn main(init: process.Init.Minimal) !void {
113113 } else if (mem.eql(u8, arg, "--verbose")) {
114114 graph.verbose = true;
115115 } else if (mem.cutPrefix(u8, arg, "--cache-poison=")) |rest| {
116 graph.cache_poison = std.meta.stringToEnum(std.Build.Graph.CachePoison, rest) orelse
117 fatalWithHint("expected --cache-poison=[pure|poisoned|disallowed|ignored]; found: {s}", .{arg});
116 // Already parsed and validated by Maker.
117 graph.cache_poison = std.meta.stringToEnum(std.Build.Graph.CachePoison, rest).?;
118118 } else if (mem.eql(u8, arg, "--search-prefix")) {
119119 try graph.search_prefixes.append(arena, nextArgOrFatal(args, &arg_i));
120120 } else {