From 76c9d3885ca353755b9b7331f63a30ca805739d7 Mon Sep 17 00:00:00 2001 From: Farid Zakaria Date: Sun, 28 Sep 2025 20:22:55 -0700 Subject: [PATCH 01/18] shellcheck fix: tests/functional/local-overlay-store/verify.sh --- maintainers/flake-module.nix | 1 - tests/functional/local-overlay-store/verify.sh | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/maintainers/flake-module.nix b/maintainers/flake-module.nix index 0e9363408..2d18cf9e2 100644 --- a/maintainers/flake-module.nix +++ b/maintainers/flake-module.nix @@ -144,7 +144,6 @@ ''^tests/functional/local-overlay-store/stale-file-handle-inner\.sh$'' ''^tests/functional/local-overlay-store/stale-file-handle\.sh$'' ''^tests/functional/local-overlay-store/verify-inner\.sh$'' - ''^tests/functional/local-overlay-store/verify\.sh$'' ''^tests/functional/logging\.sh$'' ''^tests/functional/misc\.sh$'' ''^tests/functional/multiple-outputs\.sh$'' diff --git a/tests/functional/local-overlay-store/verify.sh b/tests/functional/local-overlay-store/verify.sh index d73d1a57d..f5242fadc 100755 --- a/tests/functional/local-overlay-store/verify.sh +++ b/tests/functional/local-overlay-store/verify.sh @@ -1,3 +1,4 @@ +# shellcheck shell=bash source common.sh source ../common/init.sh From 3a1ba8e41efb02d2627b7aec9eec1acfa62f18a6 Mon Sep 17 00:00:00 2001 From: Farid Zakaria Date: Sun, 28 Sep 2025 20:23:19 -0700 Subject: [PATCH 02/18] shellcheck fix: tests/functional/local-overlay-store/verify-inner.sh --- maintainers/flake-module.nix | 1 - tests/functional/local-overlay-store/verify-inner.sh | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/maintainers/flake-module.nix b/maintainers/flake-module.nix index 2d18cf9e2..ef8d81782 100644 --- a/maintainers/flake-module.nix +++ b/maintainers/flake-module.nix @@ -143,7 +143,6 @@ ''^tests/functional/local-overlay-store/remount\.sh$'' ''^tests/functional/local-overlay-store/stale-file-handle-inner\.sh$'' ''^tests/functional/local-overlay-store/stale-file-handle\.sh$'' - ''^tests/functional/local-overlay-store/verify-inner\.sh$'' ''^tests/functional/logging\.sh$'' ''^tests/functional/misc\.sh$'' ''^tests/functional/multiple-outputs\.sh$'' diff --git a/tests/functional/local-overlay-store/verify-inner.sh b/tests/functional/local-overlay-store/verify-inner.sh index 659f2ae50..1edc11cc7 100755 --- a/tests/functional/local-overlay-store/verify-inner.sh +++ b/tests/functional/local-overlay-store/verify-inner.sh @@ -20,7 +20,7 @@ mountOverlayfs ## Initialise stores for test # Realise a derivation from the lower store to propagate paths to overlay DB -nix-store --store "$storeB" --realise $drvPath +nix-store --store "$storeB" --realise "$drvPath" # Also ensure dummy file exists in overlay DB dummyPath=$(nix-store --store "$storeB" --add ../dummy) From e896bf1cb12e0c53faebfcb63c157b55a96b622e Mon Sep 17 00:00:00 2001 From: Farid Zakaria Date: Sun, 28 Sep 2025 20:24:09 -0700 Subject: [PATCH 03/18] shellcheck fix: tests/functional/local-overlay-store/stale-file-handle.sh --- maintainers/flake-module.nix | 1 - tests/functional/local-overlay-store/stale-file-handle.sh | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/maintainers/flake-module.nix b/maintainers/flake-module.nix index ef8d81782..149913bd1 100644 --- a/maintainers/flake-module.nix +++ b/maintainers/flake-module.nix @@ -142,7 +142,6 @@ ''^tests/functional/local-overlay-store/redundant-add\.sh$'' ''^tests/functional/local-overlay-store/remount\.sh$'' ''^tests/functional/local-overlay-store/stale-file-handle-inner\.sh$'' - ''^tests/functional/local-overlay-store/stale-file-handle\.sh$'' ''^tests/functional/logging\.sh$'' ''^tests/functional/misc\.sh$'' ''^tests/functional/multiple-outputs\.sh$'' diff --git a/tests/functional/local-overlay-store/stale-file-handle.sh b/tests/functional/local-overlay-store/stale-file-handle.sh index 684b8ce23..fbc4c6497 100755 --- a/tests/functional/local-overlay-store/stale-file-handle.sh +++ b/tests/functional/local-overlay-store/stale-file-handle.sh @@ -1,3 +1,4 @@ +# shellcheck shell=bash source common.sh source ../common/init.sh From c4c95f3d39b00024a217b571fd5f7cdd3610eb31 Mon Sep 17 00:00:00 2001 From: Farid Zakaria Date: Sun, 28 Sep 2025 20:24:38 -0700 Subject: [PATCH 04/18] shellcheck fix: tests/functional/local-overlay-store/stale-file-handle-inner.sh --- maintainers/flake-module.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/maintainers/flake-module.nix b/maintainers/flake-module.nix index 149913bd1..3b4a1c42e 100644 --- a/maintainers/flake-module.nix +++ b/maintainers/flake-module.nix @@ -141,7 +141,6 @@ ''^tests/functional/local-overlay-store/redundant-add-inner\.sh$'' ''^tests/functional/local-overlay-store/redundant-add\.sh$'' ''^tests/functional/local-overlay-store/remount\.sh$'' - ''^tests/functional/local-overlay-store/stale-file-handle-inner\.sh$'' ''^tests/functional/logging\.sh$'' ''^tests/functional/misc\.sh$'' ''^tests/functional/multiple-outputs\.sh$'' From 4ef4e967883506c04c051e5eaa239fd4f9f1489a Mon Sep 17 00:00:00 2001 From: Farid Zakaria Date: Sun, 28 Sep 2025 20:25:09 -0700 Subject: [PATCH 05/18] shellcheck fix: tests/functional/local-overlay-store/remount.sh --- maintainers/flake-module.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/maintainers/flake-module.nix b/maintainers/flake-module.nix index 3b4a1c42e..5c783ec10 100644 --- a/maintainers/flake-module.nix +++ b/maintainers/flake-module.nix @@ -140,7 +140,6 @@ ''^tests/functional/local-overlay-store/optimise\.sh$'' ''^tests/functional/local-overlay-store/redundant-add-inner\.sh$'' ''^tests/functional/local-overlay-store/redundant-add\.sh$'' - ''^tests/functional/local-overlay-store/remount\.sh$'' ''^tests/functional/logging\.sh$'' ''^tests/functional/misc\.sh$'' ''^tests/functional/multiple-outputs\.sh$'' From 1bee4d098835c9c941dacfcaae1383db58c578e1 Mon Sep 17 00:00:00 2001 From: Farid Zakaria Date: Sun, 28 Sep 2025 20:25:42 -0700 Subject: [PATCH 06/18] shellcheck fix: tests/functional/local-overlay-store/redundant-add.sh --- maintainers/flake-module.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/maintainers/flake-module.nix b/maintainers/flake-module.nix index 5c783ec10..a48f55322 100644 --- a/maintainers/flake-module.nix +++ b/maintainers/flake-module.nix @@ -139,7 +139,6 @@ ''^tests/functional/local-overlay-store/optimise-inner\.sh$'' ''^tests/functional/local-overlay-store/optimise\.sh$'' ''^tests/functional/local-overlay-store/redundant-add-inner\.sh$'' - ''^tests/functional/local-overlay-store/redundant-add\.sh$'' ''^tests/functional/logging\.sh$'' ''^tests/functional/misc\.sh$'' ''^tests/functional/multiple-outputs\.sh$'' From 0c50d5b25ab90e50c88065f574a03fc8bbd4be0e Mon Sep 17 00:00:00 2001 From: Farid Zakaria Date: Sun, 28 Sep 2025 20:27:21 -0700 Subject: [PATCH 07/18] shellcheck fix: tests/functional/local-overlay-store/redundant-add-inner.sh --- maintainers/flake-module.nix | 1 - .../functional/local-overlay-store/redundant-add-inner.sh | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/maintainers/flake-module.nix b/maintainers/flake-module.nix index a48f55322..c509eb85b 100644 --- a/maintainers/flake-module.nix +++ b/maintainers/flake-module.nix @@ -138,7 +138,6 @@ ''^tests/functional/local-overlay-store/gc\.sh$'' ''^tests/functional/local-overlay-store/optimise-inner\.sh$'' ''^tests/functional/local-overlay-store/optimise\.sh$'' - ''^tests/functional/local-overlay-store/redundant-add-inner\.sh$'' ''^tests/functional/logging\.sh$'' ''^tests/functional/misc\.sh$'' ''^tests/functional/multiple-outputs\.sh$'' diff --git a/tests/functional/local-overlay-store/redundant-add-inner.sh b/tests/functional/local-overlay-store/redundant-add-inner.sh index e37ef90e5..2be122fc6 100755 --- a/tests/functional/local-overlay-store/redundant-add-inner.sh +++ b/tests/functional/local-overlay-store/redundant-add-inner.sh @@ -22,14 +22,14 @@ mountOverlayfs pathInLowerStore=$(nix-store --store "$storeA" --add ../dummy) # upper layer should not have it -expect 1 stat $(toRealPath "$storeBTop/nix/store" "$pathInLowerStore") +expect 1 stat "$(toRealPath "$storeBTop/nix/store" "$pathInLowerStore")" pathFromB=$(nix-store --store "$storeB" --add ../dummy) -[[ $pathInLowerStore == $pathFromB ]] +[[ $pathInLowerStore == "$pathFromB" ]] # lower store should have it from before -stat $(toRealPath "$storeA/nix/store" "$pathInLowerStore") +stat "$(toRealPath "$storeA/nix/store" "$pathInLowerStore")" # upper layer should still not have it (no redundant copy) -expect 1 stat $(toRealPath "$storeBTop" "$pathInLowerStore") +expect 1 stat "$(toRealPath "$storeBTop" "$pathInLowerStore")" From dbb53de9d3db672bc09df33c3e4534b51aa12e87 Mon Sep 17 00:00:00 2001 From: Farid Zakaria Date: Sun, 28 Sep 2025 20:28:18 -0700 Subject: [PATCH 08/18] shellcheck fix: tests/functional/local-overlay-store/redundant-add.sh --- maintainers/flake-module.nix | 1 - tests/functional/local-overlay-store/redundant-add.sh | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/maintainers/flake-module.nix b/maintainers/flake-module.nix index c509eb85b..e5b38a931 100644 --- a/maintainers/flake-module.nix +++ b/maintainers/flake-module.nix @@ -137,7 +137,6 @@ ''^tests/functional/local-overlay-store/gc-inner\.sh$'' ''^tests/functional/local-overlay-store/gc\.sh$'' ''^tests/functional/local-overlay-store/optimise-inner\.sh$'' - ''^tests/functional/local-overlay-store/optimise\.sh$'' ''^tests/functional/logging\.sh$'' ''^tests/functional/misc\.sh$'' ''^tests/functional/multiple-outputs\.sh$'' diff --git a/tests/functional/local-overlay-store/redundant-add.sh b/tests/functional/local-overlay-store/redundant-add.sh index b4f04b2e1..898c3ffeb 100755 --- a/tests/functional/local-overlay-store/redundant-add.sh +++ b/tests/functional/local-overlay-store/redundant-add.sh @@ -1,3 +1,4 @@ +# shellcheck shell=bash source common.sh source ../common/init.sh From 283a9c4c5aefc4d55b6643a483b64bfea8ae597b Mon Sep 17 00:00:00 2001 From: Farid Zakaria Date: Sun, 28 Sep 2025 20:29:35 -0700 Subject: [PATCH 09/18] shellcheck fix: tests/functional/local-overlay-store/optimise-inner.sh --- maintainers/flake-module.nix | 1 - tests/functional/local-overlay-store/optimise-inner.sh | 4 ++-- tests/functional/local-overlay-store/optimise.sh | 1 + 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/maintainers/flake-module.nix b/maintainers/flake-module.nix index e5b38a931..388a9755c 100644 --- a/maintainers/flake-module.nix +++ b/maintainers/flake-module.nix @@ -136,7 +136,6 @@ ''^tests/functional/local-overlay-store/delete-refs\.sh$'' ''^tests/functional/local-overlay-store/gc-inner\.sh$'' ''^tests/functional/local-overlay-store/gc\.sh$'' - ''^tests/functional/local-overlay-store/optimise-inner\.sh$'' ''^tests/functional/logging\.sh$'' ''^tests/functional/misc\.sh$'' ''^tests/functional/multiple-outputs\.sh$'' diff --git a/tests/functional/local-overlay-store/optimise-inner.sh b/tests/functional/local-overlay-store/optimise-inner.sh index eafbc77f7..40cd1c531 100755 --- a/tests/functional/local-overlay-store/optimise-inner.sh +++ b/tests/functional/local-overlay-store/optimise-inner.sh @@ -38,8 +38,8 @@ overlayPath="$storeBRoot/nix/store/$dupFilename" lowerInode=$(stat -c %i "$lowerPath") upperInode=$(stat -c %i "$upperPath") overlayInode=$(stat -c %i "$overlayPath") -[[ $upperInode == $overlayInode ]] -[[ $upperInode != $lowerInode ]] +[[ $upperInode == "$overlayInode" ]] +[[ $upperInode != "$lowerInode" ]] # Run optimise to deduplicate store paths nix-store --store "$storeB" --optimise diff --git a/tests/functional/local-overlay-store/optimise.sh b/tests/functional/local-overlay-store/optimise.sh index a524a675e..a11c450d7 100755 --- a/tests/functional/local-overlay-store/optimise.sh +++ b/tests/functional/local-overlay-store/optimise.sh @@ -1,3 +1,4 @@ +# shellcheck shell=bash source common.sh source ../common/init.sh From 675179a51008d45723c18ca5eac5c911c76c0d18 Mon Sep 17 00:00:00 2001 From: Farid Zakaria Date: Sun, 28 Sep 2025 20:30:02 -0700 Subject: [PATCH 10/18] shellcheck fix: tests/functional/local-overlay-store/gc.sh --- maintainers/flake-module.nix | 1 - tests/functional/local-overlay-store/gc.sh | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/maintainers/flake-module.nix b/maintainers/flake-module.nix index 388a9755c..3f38ffc7d 100644 --- a/maintainers/flake-module.nix +++ b/maintainers/flake-module.nix @@ -135,7 +135,6 @@ ''^tests/functional/local-overlay-store/delete-refs-inner\.sh$'' ''^tests/functional/local-overlay-store/delete-refs\.sh$'' ''^tests/functional/local-overlay-store/gc-inner\.sh$'' - ''^tests/functional/local-overlay-store/gc\.sh$'' ''^tests/functional/logging\.sh$'' ''^tests/functional/misc\.sh$'' ''^tests/functional/multiple-outputs\.sh$'' diff --git a/tests/functional/local-overlay-store/gc.sh b/tests/functional/local-overlay-store/gc.sh index f3420d0b8..5b6720fd3 100755 --- a/tests/functional/local-overlay-store/gc.sh +++ b/tests/functional/local-overlay-store/gc.sh @@ -1,3 +1,4 @@ +# shellcheck shell=bash source common.sh source ../common/init.sh From 62b36eba1183dcca45fc5f59be681958855d6fa6 Mon Sep 17 00:00:00 2001 From: Farid Zakaria Date: Sun, 28 Sep 2025 20:31:09 -0700 Subject: [PATCH 11/18] shellcheck fix: tests/functional/local-overlay-store/gc-inner.sh --- maintainers/flake-module.nix | 1 - .../local-overlay-store/gc-inner.sh | 21 ++++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/maintainers/flake-module.nix b/maintainers/flake-module.nix index 3f38ffc7d..522e7cdb8 100644 --- a/maintainers/flake-module.nix +++ b/maintainers/flake-module.nix @@ -134,7 +134,6 @@ ''^tests/functional/local-overlay-store/delete-duplicate\.sh$'' ''^tests/functional/local-overlay-store/delete-refs-inner\.sh$'' ''^tests/functional/local-overlay-store/delete-refs\.sh$'' - ''^tests/functional/local-overlay-store/gc-inner\.sh$'' ''^tests/functional/logging\.sh$'' ''^tests/functional/misc\.sh$'' ''^tests/functional/multiple-outputs\.sh$'' diff --git a/tests/functional/local-overlay-store/gc-inner.sh b/tests/functional/local-overlay-store/gc-inner.sh index 687fed897..3e63c9398 100644 --- a/tests/functional/local-overlay-store/gc-inner.sh +++ b/tests/functional/local-overlay-store/gc-inner.sh @@ -21,24 +21,24 @@ outPath=$(nix-build ../hermetic.nix --no-out-link --arg busybox "$busybox" --arg # Set a GC root. mkdir -p "$stateB" rm -f "$stateB/gcroots/foo" -ln -sf $outPath "$stateB/gcroots/foo" +ln -sf "$outPath" "$stateB/gcroots/foo" -[ "$(nix-store -q --roots $outPath)" = "$stateB/gcroots/foo -> $outPath" ] +[ "$(nix-store -q --roots "$outPath")" = "$stateB/gcroots/foo -> $outPath" ] -nix-store --gc --print-roots | grep $outPath -nix-store --gc --print-live | grep $outPath -if nix-store --gc --print-dead | grep -E $outPath$; then false; fi +nix-store --gc --print-roots | grep "$outPath" +nix-store --gc --print-live | grep "$outPath" +if nix-store --gc --print-dead | grep -E "$outPath"$; then false; fi nix-store --gc --print-dead -expect 1 nix-store --delete $outPath +expect 1 nix-store --delete "$outPath" test -e "$storeBRoot/$outPath" shopt -s nullglob -for i in $storeBRoot/*; do +for i in "$storeBRoot"/*; do if [[ $i =~ /trash ]]; then continue; fi # compat with old daemon - touch $i.lock - touch $i.chroot + touch "$i".lock + touch "$i".chroot done nix-collect-garbage @@ -51,7 +51,8 @@ rm "$stateB/gcroots/foo" nix-collect-garbage # Check that the output has been GC'd. -test ! -e $outPath +test ! -e "$outPath" # Check that the store is empty. +# shellcheck disable=SC2012 [ "$(ls -1 "$storeBTop" | wc -l)" = "0" ] From 326d626ad7f1708ed107bf0dd704e89bbed31720 Mon Sep 17 00:00:00 2001 From: Farid Zakaria Date: Sun, 28 Sep 2025 20:32:12 -0700 Subject: [PATCH 12/18] shellcheck fix: tests/functional/local-overlay-store/delete-refs-inner.sh --- maintainers/flake-module.nix | 2 -- .../local-overlay-store/delete-refs-inner.sh | 17 +++++++++-------- .../local-overlay-store/delete-refs.sh | 1 + 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/maintainers/flake-module.nix b/maintainers/flake-module.nix index 522e7cdb8..f527a6d39 100644 --- a/maintainers/flake-module.nix +++ b/maintainers/flake-module.nix @@ -132,8 +132,6 @@ ''^tests/functional/local-overlay-store/common\.sh$'' ''^tests/functional/local-overlay-store/delete-duplicate-inner\.sh$'' ''^tests/functional/local-overlay-store/delete-duplicate\.sh$'' - ''^tests/functional/local-overlay-store/delete-refs-inner\.sh$'' - ''^tests/functional/local-overlay-store/delete-refs\.sh$'' ''^tests/functional/logging\.sh$'' ''^tests/functional/misc\.sh$'' ''^tests/functional/multiple-outputs\.sh$'' diff --git a/tests/functional/local-overlay-store/delete-refs-inner.sh b/tests/functional/local-overlay-store/delete-refs-inner.sh index 385eeadc9..f54ef2bb6 100644 --- a/tests/functional/local-overlay-store/delete-refs-inner.sh +++ b/tests/functional/local-overlay-store/delete-refs-inner.sh @@ -15,6 +15,7 @@ initLowerStore mountOverlayfs export NIX_REMOTE="$storeB" +# shellcheck disable=SC2034 stateB="$storeBRoot/nix/var/nix" hermetic=$(nix-build ../hermetic.nix --no-out-link --arg busybox "$busybox" --arg withFinalRefs true --arg seed 2) input1=$(nix-build ../hermetic.nix --no-out-link --arg busybox "$busybox" --arg withFinalRefs true --arg seed 2 -A passthru.input1 -j0) @@ -22,18 +23,18 @@ 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" +expectStderr 1 nix-store --delete "$input2" | grepQuiet "Cannot delete path" +expectStderr 1 nix-store --delete "$input3" | grepQuiet "Cannot delete 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" +expectStderr 1 nix-store --store "$storeA" --delete "$input3" | grepQuiet "Cannot delete path" # Can delete -nix-store --delete $hermetic +nix-store --delete "$hermetic" # Now unreferenced in upper layer, can delete -nix-store --delete $input3 -nix-store --delete $input2 +nix-store --delete "$input3" +nix-store --delete "$input2" diff --git a/tests/functional/local-overlay-store/delete-refs.sh b/tests/functional/local-overlay-store/delete-refs.sh index 62295aaa1..4fe08a077 100755 --- a/tests/functional/local-overlay-store/delete-refs.sh +++ b/tests/functional/local-overlay-store/delete-refs.sh @@ -1,3 +1,4 @@ +# shellcheck shell=bash source common.sh source ../common/init.sh From 20665e1c3d4e9b775a6da18337cb0d0e7eacc43d Mon Sep 17 00:00:00 2001 From: Farid Zakaria Date: Sun, 28 Sep 2025 20:32:49 -0700 Subject: [PATCH 13/18] shellcheck fix: tests/functional/local-overlay-store/delete-duplicate-inner.sh --- maintainers/flake-module.nix | 2 -- tests/functional/local-overlay-store/delete-duplicate.sh | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/maintainers/flake-module.nix b/maintainers/flake-module.nix index f527a6d39..f83ad2a7c 100644 --- a/maintainers/flake-module.nix +++ b/maintainers/flake-module.nix @@ -130,8 +130,6 @@ ''^tests/functional/local-overlay-store/check-post-init-inner\.sh$'' ''^tests/functional/local-overlay-store/check-post-init\.sh$'' ''^tests/functional/local-overlay-store/common\.sh$'' - ''^tests/functional/local-overlay-store/delete-duplicate-inner\.sh$'' - ''^tests/functional/local-overlay-store/delete-duplicate\.sh$'' ''^tests/functional/logging\.sh$'' ''^tests/functional/misc\.sh$'' ''^tests/functional/multiple-outputs\.sh$'' diff --git a/tests/functional/local-overlay-store/delete-duplicate.sh b/tests/functional/local-overlay-store/delete-duplicate.sh index e3b94e1cb..8a11350dc 100644 --- a/tests/functional/local-overlay-store/delete-duplicate.sh +++ b/tests/functional/local-overlay-store/delete-duplicate.sh @@ -1,3 +1,4 @@ +# shellcheck shell=bash source common.sh source ../common/init.sh From bb97f4b07aec9842d0e5663b186d674d34b16981 Mon Sep 17 00:00:00 2001 From: Farid Zakaria Date: Sun, 28 Sep 2025 20:35:47 -0700 Subject: [PATCH 14/18] shellcheck fix: tests/functional/local-overlay-store/common.sh --- maintainers/flake-module.nix | 1 - tests/functional/local-overlay-store/common.sh | 14 ++++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/maintainers/flake-module.nix b/maintainers/flake-module.nix index f83ad2a7c..4d235f0fa 100644 --- a/maintainers/flake-module.nix +++ b/maintainers/flake-module.nix @@ -129,7 +129,6 @@ ''^tests/functional/local-overlay-store/build\.sh$'' ''^tests/functional/local-overlay-store/check-post-init-inner\.sh$'' ''^tests/functional/local-overlay-store/check-post-init\.sh$'' - ''^tests/functional/local-overlay-store/common\.sh$'' ''^tests/functional/logging\.sh$'' ''^tests/functional/misc\.sh$'' ''^tests/functional/multiple-outputs\.sh$'' diff --git a/tests/functional/local-overlay-store/common.sh b/tests/functional/local-overlay-store/common.sh index ba9b2805b..39ffa6e5a 100644 --- a/tests/functional/local-overlay-store/common.sh +++ b/tests/functional/local-overlay-store/common.sh @@ -1,3 +1,4 @@ +# shellcheck shell=bash source ../common/vars.sh source ../common/functions.sh @@ -54,6 +55,7 @@ setupStoreDirs () { storeA="$storeVolume/store-a" storeBTop="$storeVolume/store-b" storeBRoot="$storeVolume/merged-store" + # shellcheck disable=SC2034 storeB="local-overlay://?root=$storeBRoot&lower-store=$storeA&upper-layer=$storeBTop" # Creating testing directories mkdir -p "$storeVolume"/{store-a/nix/store,store-b,merged-store/nix/store,workdir} @@ -69,8 +71,10 @@ mountOverlayfs () { || skipTest "overlayfs is not supported" cleanupOverlay () { + # shellcheck disable=2317 umount -n "$storeBRoot/nix/store" - rm -r $storeVolume/workdir + # shellcheck disable=2317 + rm -r "$storeVolume"/workdir } trap cleanupOverlay EXIT } @@ -82,7 +86,8 @@ remountOverlayfs () { toRealPath () { storeDir=$1; shift storePath=$1; shift - echo $storeDir$(echo $storePath | sed "s^${NIX_STORE_DIR:-/nix/store}^^") + # shellcheck disable=SC2001 + echo "$storeDir""$(echo "$storePath" | sed "s^${NIX_STORE_DIR:-/nix/store}^^")" } initLowerStore () { @@ -90,8 +95,9 @@ initLowerStore () { nix-store --store "$storeA" --add ../dummy # Build something in lower store - drvPath=$(nix-instantiate --store $storeA ../hermetic.nix --arg withFinalRefs true --arg busybox "$busybox" --arg seed 1) - pathInLowerStore=$(nix-store --store "$storeA" --realise $drvPath) + drvPath=$(nix-instantiate --store "$storeA" ../hermetic.nix --arg withFinalRefs true --arg busybox "$busybox" --arg seed 1) + # shellcheck disable=SC2034 + pathInLowerStore=$(nix-store --store "$storeA" --realise "$drvPath") } addTextToStore() { From 6cae8da29dc1a12c8defbf0105c420e75507bee0 Mon Sep 17 00:00:00 2001 From: Farid Zakaria Date: Sun, 28 Sep 2025 20:37:23 -0700 Subject: [PATCH 15/18] shellcheck fix: tests/functional/local-overlay-store/check-post-init.sh --- maintainers/flake-module.nix | 2 -- .../check-post-init-inner.sh | 30 +++++++++---------- .../local-overlay-store/check-post-init.sh | 1 + 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/maintainers/flake-module.nix b/maintainers/flake-module.nix index 4d235f0fa..e78766669 100644 --- a/maintainers/flake-module.nix +++ b/maintainers/flake-module.nix @@ -127,8 +127,6 @@ ''^tests/functional/local-overlay-store/bad-uris\.sh$'' ''^tests/functional/local-overlay-store/build-inner\.sh$'' ''^tests/functional/local-overlay-store/build\.sh$'' - ''^tests/functional/local-overlay-store/check-post-init-inner\.sh$'' - ''^tests/functional/local-overlay-store/check-post-init\.sh$'' ''^tests/functional/logging\.sh$'' ''^tests/functional/misc\.sh$'' ''^tests/functional/multiple-outputs\.sh$'' diff --git a/tests/functional/local-overlay-store/check-post-init-inner.sh b/tests/functional/local-overlay-store/check-post-init-inner.sh index ac2499002..5f8050f89 100755 --- a/tests/functional/local-overlay-store/check-post-init-inner.sh +++ b/tests/functional/local-overlay-store/check-post-init-inner.sh @@ -19,41 +19,41 @@ mountOverlayfs ### Check status # Checking for path in lower layer -stat $(toRealPath "$storeA/nix/store" "$pathInLowerStore") +stat "$(toRealPath "$storeA/nix/store" "$pathInLowerStore")" # Checking for path in upper layer (should fail) -expect 1 stat $(toRealPath "$storeBTop" "$pathInLowerStore") +expect 1 stat "$(toRealPath "$storeBTop" "$pathInLowerStore")" # Checking for path in overlay store matching lower layer -diff $(toRealPath "$storeA/nix/store" "$pathInLowerStore") $(toRealPath "$storeBRoot/nix/store" "$pathInLowerStore") +diff "$(toRealPath "$storeA/nix/store" "$pathInLowerStore")" "$(toRealPath "$storeBRoot/nix/store" "$pathInLowerStore")" # Checking requisites query agreement [[ \ - $(nix-store --store $storeA --query --requisites $drvPath) \ + $(nix-store --store "$storeA" --query --requisites "$drvPath") \ == \ - $(nix-store --store $storeB --query --requisites $drvPath) \ + $(nix-store --store "$storeB" --query --requisites "$drvPath") \ ]] # Checking referrers query agreement -busyboxStore=$(nix store --store $storeA add-path $busybox) +busyboxStore=$(nix store --store "$storeA" add-path "$busybox") [[ \ - $(nix-store --store $storeA --query --referrers $busyboxStore) \ + $(nix-store --store "$storeA" --query --referrers "$busyboxStore") \ == \ - $(nix-store --store $storeB --query --referrers $busyboxStore) \ + $(nix-store --store "$storeB" --query --referrers "$busyboxStore") \ ]] # Checking derivers query agreement [[ \ - $(nix-store --store $storeA --query --deriver $pathInLowerStore) \ + $(nix-store --store "$storeA" --query --deriver "$pathInLowerStore") \ == \ - $(nix-store --store $storeB --query --deriver $pathInLowerStore) \ + $(nix-store --store "$storeB" --query --deriver "$pathInLowerStore") \ ]] # Checking outputs query agreement [[ \ - $(nix-store --store $storeA --query --outputs $drvPath) \ + $(nix-store --store "$storeA" --query --outputs "$drvPath") \ == \ - $(nix-store --store $storeB --query --outputs $drvPath) \ + $(nix-store --store "$storeB" --query --outputs "$drvPath") \ ]] # Verifying path in lower layer @@ -62,10 +62,10 @@ nix-store --verify-path --store "$storeA" "$pathInLowerStore" # Verifying path in merged-store nix-store --verify-path --store "$storeB" "$pathInLowerStore" -hashPart=$(echo $pathInLowerStore | sed "s^${NIX_STORE_DIR:-/nix/store}/^^" | sed 's/-.*//') +hashPart=$(echo "$pathInLowerStore" | sed "s^${NIX_STORE_DIR:-/nix/store}/^^" | sed 's/-.*//') # Lower store can find from hash part -[[ $(nix store --store $storeA path-from-hash-part $hashPart) == $pathInLowerStore ]] +[[ $(nix store --store "$storeA" path-from-hash-part "$hashPart") == "$pathInLowerStore" ]] # merged store can find from hash part -[[ $(nix store --store $storeB path-from-hash-part $hashPart) == $pathInLowerStore ]] +[[ $(nix store --store "$storeB" path-from-hash-part "$hashPart") == "$pathInLowerStore" ]] diff --git a/tests/functional/local-overlay-store/check-post-init.sh b/tests/functional/local-overlay-store/check-post-init.sh index e0c260276..323b9e489 100755 --- a/tests/functional/local-overlay-store/check-post-init.sh +++ b/tests/functional/local-overlay-store/check-post-init.sh @@ -1,3 +1,4 @@ +# shellcheck shell=bash source common.sh source ../common/init.sh From 8f1430153360dee20c62ce2a2d01f3be467b5450 Mon Sep 17 00:00:00 2001 From: Farid Zakaria Date: Sun, 28 Sep 2025 20:38:46 -0700 Subject: [PATCH 16/18] shellcheck fix: tests/functional/local-overlay-store/build-inner.sh --- maintainers/flake-module.nix | 2 -- tests/functional/local-overlay-store/build-inner.sh | 6 +++--- tests/functional/local-overlay-store/build.sh | 1 + 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/maintainers/flake-module.nix b/maintainers/flake-module.nix index e78766669..feb69ada0 100644 --- a/maintainers/flake-module.nix +++ b/maintainers/flake-module.nix @@ -125,8 +125,6 @@ ''^tests/functional/local-overlay-store/add-lower-inner\.sh$'' ''^tests/functional/local-overlay-store/add-lower\.sh$'' ''^tests/functional/local-overlay-store/bad-uris\.sh$'' - ''^tests/functional/local-overlay-store/build-inner\.sh$'' - ''^tests/functional/local-overlay-store/build\.sh$'' ''^tests/functional/logging\.sh$'' ''^tests/functional/misc\.sh$'' ''^tests/functional/multiple-outputs\.sh$'' diff --git a/tests/functional/local-overlay-store/build-inner.sh b/tests/functional/local-overlay-store/build-inner.sh index 1f3ddded7..2463e4467 100755 --- a/tests/functional/local-overlay-store/build-inner.sh +++ b/tests/functional/local-overlay-store/build-inner.sh @@ -18,13 +18,13 @@ mountOverlayfs ### Do a build in overlay store -path=$(nix-build ../hermetic.nix --arg busybox $busybox --arg seed 2 --store "$storeB" --no-out-link) +path=$(nix-build ../hermetic.nix --arg busybox "$busybox" --arg seed 2 --store "$storeB" --no-out-link) # Checking for path in lower layer (should fail) -expect 1 stat $(toRealPath "$storeA/nix/store" "$path") +expect 1 stat "$(toRealPath "$storeA/nix/store" "$path")" # Checking for path in upper layer -stat $(toRealPath "$storeBTop" "$path") +stat "$(toRealPath "$storeBTop" "$path")" # Verifying path in overlay store nix-store --verify-path --store "$storeB" "$path" diff --git a/tests/functional/local-overlay-store/build.sh b/tests/functional/local-overlay-store/build.sh index 2251be7e7..d4a29d6c2 100755 --- a/tests/functional/local-overlay-store/build.sh +++ b/tests/functional/local-overlay-store/build.sh @@ -1,3 +1,4 @@ +# shellcheck shell=bash source common.sh source ../common/init.sh From 8f0d9412baf0690713fac92b708c6d3bd6239905 Mon Sep 17 00:00:00 2001 From: Farid Zakaria Date: Sun, 28 Sep 2025 20:39:40 -0700 Subject: [PATCH 17/18] shellcheck fix: tests/functional/local-overlay-store/bad-uris.sh --- maintainers/flake-module.nix | 1 - tests/functional/local-overlay-store/bad-uris.sh | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/maintainers/flake-module.nix b/maintainers/flake-module.nix index feb69ada0..500a05c92 100644 --- a/maintainers/flake-module.nix +++ b/maintainers/flake-module.nix @@ -124,7 +124,6 @@ ''^tests/functional/linux-sandbox\.sh$'' ''^tests/functional/local-overlay-store/add-lower-inner\.sh$'' ''^tests/functional/local-overlay-store/add-lower\.sh$'' - ''^tests/functional/local-overlay-store/bad-uris\.sh$'' ''^tests/functional/logging\.sh$'' ''^tests/functional/misc\.sh$'' ''^tests/functional/multiple-outputs\.sh$'' diff --git a/tests/functional/local-overlay-store/bad-uris.sh b/tests/functional/local-overlay-store/bad-uris.sh index f0c6a151c..1b5b7fc54 100644 --- a/tests/functional/local-overlay-store/bad-uris.sh +++ b/tests/functional/local-overlay-store/bad-uris.sh @@ -1,3 +1,4 @@ +# shellcheck shell=bash source common.sh source ../common/init.sh @@ -5,7 +6,7 @@ requireEnvironment setupConfig setupStoreDirs -mkdir -p $TEST_ROOT/bad_test +mkdir -p "$TEST_ROOT"/bad_test badTestRoot=$TEST_ROOT/bad_test storeBadRoot="local-overlay://?root=$badTestRoot&lower-store=$storeA&upper-layer=$storeBTop" storeBadLower="local-overlay://?root=$storeBRoot&lower-store=$badTestRoot&upper-layer=$storeBTop" @@ -18,7 +19,8 @@ declare -a storesBad=( TODO_NixOS for i in "${storesBad[@]}"; do - echo $i + echo "$i" + # shellcheck disable=SC2119 execUnshare < Date: Sun, 28 Sep 2025 20:40:08 -0700 Subject: [PATCH 18/18] shellcheck fix: tests/functional/local-overlay-store/add-lower-inner.sh --- maintainers/flake-module.nix | 2 -- tests/functional/local-overlay-store/add-lower.sh | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/maintainers/flake-module.nix b/maintainers/flake-module.nix index 500a05c92..8c84d0517 100644 --- a/maintainers/flake-module.nix +++ b/maintainers/flake-module.nix @@ -122,8 +122,6 @@ ''^tests/functional/install-darwin\.sh$'' ''^tests/functional/legacy-ssh-store\.sh$'' ''^tests/functional/linux-sandbox\.sh$'' - ''^tests/functional/local-overlay-store/add-lower-inner\.sh$'' - ''^tests/functional/local-overlay-store/add-lower\.sh$'' ''^tests/functional/logging\.sh$'' ''^tests/functional/misc\.sh$'' ''^tests/functional/multiple-outputs\.sh$'' diff --git a/tests/functional/local-overlay-store/add-lower.sh b/tests/functional/local-overlay-store/add-lower.sh index 33bf20ebd..87cdb4f59 100755 --- a/tests/functional/local-overlay-store/add-lower.sh +++ b/tests/functional/local-overlay-store/add-lower.sh @@ -1,3 +1,4 @@ +# shellcheck shell=bash source common.sh source ../common/init.sh