From b4728bfa9b93f21c0d1d8d181ff2abcd4cd8e1be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= Date: Fri, 30 Oct 2026 14:34:10 +0000 Subject: [PATCH] tests: timeout: fix false failure on some shells The fix in commit v9.12-166-gb6b06854f was incomplete. This is now tested to pass with SHELL=/bin/dash on Debian 10 (which otherwise defaults to bash even though /bin/sh is dash). * tests/timeout/timeout.sh: Ensure the waiting shell's stderr is not redirected to the full pipe, so any "Killed" message does not block things. --- tests/timeout/timeout.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/timeout/timeout.sh b/tests/timeout/timeout.sh index 58e15004c..91812df85 100755 --- a/tests/timeout/timeout.sh +++ b/tests/timeout/timeout.sh @@ -121,8 +121,10 @@ timeout -v .1 $SHELL -c ' test -e term.missed && fail=1 # A group-wide SIGKILL must not wait for the verbose diagnostic either. +# Redirect in a subshell so a waiting shell's "Killed" diagnostic +# cannot block on the filled pipe before recording the exit status. file=kill.status -{ timeout -v -s KILL .1 yes 2>&1 +{ (exec timeout -v -s KILL .1 yes 2>&1) echo $? >kill.status; } | { retry_delay_ file_seen .1 6 || touch kill.missed; } test -e kill.missed && fail=1 @@ -131,7 +133,7 @@ compare kill.exp kill.status || fail=1 # --kill-after must interrupt a blocked diagnostic for the initial signal. file=kill-after.status -{ timeout -v -k .1 .1 $SHELL -c 'trap "" TERM; exec yes >&2' 2>&1 +{ (exec timeout -v -k .1 .1 $SHELL -c 'trap "" TERM; exec yes >&2' 2>&1) echo $? >kill-after.status; } | { retry_delay_ file_seen .1 6 || touch kill-after.missed; } test -e kill-after.missed && fail=1