authorgravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2025-08-28 04:20:35-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-08-31 19:32:07-07:00
logbc7955306e3480fc065277d0b6c5abb6797a27ae
tree1c3203bc48543fdb26c0d4608ceddebf033b7be2
parent1ec8a7ab4c5346839ee9aa002aadee91d72903fe

Fix `-M` and `--dep` splitting on every = instead of just the first

Before this commit, -Mfoo=bar=baz would be incorrectly split into mod_name: `foo` and root_src_orig: `bar` After this commit, -Mfoo=bar=baz will be correctly split into mod_name: `foo` and root_src_orig: `bar=baz` Closes #25059

1 files changed, 4 insertions(+), 4 deletions(-)

src/main.zig+4-4
......@@ -1060,8 +1060,8 @@ fn buildOutputType(
10601060 }
10611061 } else if (mem.eql(u8, arg, "--dep")) {
10621062 var it = mem.splitScalar(u8, args_iter.nextOrFatal(), '=');
1063 const key = it.next().?;
1064 const value = it.next() orelse key;
1063 const key = it.first();
1064 const value = if (it.peek() != null) it.rest() else key;
10651065 if (mem.eql(u8, key, "std") and !mem.eql(u8, value, "std")) {
10661066 fatal("unable to import as '{s}': conflicts with builtin module", .{
10671067 key,
......@@ -1080,8 +1080,8 @@ fn buildOutputType(
10801080 });
10811081 } else if (mem.startsWith(u8, arg, "-M")) {
10821082 var it = mem.splitScalar(u8, arg["-M".len..], '=');
1083 const mod_name = it.next().?;
1084 const root_src_orig = it.next();
1083 const mod_name = it.first();
1084 const root_src_orig = if (it.peek() != null) it.rest() else null;
10851085 try handleModArg(
10861086 arena,
10871087 mod_name,