You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
timeout: -k sends KILL even though the first signal already ended the command #16642
Hi, I'd like to work on this. The plan is to only send the KILL after the -k duration if the command is still running after the first signal, and to add a test for the -s INT 0.2 sleep 5 case (expected exit 124, no KILL message). Could I be assigned?
The same repro across signals, in case it helps with the test cases. This is on Ubuntu 26.04.1 (the ubuntu:26.04 image), with uutils timeout 0.10.0 (the image's) and the 0.12.0 release binary (coreutils-0.12.0-x86_64-unknown-linux-musl) against GNU timeout 9.7, which the image also ships as gnutimeout. The image's sleep is uutils's, so the child is GNU sleep, shipped there as gnusleep, and only timeout differs. The command is timeout --verbose -k 2 -s SIG 0.2 gnusleep 5. Each cell held in three runs out of three, for 0.10.0 and 0.12.0 alike:
-s
uutils 0.10.0 and 0.12.0
GNU 9.7
HUP, INT, QUIT, USR1, USR2, ALRM, PIPE
KILL sent right after the signal, exit 137 at about 0.21 s
no KILL, exit 124 at about 0.21 s
TERM
no KILL, exit 124 at about 0.21 s
no KILL, exit 124 at about 0.21 s
WINCH, URG, CONT, CHLD (their default action does not end sleep)
KILL after the 2 s grace, exit 137 at about 2.21 s
the same
So the early KILL happens for every signal tried that ends the command, except TERM. When the first signal does not end the command, the grace period is honoured as in GNU.
Activity
Sahil-Gulihar commentedon Nov 17, 2026
Hi, I'd like to work on this. The plan is to only send the KILL after the
-kduration if the command is still running after the first signal, and to add a test for the-s INT 0.2 sleep 5case (expected exit 124, no KILL message). Could I be assigned?pjt222 commentedon Nov 19, 2026
The same repro across signals, in case it helps with the test cases. This is on Ubuntu 26.04.1 (the
ubuntu:26.04image), with uutilstimeout0.10.0 (the image's) and the 0.12.0 release binary (coreutils-0.12.0-x86_64-unknown-linux-musl) against GNUtimeout9.7, which the image also ships asgnutimeout. The image'ssleepis uutils's, so the child is GNUsleep, shipped there asgnusleep, and onlytimeoutdiffers. The command istimeout --verbose -k 2 -s SIG 0.2 gnusleep 5. Each cell held in three runs out of three, for 0.10.0 and 0.12.0 alike:-ssleep)So the early KILL happens for every signal tried that ends the command, except TERM. When the first signal does not end the command, the grace period is honoured as in GNU.
fix(timeout): do not escalate to KILL when non-TERM signal ends child
fix(timeout): do not escalate to KILL when non-TERM signal ends child