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

From: Jonny Grant <[email-masked]>
Date: Sun, 5 Jul 2020 11:53:26 +0100

On 05/07/2020 00:25, Bernhard Voelker wrote:
> On 2020-07-04 00:57, Jonny Grant wrote:
>> 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.
> 
> Thanks for the patch - this is always a great basis for discussions.
> 
> Well, this 128+9 arithmetic is explained just a couple of lines above,
> i.e., where all the value for the exit status are described.
> So adding it here again looks like repetition to me.

Fair enough.

>> 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.
> 
> Good catch, this is only documented in --help output (and therefore in timeout.1):
> 
>   -k, --kill-after=DURATION
>                  also send a KILL signal if COMMAND is still running
>                    this long after the initial signal was sent
> 
> What about the attached?
> 
> Thanks & have a nice day,
> Berny
> 

Hi Berny

Your patch looks great.

Is it worth clarifying that --kill-after=0s would send the KILL signal immediately after TERM?
$ timeout --kill-after=0s 2s du -h

Is it worth rejecting this? At the moment the -k is just ignored.
$ timeout -k 2s 0s du -h

Cheers
Jonny