Problem with SIGINT in ash

Sergio sergio.biasi at elsagdatamat.com
Mon Dec 15 17:33:26 UTC 2008


Hello list,

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

	Sergio

-- 
Free software is a matter of liberty, not price. To understand the concept,
you should think of free as in free speech, not as in free beer
- Richard Stallman

http://www.gnu.org/philosophy/free-sw.html





More information about the busybox mailing list