[BusyBox 0005304]: Busybox ash ignoring SIGINT when it shouldn't be

bugs at busybox.net bugs at busybox.net
Mon Oct 27 13:45:13 UTC 2008


A NOTE has been added to this issue. 
====================================================================== 
http://busybox.net/bugs/view.php?id=5304 
====================================================================== 
Reported By:                ianw
Assigned To:                BusyBox
====================================================================== 
Project:                    BusyBox
Issue ID:                   5304
Category:                   Other
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     assigned
====================================================================== 
Date Submitted:             10-08-2008 08:58 PDT
Last Modified:              10-27-2008 06:45 PDT
====================================================================== 
Summary:                    Busybox ash ignoring SIGINT when it shouldn't be
Description: 
Hi,

As per the attached program; the busybox shell will never register the
SIGINT and die; it remains in a tight loop printing out it's PID.
====================================================================== 

---------------------------------------------------------------------- 
 vda - 10-27-08 06:45  
---------------------------------------------------------------------- 
Your example is racy. Most of the time kill -INT manages to kill off child
shell before it manages to disable SIGINT. This is a fixed example:

#!/bin/sh
sh -c 'echo Child: $$; while sleep 1; do echo -n c; done' &
PID=$!
sleep 0.1
while kill -0 $PID >/dev/null 2>&1; do
    sleep 0.5
    kill -INT $PID >/dev/null 2>&1
    echo -n $?
done

Because of sleep 0.1, now child have time to set SIGINT as it wants it,
and kill -INT does not kill child anymore. This example works the same
with bash and busybox ash.

However, this example does not work with busybox ash:

#!/bin/sh
sh -c 'echo Child: $$; while sleep 1; do echo -n c; done' &
PID=$!
sleep 0.1
while kill -0 $PID >/dev/null 2>&1; do
#   sleep 0.5
    kill -INT $PID >/dev/null 2>&1 || echo Killed
done

If I kill th child from another console, parent gets SIGCHLD and does not
wait() for exited child. Child remains a zombie, kill $PID still works,
parent loops forever. With bash. it detects child death and exits. 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
10-08-08 08:58  ianw           New Issue                                    
10-08-08 08:58  ianw           Status                   new => assigned     
10-08-08 08:58  ianw           Assigned To               => BusyBox         
10-08-08 08:58  ianw           File Added: test.sh                          
10-27-08 06:45  vda            Note Added: 0014344                          
======================================================================




More information about the busybox-cvs mailing list