bug-bash
[Top][All Lists]
Advanced

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

Issue when using job control and SIGCHLD with bash 4.3 (trap is not bein


From: Eduardo A . Bustamante López
Subject: Issue when using job control and SIGCHLD with bash 4.3 (trap is not being run)
Date: Mon, 14 Apr 2014 13:25:35 -0700
User-agent: Mutt/1.5.21 (2010-09-15)

Hi,

I was playing with set -m and trapping CHLD in a script, and found
the following error:

$ cat setm-bad.bash
set -m
i=0
trap ':; ((++i<5)) && { f & }' CHLD
f(){ echo x; }
f &
wait

$ cat setm.bash
set -m
i=0
trap '((++i<5)) && { f & }' CHLD
f(){ echo x; }
f &
wait

$ cat reproduce.bash  
for bash in /bin/bash ~/local/bin/bash ~/bb/prefix/bin/bash; do
    echo "$bash"
    "$bash" --version |& head -n1
    echo setm.bash
    "$bash" setm.bash
    echo setm-bad.bash
    "$bash" setm-bad.bash
    echo =====
done
$ bash reproduce.bash
/bin/bash
GNU bash, version 4.2.37(1)-release (x86_64-pc-linux-gnu)
setm.bash
x
x
x
x
x
setm-bad.bash
x
x
x
x
x
=====
/home/dualbus/local/bin/bash
GNU bash, version 4.3.0(1)-rc2 (x86_64-unknown-linux-gnu)
setm.bash
x
x
x
x
x
setm-bad.bash
x
x
x
=====
/home/dualbus/bb/prefix/bin/bash
GNU bash, version 4.3.0(1)-maint (x86_64-unknown-linux-gnu)
setm.bash
x
x
x
x
x
setm-bad.bash
x
x
x
x
x
=====


The bb/prefix version is the devel branch after applying the attached
patch.


As you can notice, bash 4.3 exits earlier. It should do 5 iterations,
but instead, it only completes 3. I found that is has something to do
with using queue_sigchld_trap instead of run_sigchld_trap, which I
assume fixes another issue, but the fix introduced this error.

-- 
Eduardo A. Bustamante López

Attachment: sigchld.patch
Description: Text Data


reply via email to

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