mirror of
https://github.com/NixOS/nix
synced 2025-07-10 04:43:53 +02:00
pathInfoCache: Use the entire base name as the cache key
This fixes a bug in the garbage collector where if a path /nix/store/abcd-foo is valid, but we do a isValidPath("/nix/store/abcd-foo.lock") first, then a negative entry for /nix/store/abcd is added to pathInfoCache, so /nix/store/abcd-foo is subsequently considered invalid and deleted.
This commit is contained in:
parent
eab934cb2a
commit
0be8cc1466
5 changed files with 27 additions and 23 deletions
11
tests/gc.sh
11
tests/gc.sh
|
@ -1,5 +1,7 @@
|
|||
source common.sh
|
||||
|
||||
clearStore
|
||||
|
||||
drvPath=$(nix-instantiate dependencies.nix)
|
||||
outPath=$(nix-store -rvv "$drvPath")
|
||||
|
||||
|
@ -23,6 +25,11 @@ test -e $inUse
|
|||
if nix-store --delete $outPath; then false; fi
|
||||
test -e $outPath
|
||||
|
||||
for i in $NIX_STORE_DIR/*; do
|
||||
touch $i.lock
|
||||
touch $i.chroot
|
||||
done
|
||||
|
||||
nix-collect-garbage
|
||||
|
||||
# Check that the root and its dependencies haven't been deleted.
|
||||
|
@ -38,3 +45,7 @@ nix-collect-garbage
|
|||
|
||||
# Check that the output has been GC'd.
|
||||
if test -e $outPath/foobar; then false; fi
|
||||
|
||||
# Check that the store is empty.
|
||||
rmdir $NIX_STORE_DIR/.links
|
||||
rmdir $NIX_STORE_DIR
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue