Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F135031976
D2325.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D2325.id.diff
View Options
Index: head/bin/sh/sh.1
===================================================================
--- head/bin/sh/sh.1
+++ head/bin/sh/sh.1
@@ -32,7 +32,7 @@
.\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95
.\" $FreeBSD$
.\"
-.Dd February 22, 2015
+.Dd April 18, 2015
.Dt SH 1
.Os
.Sh NAME
@@ -2574,8 +2574,7 @@
and the latter causes the default action to be taken.
Omitting the
.Ar action
-is another way to request the default action, for compatibility reasons this
-usage is not recommended though.
+and using only signal numbers is another way to request the default action.
In a subshell or utility environment,
the shell resets trapped (but not ignored) signals to the default action.
The
Index: head/bin/sh/tests/builtins/Makefile
===================================================================
--- head/bin/sh/tests/builtins/Makefile
+++ head/bin/sh/tests/builtins/Makefile
@@ -137,6 +137,8 @@
FILES+= trap12.0
FILES+= trap13.0
FILES+= trap14.0
+FILES+= trap15.0
+FILES+= trap16.0
FILES+= trap2.0
FILES+= trap3.0
FILES+= trap4.0
Index: head/bin/sh/tests/builtins/trap15.0
===================================================================
--- head/bin/sh/tests/builtins/trap15.0
+++ head/bin/sh/tests/builtins/trap15.0
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+(${SH} -c 'term(){ exit 5;}; trap term TERM; kill -TERM $$') &
+wait >/dev/null 2>&1 $!
+[ $? -eq 5 ]
Index: head/bin/sh/tests/builtins/trap16.0
===================================================================
--- head/bin/sh/tests/builtins/trap16.0
+++ head/bin/sh/tests/builtins/trap16.0
@@ -0,0 +1,20 @@
+# $FreeBSD$
+
+traps=$(${SH} -c 'trap "echo bad" 0; trap - 0; trap')
+[ -z "$traps" ] || exit 1
+traps=$(${SH} -c 'trap "echo bad" 0; trap "" 0; trap')
+expected_traps=$(${SH} -c 'trap "" EXIT; trap')
+[ "$traps" = "$expected_traps" ] || exit 2
+traps=$(${SH} -c 'trap "echo bad" 0; trap 0; trap')
+[ -z "$traps" ] || exit 3
+traps=$(${SH} -c 'trap "echo bad" 0; trap -- 0; trap')
+[ -z "$traps" ] || exit 4
+traps=$(${SH} -c 'trap "echo bad" 0 1 2; trap - 0 1 2; trap')
+[ -z "$traps" ] || exit 5
+traps=$(${SH} -c 'trap "echo bad" 0 1 2; trap "" 0 1 2; trap')
+expected_traps=$(${SH} -c 'trap "" EXIT HUP INT; trap')
+[ "$traps" = "$expected_traps" ] || exit 6
+traps=$(${SH} -c 'trap "echo bad" 0 1 2; trap 0 1 2; trap')
+[ -z "$traps" ] || exit 7
+traps=$(${SH} -c 'trap "echo bad" 0 1 2; trap -- 0 1 2; trap')
+[ -z "$traps" ] || exit 8
Index: head/bin/sh/trap.c
===================================================================
--- head/bin/sh/trap.c
+++ head/bin/sh/trap.c
@@ -183,7 +183,7 @@
return 0;
}
action = NULL;
- if (*argv && sigstring_to_signum(*argv) == -1) {
+ if (*argv && !is_number(*argv)) {
if (strcmp(*argv, "-") == 0)
argv++;
else {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Nov 6, 11:32 PM (2 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
24958613
Default Alt Text
D2325.id.diff (2 KB)
Attached To
Mode
D2325: Fix the trap builtin to be POSIX-compliant for 'trap exit SIG' and 'trap n n n n'.
Attached
Detach File
Event Timeline
Log In to Comment