]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: make SIGPIPE trap checking more robust
authorPádraig Brady <P@draigBrady.com>
Tue, 15 Nov 2022 13:57:47 +0000 (13:57 +0000)
committerPádraig Brady <P@draigBrady.com>
Tue, 15 Nov 2022 14:02:16 +0000 (14:02 +0000)
* init.cfg (trap_sigpipe_or_skip_): A subshell with ignored SIGPIPE
was seen to not terminate, on Solaris 11 at least.
So protect with a timeout(1).

init.cfg

index 576f6ecd673f70cf43cddff65acdd0fe0b49d1bd..856aa2ee7e297e595d9b5db97a0eb7cb11d427bd 100644 (file)
--- a/init.cfg
+++ b/init.cfg
@@ -636,7 +636,10 @@ mkfifo_or_skip_()
 
 trap_sigpipe_or_skip_()
 {
-  (trap '' PIPE && yes | :) 2>&1 | grep -F 'Broken pipe' >/dev/null ||
+  timeout --version >/dev/null ||
+    skip_ 'trapping SIGPIPE cannot be safely checked'
+
+  (trap '' PIPE && timeout 10 yes |:) 2>&1 | grep 'Broken pipe' >/dev/null ||
     skip_ 'trapping SIGPIPE is not supported'
 }