mirror of
https://github.com/NixOS/nix.git
synced 2025-11-14 22:42:41 +01:00
Show which PID is causing a temp root
Example:
error: Cannot delete path '/nix/store/klyng5rpdkwi5kbxkncy4gjwb490dlhb-foo.drv' because it's in use by Nix process '{nix-process:3605324}'.
This commit is contained in:
parent
cae732f7a1
commit
31b00218fe
6 changed files with 35 additions and 20 deletions
|
|
@ -9,6 +9,7 @@ mkDerivation {
|
|||
|
||||
cat > $out/program <<EOF
|
||||
#! ${shell}
|
||||
echo x > \$TEST_ROOT/fifo
|
||||
sleep 10000
|
||||
EOF
|
||||
|
||||
|
|
|
|||
|
|
@ -21,11 +21,16 @@ nix-env -p "$profiles/test" -f ./gc-runtime.nix -i gc-runtime
|
|||
outPath=$(nix-env -p "$profiles/test" -q --no-name --out-path gc-runtime)
|
||||
echo "$outPath"
|
||||
|
||||
fifo="$TEST_ROOT/fifo"
|
||||
mkfifo "$fifo"
|
||||
|
||||
echo "backgrounding program..."
|
||||
"$profiles"/test/program &
|
||||
sleep 2 # hack - wait for the program to get started
|
||||
"$profiles"/test/program "$fifo" &
|
||||
child=$!
|
||||
echo PID=$child
|
||||
cat "$fifo"
|
||||
|
||||
expectStderr 1 nix-store --delete "$outPath" | grepQuiet "Cannot delete path.*because it's referenced by the GC root '/proc/"
|
||||
|
||||
nix-env -p "$profiles/test" -e gc-runtime
|
||||
nix-env -p "$profiles/test" --delete-generations old
|
||||
|
|
|
|||
|
|
@ -23,10 +23,10 @@ if nix-store --gc --print-dead | grep -E "$outPath"$; then false; fi
|
|||
nix-store --gc --print-dead
|
||||
|
||||
inUse=$(readLink "$outPath/reference-to-input-2")
|
||||
if nix-store --delete "$inUse"; then false; fi
|
||||
expectStderr 1 nix-store --delete "$inUse" | grepQuiet "Cannot delete path.*because it's referenced by the GC root "
|
||||
test -e "$inUse"
|
||||
|
||||
if nix-store --delete "$outPath"; then false; fi
|
||||
expectStderr 1 nix-store --delete "$outPath" | grepQuiet "Cannot delete path.*because it's referenced by the GC root "
|
||||
test -e "$outPath"
|
||||
|
||||
for i in "$NIX_STORE_DIR"/*; do
|
||||
|
|
|
|||
|
|
@ -22,14 +22,14 @@ input2=$(nix-build ../hermetic.nix --no-out-link --arg busybox "$busybox" --arg
|
|||
input3=$(nix-build ../hermetic.nix --no-out-link --arg busybox "$busybox" --arg withFinalRefs true --arg seed 2 -A passthru.input3 -j0)
|
||||
|
||||
# Can't delete because referenced
|
||||
expectStderr 1 nix-store --delete $input1 | grepQuiet "Cannot delete path"
|
||||
expectStderr 1 nix-store --delete $input2 | grepQuiet "Cannot delete path"
|
||||
expectStderr 1 nix-store --delete $input3 | grepQuiet "Cannot delete path"
|
||||
expectStderr 1 nix-store --delete $input1 | grepQuiet "Cannot delete path.*because it's referenced by path"
|
||||
expectStderr 1 nix-store --delete $input2 | grepQuiet "Cannot delete path.*because it's referenced by path"
|
||||
expectStderr 1 nix-store --delete $input3 | grepQuiet "Cannot delete path.*because it's referenced by path"
|
||||
|
||||
# These same paths are referenced in the lower layer (by the seed 1
|
||||
# build done in `initLowerStore`).
|
||||
expectStderr 1 nix-store --store "$storeA" --delete $input2 | grepQuiet "Cannot delete path"
|
||||
expectStderr 1 nix-store --store "$storeA" --delete $input3 | grepQuiet "Cannot delete path"
|
||||
expectStderr 1 nix-store --store "$storeA" --delete $input2 | grepQuiet "Cannot delete path.*because it's referenced by path"
|
||||
expectStderr 1 nix-store --store "$storeA" --delete $input3 | grepQuiet "Cannot delete path.*because it's referenced by path"
|
||||
|
||||
# Can delete
|
||||
nix-store --delete $hermetic
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue