]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: make misc/write-errors.sh immune to default signal disposition
authorPádraig Brady <P@draigBrady.com>
Sun, 12 Jan 2025 12:44:37 +0000 (12:44 +0000)
committerPádraig Brady <P@draigBrady.com>
Sun, 12 Jan 2025 12:44:37 +0000 (12:44 +0000)
* tests/misc/write-errors.sh: Reset SIGPIPE to the default (terminate)
disposition, so that the test doesn't erroneously fail due to an
ignored SIGPIPE in the test environment.

tests/misc/write-errors.sh

index 5a25bbd4a4bd2ae2d84f3809dcf5728238109b3a..78379b542cf2ef93df36bc630ce86ddc10aff965 100755 (executable)
@@ -17,7 +17,7 @@
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
-print_ver_ timeout
+print_ver_ timeout env
 
 if ! test -w /dev/full || ! test -c /dev/full; then
   skip_ '/dev/full is required'
@@ -66,13 +66,15 @@ while read writer; do
 
   # Check /dev/full handling
   rm -f full.err || framework_failure_
-  timeout 10 $SHELL -c "($ulimit && $writer 2>full.err >/dev/full)"
+  timeout 10 env --default-signal=PIPE $SHELL -c \
+    "($ulimit && $writer 2>full.err >/dev/full)"
   { test $? = 124 || ! grep 'space' full.err >/dev/null; } &&
    { fail=1; cat full.err; echo "$writer: failed to exit" >&2; }
 
   # Check closed pipe handling
   rm -f pipe.err || framework_failure_
-  timeout 10 $SHELL -c "($ulimit && $writer 2>pipe.err | :)"
+  timeout 10 env --default-signal=PIPE $SHELL -c \
+    "($ulimit && $writer 2>pipe.err | :)"
   { test $? = 0 && compare /dev/null pipe.err; } ||
    { fail=1; cat pipe.err; echo "$writer: failed to write to closed pipe" >&2; }
 done < built_writers