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

bugs at busybox.net bugs at busybox.net
Mon Oct 27 14:35:20 UTC 2008


The following issue has been CLOSED 
====================================================================== 
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:                     closed
Resolution:                 open
Fixed in Version:           
====================================================================== 
Date Submitted:             10-08-2008 08:58 PDT
Last Modified:              10-27-2008 07:35 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:52  
---------------------------------------------------------------------- 
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 has 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: it shows child's PID and then "c00c00c00c00..." -
child ignores SIGINT. Looks like bash manpage talks about it here:

       Non-builtin commands run by bash have signal handlers set to the
values
       inherited  by  the  shell  from its parent.  When job control is
not in
       effect, asynchronous commands ignore SIGINT and SIGQUIT in addition
 to
       these inherited handlers.

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 the child from another console, parent gets SIGCHLD, but does
*not* wait() for exited child. This is a bug. Child remains a zombie,
"kill $PID" still works, parent loops forever. With bash, it detects
child's death and exits.

 

---------------------------------------------------------------------- 
 vda - 10-27-08 07:35  
---------------------------------------------------------------------- 
Fixed in rev. 23820. Thanks.
Patch is attached, please reopen this bug if you find that the problem is
not fixed by it. 

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                          
10-27-08 06:45  vda            Note Edited: 0014344                         
10-27-08 06:46  vda            Note Edited: 0014344                         
10-27-08 06:47  vda            Note Edited: 0014344                         
10-27-08 06:48  vda            Note Edited: 0014344                         
10-27-08 06:49  vda            Note Edited: 0014344                         
10-27-08 06:52  vda            Note Edited: 0014344                         
10-27-08 07:33  vda            File Added: 8.patch                          
10-27-08 07:35  vda            Status                   assigned => closed  
10-27-08 07:35  vda            Note Added: 0014354                          
======================================================================




More information about the busybox-cvs mailing list