]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: shred: check shred explicit deallocation
authorPádraig Brady <P@draigBrady.com>
Thu, 14 May 2026 13:25:41 +0000 (14:25 +0100)
committerPádraig Brady <P@draigBrady.com>
Thu, 14 May 2026 13:49:47 +0000 (14:49 +0100)
* tests/shred/shred-remove.sh: Ensure shred deallocates with
read-only directories, or '-' used to represent standard output.

tests/shred/shred-remove.sh

index f5d746562408e527edd06dd709b8b89d069c6dab..6df27856175f31b09a203c2e460ad162c1f5d0fa 100755 (executable)
@@ -63,8 +63,17 @@ shred: test: removed
 EOF
 compare exp out || fail=1
 
+# Ensure with stdout, file is deallocated but not removed
+echo > $file || framework_failure_
+shred -u - > $file || fail=1
+test -e $file || fail=1
+returns_ 1 test -s $file || fail=1
+
 # Ensure renames are only retried for EEXIST
-mkdir rodir && cd rodir && touch $file && chmod a-w . || framework_failure_
+mkdir rodir && cd rodir && echo > $file && chmod a-w . || framework_failure_
 returns_ 1 timeout 10 shred -u $file || fail=1
+# Also ensure file is deallocated separately to unlink
+returns_ 1 test -s $file || fail=1
+
 
 Exit $fail