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 {...@@ -283,11 +283,11 @@ pub fn main(init: process.Init.Minimal) !void {
283 cache_poison = .poisoned;283 cache_poison = .poisoned;
284 configure_argv.appendAssumeCapacity("--cache-poison=poisoned");284 configure_argv.appendAssumeCapacity("--cache-poison=poisoned");
285 } else if (mem.cutPrefix(u8, arg, "--cache-poison=")) |rest| {285 } else if (mem.cutPrefix(u8, arg, "--cache-poison=")) |rest| {
286 // Allow the configurer process to report parse failure.286 // We have to report parse failure here otherwise we would
287 if (stringToEnum(std.Build.Graph.CachePoison, rest)) |poison| {287 // potentially get false positive cache hits for misspellings.
288 cache_poison = poison;288 cache_poison = stringToEnum(std.Build.Graph.CachePoison, rest) orelse
289 }289 fatalWithHint("expected --cache-poison=[pure|poisoned|disallowed|ignored]; found: {s}", .{arg});
290 configure_argv.appendAssumeCapacity(arg);290 if (cache_poison != .pure) configure_argv.appendAssumeCapacity(arg);
291 } else if (mem.eql(u8, arg, "--verbose")) {291 } else if (mem.eql(u8, arg, "--verbose")) {
292 // Intentionally is added both to make and configure but292 // Intentionally is added both to make and configure but
293 // does not go into the cache hash.293 // 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 {...@@ -113,8 +113,8 @@ pub fn main(init: process.Init.Minimal) !void {
113 } else if (mem.eql(u8, arg, "--verbose")) {113 } else if (mem.eql(u8, arg, "--verbose")) {
114 graph.verbose = true;114 graph.verbose = true;
115 } else if (mem.cutPrefix(u8, arg, "--cache-poison=")) |rest| {115 } else if (mem.cutPrefix(u8, arg, "--cache-poison=")) |rest| {
116 graph.cache_poison = std.meta.stringToEnum(std.Build.Graph.CachePoison, rest) orelse116 // Already parsed and validated by Maker.
117 fatalWithHint("expected --cache-poison=[pure|poisoned|disallowed|ignored]; found: {s}", .{arg});117 graph.cache_poison = std.meta.stringToEnum(std.Build.Graph.CachePoison, rest).?;
118 } else if (mem.eql(u8, arg, "--search-prefix")) {118 } else if (mem.eql(u8, arg, "--search-prefix")) {
119 try graph.search_prefixes.append(arena, nextArgOrFatal(args, &arg_i));119 try graph.search_prefixes.append(arena, nextArgOrFatal(args, &arg_i));
120 } else {120 } else {