[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Possible race condition in bash

From: Chet Ramey
Subject: Re: Possible race condition in bash
Date: Sat, 21 Nov 2020 13:48:20 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.4.3

On 11/21/20 1:25 PM, Andreas Schwab wrote:
> On Nov 21 2020, Chet Ramey wrote:
>> This is a potential race condition, but it's not with the shell.
> The race with the trap command in the function is obvious, but that
> should not result in the signal to be ignored.  There should always be a
> trap active, either the main one or the one in the function, and neither
> ignores the signal.


"A subshell environment shall be created as a duplicate of the shell
environment, except that signal traps that are not being ignored shall be
set to the default action."

In this case, bash resets the signal disposition to the what it had when
the shell started. That should be SIG_DFL, but since the shell always
ignores SIGTERM, it's not clear from the description here what the signal
handler gets set to. That's why I suggested looking at strace output.

I'd also try it with one of the bash-5.1 testing releases, since I did
some reworking of how the shell handles SIGTERM back in April.

``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]