[BusyBox 0001984]: No trap handlers are called when wait is interrupted (with possible fix)
bugs at busybox.net
bugs at busybox.net
Mon Jan 28 23:50:09 UTC 2008
A NOTE has been added to this issue.
======================================================================
http://busybox.net/bugs/view.php?id=1984
======================================================================
Reported By: Ronald Wahl
Assigned To: BusyBox
======================================================================
Project: BusyBox
Issue ID: 1984
Category: Other
Reproducibility: always
Severity: major
Priority: normal
Status: assigned
======================================================================
Date Submitted: 01-28-2008 13:47 PST
Last Modified: 01-28-2008 15:50 PST
======================================================================
Summary: No trap handlers are called when wait is interrupted
(with possible fix)
Description:
The following shell sccrips does not behave correctly:
----------------------------------
trap_handler () {
echo trap
}
trap trap_handler USR1
sleep 3600 &
while(true); do wait; done
----------------------------------
Expected behavior: Sending a USR1 signal to the shell should cause "trap"
to be printed each time the signal is sent.
Actual behavior:
bash: works as expected
1.01: works as expected
1.1.x ... 1.4.x: only the first signal is honoured
1.5.x ... 1.9.0: nothing happens
The bug came with SVN revision 18198 of ash.c:
------------------------------
@@ -324,11 +331,13 @@
onsig(int signo)
{
gotsig[signo - 1] = 1;
- pendingsigs = signo;
+ pendingsig = signo;
if (exsig || (signo == SIGINT && !trap[SIGINT])) {
- if (!suppressint)
+ if (!suppressint) {
+ pendingsig = 0;
raise_interrupt();
+ }
intpending = 1;
}
}
------------------------------
If I remove the "pendingsig = 0;" before raise_interrupt(); it starts
working again.
I'm not sure if this is the right fix. Can anyone comment on this?
======================================================================
----------------------------------------------------------------------
Ronald Wahl - 01-28-08 14:22
----------------------------------------------------------------------
Some additional suggestion: Probably swapping
pendingsig = 0;
raise_interrupt();
is a better approach?
----------------------------------------------------------------------
vda - 01-28-08 15:50
----------------------------------------------------------------------
"pendingsig = 0" was added because of this issue:
http://busybox.net/bugs/view.php?id=1280
Issue History
Date Modified Username Field Change
======================================================================
01-28-08 13:47 Ronald Wahl New Issue
01-28-08 13:47 Ronald Wahl Status new => assigned
01-28-08 13:47 Ronald Wahl Assigned To => BusyBox
01-28-08 14:22 Ronald Wahl Note Added: 0003534
01-28-08 15:50 vda Note Added: 0003539
======================================================================
More information about the busybox-cvs
mailing list