Skip to content

a build system dependency tree that contains a package multiple times results in error: file exists in multiple modules #15755

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
andrewrk opened this issue May 18, 2023 · 1 comment
Labels
bug Observed behavior contradicts documented or intended behavior regression It worked in a previous version of Zig, but stopped working. zig build system std.Build, the build runner, `zig build` subcommand, package management
Milestone

Comments

@andrewrk
Copy link
Member

andrewrk commented May 18, 2023

Zig Version

0.11.0-dev.3198+ad20236e9

Steps to Reproduce and Observed Behavior

Depends on #15754.

$ git clone https://github.com/andrewrk/groovebasin
$ git checkout zig-pkg
$ zig build
/home/andy/.cache/zig/p/12209e851f7e2c6ba2f01de3e11b1771f03e49666065320abd8414aac152bfa75fae/build.zig:1:1: error: file exists in multiple modules
/home/andy/.cache/zig/p/12209e851f7e2c6ba2f01de3e11b1771f03e49666065320abd8414aac152bfa75fae/build.zig:1:1: note: root of module [email protected]
/home/andy/.cache/zig/p/12209e851f7e2c6ba2f01de3e11b1771f03e49666065320abd8414aac152bfa75fae/build.zig:1:1: note: root of module [email protected]
/home/andy/.cache/zig/p/122025fb57739eb67edbbafed2b270479089ee7395cf4b0849001ab95c16a2bae0d9/build.zig:1:1: error: file exists in multiple modules
/home/andy/.cache/zig/p/122025fb57739eb67edbbafed2b270479089ee7395cf4b0849001ab95c16a2bae0d9/build.zig:1:1: note: root of module [email protected]
/home/andy/.cache/zig/p/122025fb57739eb67edbbafed2b270479089ee7395cf4b0849001ab95c16a2bae0d9/build.zig:1:1: note: root of module [email protected]
/home/andy/.cache/zig/p/1220f96a4eaae5bad95ab9391431f125b7cc32edbd6d17397ce066d498f8fc9b63c2/build.zig:1:1: error: file exists in multiple modules
/home/andy/.cache/zig/p/1220f96a4eaae5bad95ab9391431f125b7cc32edbd6d17397ce066d498f8fc9b63c2/build.zig:1:1: note: root of module [email protected]
/home/andy/.cache/zig/p/1220f96a4eaae5bad95ab9391431f125b7cc32edbd6d17397ce066d498f8fc9b63c2/build.zig:1:1: note: root of module [email protected]
/home/andy/.cache/zig/p/1220d6c5bf73bee37589a086147ab8f7e855ee98becd3f2e26e58a920ca8f766105f/build.zig:1:1: error: file exists in multiple modules
/home/andy/.cache/zig/p/1220d6c5bf73bee37589a086147ab8f7e855ee98becd3f2e26e58a920ca8f766105f/build.zig:1:1: note: root of module [email protected]
/home/andy/.cache/zig/p/1220d6c5bf73bee37589a086147ab8f7e855ee98becd3f2e26e58a920ca8f766105f/build.zig:1:1: note: root of module [email protected]
/home/andy/.cache/zig/p/122032bc8d97d857b7c2f71252da293e4f293a4ea0d162909fb0705ba17c40ae2a87/build.zig:1:1: error: file exists in multiple modules
/home/andy/.cache/zig/p/122032bc8d97d857b7c2f71252da293e4f293a4ea0d162909fb0705ba17c40ae2a87/build.zig:1:1: note: root of module [email protected]
/home/andy/.cache/zig/p/122032bc8d97d857b7c2f71252da293e4f293a4ea0d162909fb0705ba17c40ae2a87/build.zig:1:1: note: root of module [email protected]
/home/andy/.cache/zig/p/122032bc8d97d857b7c2f71252da293e4f293a4ea0d162909fb0705ba17c40ae2a87/build.zig:1:1: note: 1 more errors omitted
$ zig build
thread 855578 panic: reached unreachable code
/home/andy/dev/zig/lib/std/debug.zig:286:14: 0x5adfeb6 in assert (zig)
    if (!ok) unreachable; // assertion failure
             ^
/home/andy/dev/zig/lib/std/hash_map.zig:1032:19: 0x5d0e970 in putAssumeCapacityNoClobberContext (zig)
            assert(!self.containsContext(key, ctx));
                  ^
/home/andy/dev/zig/lib/std/hash_map.zig:1029:58: 0x5b599d0 in putAssumeCapacityNoClobber (zig)
            return self.putAssumeCapacityNoClobberContext(key, value, undefined);
                                                         ^
/home/andy/dev/zig/src/Package.zig:125:41: 0x5b59933 in add (zig)
    pkg.table.putAssumeCapacityNoClobber(name_dupe, package);
                                        ^
/home/andy/dev/zig/src/Package.zig:309:20: 0x5cb99d7 in fetchAndAddDependencies (zig)
        try pkg.add(gpa, name, sub_pkg);
                   ^
/home/andy/dev/zig/src/Package.zig:294:44: 0x5cb9925 in fetchAndAddDependencies (zig)
        try sub_pkg.fetchAndAddDependencies(
                                           ^
/home/andy/dev/zig/src/Package.zig:294:44: 0x5cb9925 in fetchAndAddDependencies (zig)
        try sub_pkg.fetchAndAddDependencies(
                                           ^
/home/andy/dev/zig/src/Package.zig:294:44: 0x5cb9925 in fetchAndAddDependencies (zig)
        try sub_pkg.fetchAndAddDependencies(
                                           ^
/home/andy/dev/zig/src/main.zig:4441:67: 0x5b12a38 in cmdBuild (zig)
            const fetch_result = build_pkg.fetchAndAddDependencies(
                                                                  ^
/home/andy/dev/zig/src/main.zig:300:24: 0x5adddbd in mainArgs (zig)
        return cmdBuild(gpa, arena, cmd_args);
                       ^
/home/andy/dev/zig/src/main.zig:213:20: 0x5adc8e5 in main (zig)
    return mainArgs(gpa, arena, args);
                   ^
/home/andy/dev/zig/lib/std/start.zig:609:37: 0x5adf058 in main (zig)
            const result = root.main() catch |err| {
                                    ^
???:?:?: 0x7f72fb7d424d in ??? (???)
???:?:?: 0x7ffdf88104fa in ??? (???)
fish: Job 1, '~/dev/zig/build-release/stage4/…' terminated by signal SIGABRT (Abort)

Note that this is two invocations of zig build, one with a clean package cache and one with a populated package cache.

Expected Behavior

Expected the project to build, both from a clean package cache (first zig build invocation) and populated package cache (second zig build invocation).

This project used to build; it no longer does.

It's perfectly normal for the same package to exist multiple times in a given dependency tree.

cc @mlugg

Related: #14708

@andrewrk andrewrk added bug Observed behavior contradicts documented or intended behavior zig build system std.Build, the build runner, `zig build` subcommand, package management regression It worked in a previous version of Zig, but stopped working. labels May 18, 2023
@andrewrk andrewrk added this to the 0.11.0 milestone May 18, 2023
@mlugg
Copy link
Member

mlugg commented May 18, 2023

#15407

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior regression It worked in a previous version of Zig, but stopped working. zig build system std.Build, the build runner, `zig build` subcommand, package management
Projects
None yet
Development

No branches or pull requests

2 participants