OK to apply? Here's a test for this, plus output on AIX 5.3:
cat >trap.sh <<\EOF
#! /bin/sh
func_trap ()
{
trap 'echo trap that was installed in func_trap' 0
echo in func_trap
}
echo main
func_trap
echo main after func_trap
EOF
sh trap.sh
| main
| in func_trap
| trap that was installed in func_trap
| main after func_trap
Cheers,
Ralf
2006-10-27 Ralf Wildenhues <[EMAIL PROTECTED]>
* doc/autoconf.texi (Limitations of Builtins): Do not invoke
`trap ... 0' inside a function, for AIX sh.
Index: doc/autoconf.texi
===================================================================
RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.1101
diff -u -r1.1101 autoconf.texi
--- doc/autoconf.texi 25 Oct 2006 20:21:05 -0000 1.1101
+++ doc/autoconf.texi 27 Oct 2006 15:52:20 -0000
@@ -12801,7 +12801,9 @@
@prindex @command{trap}
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).
+explicit @command{exit}, or the end of the script). The trap for 0 should be
+installed outside of a shell function, or @acronym{AIX} 5.3 @command{/bin/sh}
+will invoke the trap at the end of this function.
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.,