Subject: Re: bug#41634: 'timeout' returning 124 and 133

From: Jonny Grant <[email-masked]>
Date: Fri, 3 Jul 2020 23:57:19 +0100

On 03/07/2020 23:23, Bernhard Voelker wrote:
> On 2020-06-15 22:57, Bernhard Voelker wrote:
>> The attached is an attempt to add some useful examples.
> 
> There were no comments, so I pushed with a few tweaks:
>   https://git.sv.gnu.org/cgit/coreutils.git/commit/?id=b1c6ef230c
> 
> Marking this as done.
> 
> Have a nice day,
> Berny
> 

Hello Berny

Great you committed this.

May I ask if that exit status 137 could be clarified as 128+9, where 9 is the KILL signal number in this example please. I've pasted a patch below.

Another question, for me it wasn't clear that the "-k 3s" was cumulative with the duration 5, so the total being 8. I thought both durations both counted from when the command was invoked.

https://www.gnu.org/software/coreutils/manual/html_node/timeout-invocation.html#timeout-invocation
‘-k duration’
‘--kill-after=duration’
Ensure the monitored command is killed by also sending a ‘KILL’ signal, after the specified duration. Without this option, if the selected signal proves not to be fatal, timeout does not kill the command.

Could this be clarified as "after the existing duration is added to this specified duration, cumulatively from when the command is invoked."? I can make another patch if this would be fine, and my understanding is correct.

>From b029a83e4bb6f0d51a8f9eef90b5d46905f7ffc2 Mon Sep 17 00:00:00 2001
From: Jonny Grant <[email-masked]>
Date: Fri, 3 Jul 2020 23:51:15 +0100
Subject: [PATCH] Add an explanation of 137 to timeout example

Signed-off-by: Jonny Grant <[email-masked]>
---
 doc/coreutils.texi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index c072b1575..e89ce4d42 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -18178,6 +18178,7 @@ timeout -s INT 5s env --ignore-signal=INT sleep 20
 # Likewise, but sending the KILL signal 3 seconds after the initial
 # INT signal.  Hence, 'sleep' is forcefully terminated after about
 # 8 seconds (5+3), and 'timeout' returns with an exit status of 137.
+# The KILL signal number is 9, and 128+9 is 137
 timeout -s INT -k 3s 5s env --ignore-signal=INT sleep 20
 @end example
 
-- 
2.25.1