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.
No. "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 c...@case.edu http://tiswww.cwru.edu/~chet/