7 Bug-Reported-by: Egmont Koblinger <egmont@uhulinux.hu>
8 Bug-Reference-ID: <Pine.LNX.4.58L0.0407290044500.12603@sziami.cs.bme.hu>
9 Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2004-07/msg00279.html
13 Bash no longer accepts the `trap signum' syntax when in POSIX mode. This
14 patch restores a measure of backwards compatibility.
18 *** ../bash-3.0/builtins/trap.def Thu May 27 22:26:19 2004
19 --- builtins/trap.def Thu Aug 5 08:55:43 2004
23 $FUNCTION trap_builtin
24 ! $SHORT_DOC trap [-lp] [[arg] signal_spec ...]
25 The command ARG is to be read and executed when the shell receives
26 signal(s) SIGNAL_SPEC. If ARG is absent (and a single SIGNAL_SPEC
29 $FUNCTION trap_builtin
30 ! $SHORT_DOC trap [-lp] [arg signal_spec ...]
31 The command ARG is to be read and executed when the shell receives
32 signal(s) SIGNAL_SPEC. If ARG is absent (and a single SIGNAL_SPEC
37 ! int list_signal_names, display, result, opt;
39 list_signal_names = display = 0;
43 ! int list_signal_names, display, result, opt, first_signal;
45 list_signal_names = display = 0;
53 first_arg = list->word->word;
54 /* When in posix mode, the historical behavior of looking for a
55 missing first argument is disabled. To revert to the original
56 signal handling disposition, use `-' as the first argument. */
57 ! if (posixly_correct == 0 && first_arg && *first_arg &&
58 (*first_arg != '-' || first_arg[1]) &&
59 signal_object_p (first_arg, opt) && list->next == 0)
63 ! int operation, sig, first_signal;
66 first_arg = list->word->word;
67 + first_signal = first_arg && *first_arg && all_digits (first_arg) && signal_object_p (first_arg, opt);
69 + /* Backwards compatibility */
72 /* When in posix mode, the historical behavior of looking for a
73 missing first argument is disabled. To revert to the original
74 signal handling disposition, use `-' as the first argument. */
75 ! else if (posixly_correct == 0 && first_arg && *first_arg &&
76 (*first_arg != '-' || first_arg[1]) &&
77 signal_object_p (first_arg, opt) && list->next == 0)
78 *** ../bash-3.0/doc/bashref.texi Sat Jun 26 14:26:07 2004
79 --- doc/bashref.texi Fri Aug 27 12:33:46 2004
82 The @code{trap} builtin doesn't check the first argument for a possible
83 signal specification and revert the signal handling to the original
84 ! disposition if it is. If users want to reset the handler for a given
85 signal to the original disposition, they should use @samp{-} as the
88 The @code{trap} builtin doesn't check the first argument for a possible
89 signal specification and revert the signal handling to the original
90 ! disposition if it is, unless that argument consists solely of digits and
91 ! is a valid signal number. If users want to reset the handler for a given
92 signal to the original disposition, they should use @samp{-} as the
95 *** ../bash-3.0/patchlevel.h Wed Aug 22 08:05:39 2001
96 --- patchlevel.h Thu Sep 2 15:04:32 2004
99 looks for to find the patch level (for the sccs version string). */
101 ! #define PATCHLEVEL 2
103 #endif /* _PATCHLEVEL_H_ */
105 looks for to find the patch level (for the sccs version string). */
107 ! #define PATCHLEVEL 3
109 #endif /* _PATCHLEVEL_H_ */
110 *** ../bash-3.0/tests/errors.right Thu May 27 22:26:03 2004
111 --- tests/errors.right Sat Aug 7 22:35:10 2004
114 ./errors.tests: line 216: trap: NOSIG: invalid signal specification
115 ./errors.tests: line 219: trap: -s: invalid option
116 ! trap: usage: trap [-lp] [[arg] signal_spec ...]
117 ./errors.tests: line 225: return: can only `return' from a function or sourced script
118 ./errors.tests: line 229: break: 0: loop count out of range
120 ./errors.tests: line 216: trap: NOSIG: invalid signal specification
121 ./errors.tests: line 219: trap: -s: invalid option
122 ! trap: usage: trap [-lp] [arg signal_spec ...]
123 ./errors.tests: line 225: return: can only `return' from a function or sourced script
124 ./errors.tests: line 229: break: 0: loop count out of range