authorgravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2025-08-28 04:20:35-07:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-09-02 22:35:01+02:00
log76e2764eb1405eabe53b10bccdde7684432c4596
tree9d767e581d7a01e6d07e93eaebccceab35ca744d
parentdcddbcaa604d9228caddea7b2cd2668bf392149f
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

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
......@@ -1064,8 +1064,8 @@ fn buildOutputType(
10641064 }
10651065 } else if (mem.eql(u8, arg, "--dep")) {
10661066 var it = mem.splitScalar(u8, args_iter.nextOrFatal(), '=');
1067 const key = it.next().?;
1068 const value = it.next() orelse key;
1067 const key = it.first();
1068 const value = if (it.peek() != null) it.rest() else key;
10691069 if (mem.eql(u8, key, "std") and !mem.eql(u8, value, "std")) {
10701070 fatal("unable to import as '{s}': conflicts with builtin module", .{
10711071 key,
......@@ -1084,8 +1084,8 @@ fn buildOutputType(
10841084 });
10851085 } else if (mem.startsWith(u8, arg, "-M")) {
10861086 var it = mem.splitScalar(u8, arg["-M".len..], '=');
1087 const mod_name = it.next().?;
1088 const root_src_orig = it.next();
1087 const mod_name = it.first();
1088 const root_src_orig = if (it.peek() != null) it.rest() else null;
10891089 try handleModArg(
10901090 arena,
10911091 mod_name,