[BusyBox 0000994]: when a trap command is set, shell script ignores signals nor from parent
bugs at busybox.net
bugs at busybox.net
Thu Feb 14 17:10:10 UTC 2008
The following issue has been CLOSED
======================================================================
http://busybox.net/bugs/view.php?id=994
======================================================================
Reported By: deeptho
Assigned To: BusyBox
======================================================================
Project: BusyBox
Issue ID: 994
Category: Networking Support
Reproducibility: always
Severity: minor
Priority: normal
Status: closed
Resolution: open
Fixed in Version:
======================================================================
Date Submitted: 08-15-2006 15:31 PDT
Last Modified: 02-14-2008 09:10 PST
======================================================================
Summary: when a trap command is set, shell script ignores
signals nor from parent
Description:
The following script hangs up with
kill -HUP %1
from the current shellm but not
with
kill -HUP <processid> from another shell.
Without the trap, it does react to signals
from another shell, but of course it does not run
the signal handler.
This is a bug, right? Is there any way to make
the script handle a signla sent from another shell>
#!/bin/sh
cleanup ()
{
echo "cleaning"
}
trap cleanup HUP
echo "sleeping "
sleep 100000
echo "done"
======================================================================
----------------------------------------------------------------------
deeptho - 08-15-06 15:32
----------------------------------------------------------------------
This should of course not have been filed under "networking support".
Sorry for that.
----------------------------------------------------------------------
vda - 02-14-08 09:10
----------------------------------------------------------------------
I see absolutely the same behavior with bash. testcase.sh is chmod'ed 755:
#!/bin/sh
cleanup() {
echo "cleaning"
}
trap cleanup HUP
echo "sleeping, pid $$"
sleep 100000
echo "done"
I run it as "./testcase.sh &" in bash or ash. Then "kill -HUP %1" from the
same shell kills testcase.sh and causes these messages to appear:
cleaning
done
whereas "kill -HUP <pid>" from another shell does not, and "jobs" shows
that testcase.sh is still running.
Strace shows that bash simply ignores HUP:
waitpid(-1, 0xfff4ff7c, 0) = ? ERESTARTSYS (To be restarted)
--- SIGHUP (Hangup) @ 0 (0) ---
sigreturn() = ? (mask now [CHLD])
waitpid(-1,
I don't know whether this ash behavior is standard compliant or not, but
it is the same as bash.
Issue History
Date Modified Username Field Change
======================================================================
08-15-06 15:31 deeptho New Issue
08-15-06 15:31 deeptho Status new => assigned
08-15-06 15:31 deeptho Assigned To => BusyBox
08-15-06 15:32 deeptho Note Added: 0001567
08-15-06 15:39 deeptho Issue Monitored: deeptho
02-14-08 09:10 vda Status assigned => closed
02-14-08 09:10 vda Note Added: 0004724
======================================================================
More information about the busybox-cvs
mailing list