BusyBox Bug and Patch Tracking
BusyBox
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0001984 [BusyBox] Other major always 01-28-08 13:47 02-10-08 11:04
Reporter Ronald Wahl View Status public  
Assigned To BusyBox
Priority normal Resolution fixed  
Status closed   Product Version
Summary 0001984: 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?
Additional Information Affected versions: busybox > 1.01

The bug in busybox 1.1.x ... 1.4.x is due to a missing sigsetmask(0) which was
removed.

Starting with busybox 1.5.0 the sigsetmask(0) was added again in a more modern form using setprocmask.
Attached Files

- Relationships

- Notes
(0003534)
Ronald Wahl
01-28-08 14:22

Some additional suggestion: Probably swapping

pendingsig = 0;
raise_interrupt();

is a better approach?
 
(0003539)
vda
01-28-08 15:50

"pendingsig = 0" was added because of this issue:

http://busybox.net/bugs/view.php?id=1280 [^]
 
(0003544)
vda
01-28-08 15:55

Swapping "pendingsig = 0;" with "raise_interrupt();" is wrong: raise_interrupt() never returns.
 
(0003549)
Ronald Wahl
01-28-08 16:18
edited on: 01-28-08 16:18

if (signo == SIGINT && !trap[SIGINT]) pendingsig = 0;

solves my issue and bug 2 in issue 1280.

 
(0003824)
vda
02-10-08 11:04

Fixed in revision 20973. Thanks.
 

- 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
01-28-08 15:55 vda Note Added: 0003544
01-28-08 16:18 Ronald Wahl Note Added: 0003549
01-28-08 16:18 Ronald Wahl Note Edited: 0003549
02-10-08 11:04 vda Status assigned => closed
02-10-08 11:04 vda Note Added: 0003824
02-10-08 11:04 vda Resolution open => fixed


Copyright © 2000 - 2006 Mantis Group
Powered by Mantis Bugtracker