Problem with SIGINT in ash

Denys Vlasenko vda.linux at googlemail.com
Mon Dec 15 21:32:39 UTC 2008


On Monday 15 December 2008 18:33, Sergio wrote:
> I found that a shell script like this:
> 
> #!/bin/ash
> while true
> do
>   echo Kill me
>   sleep 1
> done
> 
> is not killed by a SIGINT (ctrl+c), instead it duplicates in another instance.
> A SIGTERM signal correctly kills the script.
> 
> I have take a look to ash.c, probably there is something in onsig() and/or 
> raise_interrupt() functions but there is too much code to understand for 
> me, sorry.
> 
> After some test I found that:
> 
> - setting a trap for SIGINT in the script before the loop (trap exit 2)
>    makes things working
> 
> - the same script, without the "sleep", is correctly killed by SIGINT
> 
> - if the commands are run directly from the console:
>    while true; do echo Kill me; sleep 1; done
>    SIGINT always kills it
> 
> This problem is found on BB 1.12.3 and 1.13.1 but not on 1.9.2

Yes, one bug was fixed, another one appeared instead :(
I updated testsuite to stop it from happening.
I also installed ash as /bin/sh on my desktop, this ought
to expose it for more testing! :)

Fixed in svn. Download ash.c:

http://busybox.net/cgi-bin/viewcvs.cgi/*checkout*/trunk/busybox/shell/ash.c

and simply replace old one in shell/ with it.

Let me know whether it works.
--
vda



More information about the busybox mailing list