From: Pádraig Brady Date: Sun, 12 Jan 2025 12:44:37 +0000 (+0000) Subject: tests: make misc/write-errors.sh immune to default signal disposition X-Git-Tag: v9.6~26 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e6a1f5a4b0b235a6dd9acf91ab1ae9289fb2ebe6;p=thirdparty%2Fcoreutils.git tests: make misc/write-errors.sh immune to default signal disposition * 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. --- diff --git a/tests/misc/write-errors.sh b/tests/misc/write-errors.sh index 5a25bbd4a4..78379b542c 100755 --- a/tests/misc/write-errors.sh +++ b/tests/misc/write-errors.sh @@ -17,7 +17,7 @@ # along with this program. If not, see . . "${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