nix-build --check deletes store path #887

Closed
opened 2025-06-28 18:52:38 +00:00 by xfnw · 2 comments

Describe the bug

using the --check flag with nix-build causes the resulting store path to disappear

Steps To Reproduce

  1. add something to the store with nix-build
$ nix-build https://github.com/NixOS/nixpkgs/archive/30e2e2857ba47844aa71991daa6ed1fc678bcbb7.tar.gz -A h
/nix/store/cc27kcs433agcyqpnl90200zax1zzg2r-h-1.1.0
  1. verify that the store path exists
$ ls /nix/store/cc27kcs433agcyqpnl90200zax1zzg2r-h-1.1.0
bin
  1. rebuild it with --check
$ nix-build https://github.com/NixOS/nixpkgs/archive/30e2e2857ba47844aa71991daa6ed1fc678bcbb7.tar.gz -A h --check
checking outputs of '/nix/store/30wr6cl9xq7w1g7yvby1ny3j1ina3ixp-h-1.1.0.drv'...
Running phase: unpackPhase
unpacking source archive /nix/store/xbz7dffrz8lb47ppxmvif8lnsgaq70cy-source
source root is source
Running phase: patchPhase
Running phase: updateAutotoolsGnuConfigScriptsPhase
Running phase: configurePhase
no configure script, doing nothing
Running phase: buildPhase
no Makefile or custom buildPhase, doing nothing
Running phase: installPhase
Running phase: fixupPhase
shrinking RPATHs of ELF executables and libraries in /nix/store/cc27kcs433agcyqpnl90200zax1zzg2r-h-1.1.0
checking for references to /build/ in /nix/store/cc27kcs433agcyqpnl90200zax1zzg2r-h-1.1.0...
patching script interpreter paths in /nix/store/cc27kcs433agcyqpnl90200zax1zzg2r-h-1.1.0
/nix/store/cc27kcs433agcyqpnl90200zax1zzg2r-h-1.1.0/bin/h: interpreter directive changed from "#!/usr/bin/env ruby" to "/nix/store/8prih0r16mcn7ys1m48csqldfr0lczdm-ruby-3.3.8/bin/ruby"
/nix/store/cc27kcs433agcyqpnl90200zax1zzg2r-h-1.1.0/bin/up: interpreter directive changed from "#!/usr/bin/env ruby" to "/nix/store/8prih0r16mcn7ys1m48csqldfr0lczdm-ruby-3.3.8/bin/ruby"
stripping (with command strip and flags -S -p) in  /nix/store/cc27kcs433agcyqpnl90200zax1zzg2r-h-1.1.0/bin
/nix/store/cc27kcs433agcyqpnl90200zax1zzg2r-h-1.1.0
  1. the store path no longer exists
$ ls /nix/store/cc27kcs433agcyqpnl90200zax1zzg2r-h-1.1.0
ls: cannot access '/nix/store/cc27kcs433agcyqpnl90200zax1zzg2r-h-1.1.0': No such file or directory

Expected behavior

the store path to still exist

nix --version output

nix (Lix, like Nix) 2.94.0-devpre20250627_ac80a11
System type: x86_64-linux
Additional system types: i686-linux, x86_64-v1-linux, x86_64-v2-linux, x86_64-v3-linux
Features: gc, signed-caches
System configuration file: /etc/nix/nix.conf
User configuration files: /home/xfnw/.config/nix/nix.conf:/etc/xdg/nix/nix.conf:/home/xfnw/.nix-profile/etc/xdg/nix/nix.conf:/nix/profile/etc/xdg/nix/nix.conf:/home/xfnw/.local/state/nix/profile/etc/xdg/nix/nix.conf:/etc/profiles/per-user/xfnw/etc/xdg/nix/nix.conf:/nix/var/nix/profiles/default/etc/xdg/nix/nix.conf:/run/current-system/sw/etc/xdg/nix/nix.conf
Store directory: /nix/store
State directory: /nix/var/nix
Data directory: /nix/store/m3f4g660x2d5gjlqy8j8bvz7jaw70nyn-lix-2.94.0-devpre20250627_ac80a11/share

Additional context

probably related to #883

