[Top][All Lists]

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

Re: Racing condition leads to unstable exit code

From: Luiz Angelo Daros de Luca
Subject: Re: Racing condition leads to unstable exit code
Date: Wed, 03 May 2017 01:07:41 +0000

Hi Chet,

Is there any news on this? I noticed that Bash-4.4 patch 11 do touches
something related to
signals, subshell and command substitution but I still get the same
behavior on 4.4.12(1)-release (x86_64-suse-linux-gnu)

I came up with a smaller script for this bug.

trap "sleep 2" USR1
x=$(kill -USR1 $$; sleep 0.5; exit 2)
echo "$BASHPID:err=$? (should be 2)" >&2

$ bash a.sh
18239:err=0 (should be 2)

If sleep inside trap is 0, err=2. If sleep is greater than 1, err=0


Em qui, 29 de set de 2016 às 16:39, Chet Ramey <address@hidden>

> On 9/23/16 3:04 PM, Luiz Angelo Daros de Luca wrote:
> > Hello,
> >
> > I'm using 'GNU bash, version 4.3.46(1)-release (x86_64-suse-linux-gnu)'
> > provided by OpenSUSE Tumbleweed. I recently faced a problem that,
> depending
> > on the system load, bash returns different exit codes. I detected that it
> > is related to trap processing.
> Thanks for the report.  It is related (indirectly) to trap processing in
> that traps get processed while reading the command substitution output.
> The problem still exists in bash-4.4, and I will probably release a
> bash-4.4 patch to address it.  There are a few things ahead of that in
> the queue, though.
> Chet
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>                  ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRU    address@hidden
> http://cnswww.cns.cwru.edu/~chet/

Luiz Angelo Daros de Luca

reply via email to

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