Re: Possible race condition in bash

2021-02-03 Thread Nikolay Borisov
On 21.11.20 г. 23:15 ч., Chet Ramey wrote: > On 11/21/20 2:32 PM, Andreas Schwab wrote: >> On Nov 21 2020, Chet Ramey wrote: >> >>> but since the shell always ignores SIGTERM, >> >> Even a non-interactive shell? > > No, you're right, it's SIGQUIT the shell always ignores. It catches SIGTERM > i

Re: Possible race condition in bash

2020-11-21 Thread Nikolay Borisov
On 21.11.20 г. 20:50 ч., Chet Ramey wrote: > On 11/21/20 1:35 PM, Nikolay Borisov wrote: > >> I can see setting of SIGTERM handler for both 2 subshells _after_ receiving >> the signal. What exactly should I be looking at? > > That's your race condition. >

Re: Possible race condition in bash

2020-11-21 Thread Nikolay Borisov
On 21.11.20 г. 20:50 ч., Chet Ramey wrote: > On 11/21/20 1:35 PM, Nikolay Borisov wrote: > >> I can see setting of SIGTERM handler for both 2 subshells _after_ receiving >> the signal. What exactly should I be looking at? > > That's your race condition.

Re: Possible race condition in bash

2020-11-21 Thread Nikolay Borisov
On 21.11.20 г. 20:09 ч., Chet Ramey wrote: > On 11/21/20 3:06 AM, Nikolay Borisov wrote: > >> The output is: >> >> my pid 12186 >> 12186 subfun xxx 0 >> funpid=12186 twopid=12187 mypid=12185 >> killing 12186 12187 >> waiting on everything >&g

Possible race condition in bash

2020-11-21 Thread Nikolay Borisov
Hello, It's possible to have the following script never terminate: #!/bin/bash subfun() { trap "echo received term for $*;exit 1" SIGTERM echo my pid $BASHPID i=0 while true; do echo $BASHPID subfun $* $i i=$((i+1)) sleep 5 done } trap 'ec