Skip to content

nix 2.3.17 fails in test tests/add.sh sometimes #10222

Open

Description

Describe the bug
NixOS/nixpkgs#294433

nix 2.3.17 seems to fail pretty frequently in when building as part of the eval check ofborg-eval-lib-tests nix-build --arg pkgs 'import ./. {}' ./lib/tests/release.nix on the nixpkgs CI

ran test tests/add.sh... [FAIL]
    ++ nix-store --add ./dummy
    + path1=/build/nix-test/add/store/g1qxg63zbanhv79ibby90311521d4237-dummy
    + echo /build/nix-test/add/store/g1qxg63zbanhv79ibby90311521d4237-dummy
    /build/nix-test/add/store/g1qxg63zbanhv79ibby90311521d4237-dummy
    ++ nix-store --add-fixed sha256 --recursive ./dummy
    + path2=/build/nix-test/add/store/g1qxg63zbanhv79ibby90311521d4237-dummy
    + echo /build/nix-test/add/store/g1qxg63zbanhv79ibby90311521d4237-dummy
    /build/nix-test/add/store/g1qxg63zbanhv79ibby90311521d4237-dummy
    + test /build/nix-test/add/store/g1qxg63zbanhv79ibby90311521d4237-dummy '!=' /build/nix-test/add/store/g1qxg63zbanhv79ibby90311521d4237-dummy
    ++ nix-store --add-fixed sha256 ./dummy
    + path3=/build/nix-test/add/store/1b0chpd74drqysiwsskw53zwlg18rcjl-dummy
    + echo /build/nix-test/add/store/1b0chpd74drqysiwsskw53zwlg18rcjl-dummy
    /build/nix-test/add/store/1b0chpd74drqysiwsskw53zwlg18rcjl-dummy
    + test /build/nix-test/add/store/g1qxg63zbanhv79ibby90311521d4237-dummy '!=' /build/nix-test/add/store/1b0chpd74drqysiwsskw53zwlg18rcjl-dummy
    ++ nix-store --add-fixed sha1 --recursive ./dummy
    + path4=/build/nix-test/add/store/dcjypnx18bpzy81n499bfgq7fl548swl-dummy
    + echo /build/nix-test/add/store/dcjypnx18bpzy81n499bfgq7fl548swl-dummy
    /build/nix-test/add/store/dcjypnx18bpzy81n499bfgq7fl548swl-dummy
    + test /build/nix-test/add/store/g1qxg63zbanhv79ibby90311521d4237-dummy '!=' /build/nix-test/add/store/dcjypnx18bpzy81n499bfgq7fl548swl-dummy
    ++ nix-store -q --hash /build/nix-test/add/store/g1qxg63zbanhv79ibby90311521d4237-dummy
    + hash1=sha256:0ip26j2h11n1kgkz36rl4akv694yz65hr72q4kv4b3lxcbi65b3p
    + echo sha256:0ip26j2h11n1kgkz36rl4akv694yz65hr72q4kv4b3lxcbi65b3p
    sha256:0ip26j2h11n1kgkz36rl4akv694yz65hr72q4kv4b3lxcbi65b3p
    ++ nix-hash --type sha256 --base32 ./dummy
    + hash2=0lc8c8k1yc8m563wxg9ikalz4q9f56gc667qnnsjiwgiv7ya8xbw
    + echo 0lc8c8k1yc8m563wxg9ikalz4q9f56gc667qnnsjiwgiv7ya8xbw
    0lc8c8k1yc8m563wxg9ikalz4q9f56gc667qnnsjiwgiv7ya8xbw
    + test sha256:0ip26j2h11n1kgkz36rl4akv694yz65hr72q4kv4b3lxcbi65b3p = sha256:0lc8c8k1yc8m563wxg9ikalz4q9f56gc667qnnsjiwgiv7ya8xbw
make: *** [mk/lib.mk:128: tests/add.sh.test] Error 1
make: *** Waiting for unfinished jobs....

my suspicion is that the tests are run in parallel and there is some test that writes to the file that add.sh is using.

$   grep dummy **/*(.)
add.sh:path1=$(nix-store --add ./dummy)
add.sh:path2=$(nix-store --add-fixed sha256 --recursive ./dummy)
add.sh:path3=$(nix-store --add-fixed sha256 ./dummy)
add.sh:path4=$(nix-store --add-fixed sha1 --recursive ./dummy)
add.sh:hash2=$(nix-hash --type sha256 --base32 ./dummy)
check.nix:    url = "file://" + toString ./dummy;
check.sh:echo -n > ./dummy
check.sh:echo 'Hello World' > ./dummy
fixed.builder2.sh:echo dummy: $dummy
fixed.builder2.sh:if test -n "$dummy"; then sleep 2; fi
fixed.nix:  f2 = dummy: builder: mode: algo: hash: mkDerivation {
fixed.nix:    inherit dummy;
hash-check.nix:    args = ["-e" "-x" ./dummy];
hash-check.nix:    args = ["-e" "-x" ./dummy];
hash-check.nix:    args = ["-e" "-x" (./dummy  + "/FOOBAR/../.")];
init.sh:echo 'Hello World' > ./dummy
lang/eval-okay-eq-derivations.nix:  drvA3 = derivation { name = "a"; builder = "/foo"; system = "i686-linux"; } // { dummy = 1; };
user-envs.nix:# Some dummy arguments...

so perhaps check.sh is writing to dummy while add.sh is running?

Add 👍 to issues you find important.

Activity

  1. ghost added on Mar 11, 2024
  2. edolstra commented on Mar 12, 2024

    @edolstra
    Member

    Yeah, we had a fix for this, but I had to revert it because it was causing its own build failures (99f14d4).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions