From: Paul Eggert Date: Wed, 25 Jan 2006 22:14:16 +0000 (+0000) Subject: * doc/autoconf.texi (Limitations of Builtins): Document the X-Git-Tag: AUTOCONF-2.59c~191 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=39569a7d4e4e5fb6302655c8f032ae335d8b26bd;p=thirdparty%2Fautoconf.git * doc/autoconf.texi (Limitations of Builtins): Document the problem with "trap -". --- diff --git a/ChangeLog b/ChangeLog index 6b24f22a6..77ceb5939 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-01-25 Paul Eggert + + * doc/autoconf.texi (Limitations of Builtins): Document the + problem with "trap -". + 2006-01-23 Steven G. Johnson * lib/autoconf/fortran.m4 (_AC_FC_LIBRARY_LDFLAGS, _AC_FC_DUMMY_MAIN): diff --git a/doc/autoconf.texi b/doc/autoconf.texi index a0ebceba5..8396b06da 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -11531,6 +11531,13 @@ It is safe to trap at least the signals 1, 2, 13, and 15. You can also trap 0, i.e., have the @command{trap} run when the script ends (either via an explicit @command{exit}, or the end of the script). +Posix says that @samp{trap - 1 2 13 15} resets the traps for the +specified signals to their default values, but many common shells (e.g., +Solaris @command{/bin/sh}) misinterpret this and attempt to execute a +``command'' named @command{-} when the specified conditions arise. +There is no portable workaround, except for @samp{trap - 0}, for which +@samp{trap '' 0} is a portable substitute. + Although Posix is not absolutely clear on this point, it is widely admitted that when entering the trap @samp{$?} should be set to the exit status of the last command run before the trap. The ambiguity can be