diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-09-25 14:21:06 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-09-25 14:21:06 +0200 |
commit | 67f7186403dec3f61f6ea9e9a3f555bd0b0541bc (patch) | |
tree | 2cc885ab0edebf17070b88aaaf56899814ed4744 /shell/hush_test | |
parent | 4ea0ca81934ad62887632fa53d093b0048ea7e03 (diff) | |
download | busybox-w32-67f7186403dec3f61f6ea9e9a3f555bd0b0541bc.tar.gz busybox-w32-67f7186403dec3f61f6ea9e9a3f555bd0b0541bc.tar.bz2 busybox-w32-67f7186403dec3f61f6ea9e9a3f555bd0b0541bc.zip |
hush: do not reset to default "" traps in subshell
function old new delta
reset_traps_to_defaults 164 211 +47
builtin_umask 123 121 -2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/hush_test')
-rw-r--r-- | shell/hush_test/hush-trap/subshell.right | 6 | ||||
-rwxr-xr-x | shell/hush_test/hush-trap/subshell.tests | 20 |
2 files changed, 26 insertions, 0 deletions
diff --git a/shell/hush_test/hush-trap/subshell.right b/shell/hush_test/hush-trap/subshell.right new file mode 100644 index 000000000..0d20ed4e9 --- /dev/null +++ b/shell/hush_test/hush-trap/subshell.right | |||
@@ -0,0 +1,6 @@ | |||
1 | Ok | ||
2 | Ok | ||
3 | Ok | ||
4 | Ok | ||
5 | TERM | ||
6 | Done | ||
diff --git a/shell/hush_test/hush-trap/subshell.tests b/shell/hush_test/hush-trap/subshell.tests new file mode 100755 index 000000000..b5d6094d6 --- /dev/null +++ b/shell/hush_test/hush-trap/subshell.tests | |||
@@ -0,0 +1,20 @@ | |||
1 | # Non-empty traps should be reset in subshell | ||
2 | |||
3 | # HUP is special in interactive shells | ||
4 | trap '' HUP | ||
5 | # QUIT is always special | ||
6 | trap '' QUIT | ||
7 | # SYS is not special | ||
8 | trap '' SYS | ||
9 | # WINCH is harmless | ||
10 | trap 'bad: caught WINCH' WINCH | ||
11 | # With TERM we'll check whether it is reset | ||
12 | trap 'bad: caught TERM' TERM | ||
13 | |||
14 | # using bash, becuase we don't have $PPID (yet) | ||
15 | (bash -c 'kill -HUP $PPID'; echo Ok) | ||
16 | (bash -c 'kill -QUIT $PPID'; echo Ok) | ||
17 | (bash -c 'kill -SYS $PPID'; echo Ok) | ||
18 | (bash -c 'kill -WINCH $PPID'; echo Ok) | ||
19 | (bash -c 'kill -TERM $PPID'; echo Bad: TERM is not reset) | ||
20 | echo Done | ||