Magellan Linux

Diff of /trunk/mkinitrd-magellan/busybox/shell/ash_doc.txt

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 983 by niro, Fri Apr 24 18:33:46 2009 UTC revision 984 by niro, Sun May 30 11:32:42 2010 UTC
# Line 14  $ wait Line 14  $ wait
14  ^C  ^C
15  ...  ...
16    
17    
18  Bug 1984 (http://busybox.net/bugs/view.php?id=1984):  Bug 1984 (http://busybox.net/bugs/view.php?id=1984):
19  traps were not triggering:  traps were not triggering:
20    
# Line 29  sleep 3600 & Line 30  sleep 3600 &
30  echo "Please do: kill -USR1 $$"  echo "Please do: kill -USR1 $$"
31  echo "or: kill -INT $$"  echo "or: kill -INT $$"
32  while true; do wait; echo wait interrupted; done  while true; do wait; echo wait interrupted; done
33    
34    
35    Bug 189 (https://bugs.busybox.net/show_bug.cgi?id=189)
36    
37    func() {
38        sleep 1
39    }
40    while (true); do
41        func
42        echo Looping
43    done
44    
45    ^C was observed to make ash processes geometrically multiply (!) instead
46    of exiting. (true) in subshell does not seem to matter, as another user
47    reports the same with:
48    
49    trap "echo USR1" USR1
50    while true; do
51        echo Sleeping
52        sleep 5
53    done
54    
55    Compat note.
56    Bash version 3.2.0(1) exits this script at the receipt of SIGINT
57    _only_ if it had two last children die from it.
58    The following trace was obtained while periodically running
59    "killall -SIGINT sleep; sleep 0.1; kill -SIGINT <bash_PID>":
60    
61    23:48:32.376707 clone(...) = 13528
62    23:48:32.388706 waitpid(-1, 0xffc832ec, 0) = ? ERESTARTSYS (To be restarted)
63    23:48:32.459761 --- SIGINT (Interrupt) @ 0 (0) ---
64        kill -SIGINT <bash_PID> is ignored, back to waiting:
65    23:48:32.463706 waitpid(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0) = 13528
66        sleep exited with 0
67    23:48:37.377557 --- SIGCHLD (Child exited) @ 0 (0) ---
68    23:48:37.378451 clone(...) = 13538
69    23:48:37.390708 waitpid(-1, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGINT}], 0) = 13538
70        sleep was killed by "killall -SIGINT sleep"
71    23:48:38.523944 --- SIGCHLD (Child exited) @ 0 (0) ---
72    23:48:38.524861 clone(...) = 13542
73    23:48:38.538706 waitpid(-1, 0xffc832ec, 0) = ? ERESTARTSYS (To be restarted)
74    23:48:38.624761 --- SIGINT (Interrupt) @ 0 (0) ---
75        kill -SIGINT <bash_PID> is ignored, back to waiting:
76    23:48:38.628706 waitpid(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0) = 13542
77        sleep exited with 0
78    23:48:43.525674 --- SIGCHLD (Child exited) @ 0 (0) ---
79    23:48:43.526563 clone(...) = 13545
80    23:48:43.538709 waitpid(-1, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGINT}], 0) = 13545
81        sleep was killed by "killall -SIGINT sleep"
82    23:48:44.466848 --- SIGCHLD (Child exited) @ 0 (0) ---
83    23:48:44.467735 clone(...) = 13549
84    23:48:44.481706 waitpid(-1, 0xffc832ec, 0) = ? ERESTARTSYS (To be restarted)
85    23:48:44.567757 --- SIGINT (Interrupt) @ 0 (0) ---
86        kill -SIGINT <bash_PID> is ignored, back to waiting:
87    23:48:44.571706 waitpid(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0) = 13549
88        sleep exited with 0
89    23:48:49.468553 --- SIGCHLD (Child exited) @ 0 (0) ---
90    23:48:49.469445 clone(...) = 13551
91    23:48:49.481708 waitpid(-1, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGINT}], 0) = 13551
92        sleep was killed by "killall -SIGINT sleep"
93    23:48:50.515837 --- SIGCHLD (Child exited) @ 0 (0) ---
94    23:48:50.516718 clone(...) = 13555
95    23:48:50.530706 waitpid(-1, 0xffc832ec, 0) = ? ERESTARTSYS (To be restarted)
96    23:48:50.615761 --- SIGINT (Interrupt) @ 0 (0) ---
97        kill -SIGINT <bash_PID> is ignored, back to waiting:
98    23:48:50.619705 waitpid(-1, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGINT}], 0) = 13555
99        sleep was killed by "killall -SIGINT sleep".
100        This is the second one in a row. Kill ourself:
101    23:48:51.504604 kill(13515, SIGINT)     = 0
102    23:48:51.504689 --- SIGINT (Interrupt) @ 0 (0) ---
103    23:48:51.504915 +++ killed by SIGINT +++
104    
105    As long as there is at least one "sleep 5" which exited successfully
106    (not killed by SIGINT), bash continues. This is not documented anywhere
107    AFAIKS.
108    
109    Why keyboard ^C acts differently?
110    
111    00:08:07.655985 clone(...) = 14270
112    00:08:07.669707 waitpid(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0) = 14270
113    00:08:12.656872 --- SIGCHLD (Child exited) @ 0 (0) ---
114    00:08:12.657743 clone(...) = 14273
115    00:08:12.671708 waitpid(-1, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGINT}], 0) = 14273
116    00:08:13.810778 --- SIGINT (Interrupt) @ 0 (0) ---
117    00:08:13.818705 kill(14269, SIGINT)     = 0
118    00:08:13.820103 --- SIGINT (Interrupt) @ 0 (0) ---
119    00:08:13.820925 +++ killed by SIGINT +++
120    
121    Perhaps because at the moment bash got SIGINT it had no children?
122    (it did not manage to spawn new sleep yet, see the trace)

Legend:
Removed from v.983  
changed lines
  Added in v.984