## Describe the bug using the --check flag with nix-build causes the resulting store path to disappear ## Steps To Reproduce 1. add something to the store with nix-build ``` $ nix-build https://github.com/NixOS/nixpkgs/archive/30e2e2857ba47844aa71991daa6ed1fc678bcbb7.tar.gz -A h /nix/store/cc27kcs433agcyqpnl90200zax1zzg2r-h-1.1.0 ``` 2. verify that the store path exists ``` $ ls /nix/store/cc27kcs433agcyqpnl90200zax1zzg2r-h-1.1.0 bin ``` 3. rebuild it with --check ``` $ nix-build https://github.com/NixOS/nixpkgs/archive/30e2e2857ba47844aa71991daa6ed1fc678bcbb7.tar.gz -A h --check checking outputs of '/nix/store/30wr6cl9xq7w1g7yvby1ny3j1ina3ixp-h-1.1.0.drv'... Running phase: unpackPhase unpacking source archive /nix/store/xbz7dffrz8lb47ppxmvif8lnsgaq70cy-source source root is source Running phase: patchPhase Running phase: updateAutotoolsGnuConfigScriptsPhase Running phase: configurePhase no configure script, doing nothing Running phase: buildPhase no Makefile or custom buildPhase, doing nothing Running phase: installPhase Running phase: fixupPhase shrinking RPATHs of ELF executables and libraries in /nix/store/cc27kcs433agcyqpnl90200zax1zzg2r-h-1.1.0 checking for references to /build/ in /nix/store/cc27kcs433agcyqpnl90200zax1zzg2r-h-1.1.0... patching script interpreter paths in /nix/store/cc27kcs433agcyqpnl90200zax1zzg2r-h-1.1.0 /nix/store/cc27kcs433agcyqpnl90200zax1zzg2r-h-1.1.0/bin/h: interpreter directive changed from "#!/usr/bin/env ruby" to "/nix/store/8prih0r16mcn7ys1m48csqldfr0lczdm-ruby-3.3.8/bin/ruby" /nix/store/cc27kcs433agcyqpnl90200zax1zzg2r-h-1.1.0/bin/up: interpreter directive changed from "#!/usr/bin/env ruby" to "/nix/store/8prih0r16mcn7ys1m48csqldfr0lczdm-ruby-3.3.8/bin/ruby" stripping (with command strip and flags -S -p) in /nix/store/cc27kcs433agcyqpnl90200zax1zzg2r-h-1.1.0/bin /nix/store/cc27kcs433agcyqpnl90200zax1zzg2r-h-1.1.0 ``` 4. the store path no longer exists ``` $ ls /nix/store/cc27kcs433agcyqpnl90200zax1zzg2r-h-1.1.0 ls: cannot access '/nix/store/cc27kcs433agcyqpnl90200zax1zzg2r-h-1.1.0': No such file or directory ``` ## Expected behavior the store path to still exist ## `nix --version` output ``` nix (Lix, like Nix) 2.94.0-devpre20250627_ac80a11 System type: x86_64-linux Additional system types: i686-linux, x86_64-v1-linux, x86_64-v2-linux, x86_64-v3-linux Features: gc, signed-caches System configuration file: /etc/nix/nix.conf User configuration files: /home/xfnw/.config/nix/nix.conf:/etc/xdg/nix/nix.conf:/home/xfnw/.nix-profile/etc/xdg/nix/nix.conf:/nix/profile/etc/xdg/nix/nix.conf:/home/xfnw/.local/state/nix/profile/etc/xdg/nix/nix.conf:/etc/profiles/per-user/xfnw/etc/xdg/nix/nix.conf:/nix/var/nix/profiles/default/etc/xdg/nix/nix.conf:/run/current-system/sw/etc/xdg/nix/nix.conf Store directory: /nix/store State directory: /nix/var/nix Data directory: /nix/store/m3f4g660x2d5gjlqy8j8bvz7jaw70nyn-lix-2.94.0-devpre20250627_ac80a11/share ``` ## Additional context probably related to #883
Owner

Thank you for the report, we can confirm that #883 fix in HEAD was insufficient.

We believe we have finally a definitive fix. Thank you a lot.

Thank you for the report, we can confirm that #883 fix in HEAD was insufficient. We believe we have finally a definitive fix. Thank you a lot.
Owner

Fixed in:

All Lix stable received new minors for this fix and #883.

Fixed in: - cl/3524 for 2.91. - cl/3527 for 2.92. - cl/3504 for 2.93. - cl/3534 for HEAD. All Lix stable received new minors for this fix and #883.
raito closed this issue 2025-06-30 00:09:02 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#887
No description provided.