On 09/29/2011 02:51 AM, Stefano Lattarini wrote:
Some Korn shells, when a child process die due to signal number
n, can leave in $? an exit status of 256+n, instead of the "more
standard" 128+n.  See also Austin Group issue 0000051:
   <http://www.austingroupbugs.net/view.php?id=51>

* doc/autoconf.texi (Signal handling): Document the described Korn
Shell behaviour, and some of its possible shortcomings.

Assuming you already picked up Peter's good tweaks, I'll only add a couple more:

+++ b/ChangeLog
@@ -1,9 +1,13 @@
-2011-09-26  Eric Blake<ebl...@redhat.com>
-
-       docs: relax documentation license by dropping cover text
-       * doc/autoconf.texi (copying): Drop front- and back-cover texts.
-       * NEWS: Document this.
-       Reported by Brian Gough.
+2011-09-29  Stefano Lattarini<stefano.lattar...@gmail.com>
+
+       docs: korn shells can have $?>  256 for signal-terminated children
+       Some Korn shells, when a child process die due to signal number
+       n, can leave in $? an exit status of 256+n, instead of the "more
+       standard" 128+n.  See also Austin Group issue 0000051:
+       <http://www.austingroupbugs.net/view.php?id=51>
+       * doc/autoconf.texi (Signal handling): Document the described Korn
+       Shell behaviour, and some of its possible shortcomings.
+       Suggestion by Eric Blake.

Fix this. Don't know what happened here, but you don't want to nuke the old entry when you rebase to add your entry on top.

+@noindent
+This @command{ksh} behaviour is allowed by POSIX, if implemented with

s/behaviour/behavior/ - the manual favors US spellings.

+due care; see this @uref{http://www.austingroupbugs.net/view.php?id=51,
+Austin Group discussion} for more background.  However, if it is not
+implemented with proper care, such a behaviour might can cause problems

again.

+@noindent
+If @command{wrapped_command} is interrupted by a @code{SIGHUP} (which
+has signal number 1), @code{ret} will be set to 257.  Unless the
+@command{exit} shell builtin is smart enough to understand that such
+a value can only have been originated from a signal, and adjust the

s/only have been originated/only have originated/

+final wait status of the shell appropriately, the value 257 will just
+get truncated to 1 by the closing @code{exit} call, so that a caller
+of the script will have no way to determine that termination by a
+signal was involved.  Observe the different behaviour of AT&T

behavior, again

+@code{ksh93} (2011) and @code{bash} 4.1.5 on Debian:
+
+@example
+$ @kbd{cat>  foo.sh}

I'd write this as @kbd{cat >foo.sh <<\EOF}

+#!/bin/sh
+sh -c 'kill -1 $$'
+ret=$?
+echo $ret
+exit $ret

and use EOF here, since that's easier than representing the ^D that otherwise is needed to end the cat.

ACK with those additional fixes.  And sorry for my delayed review.

--
Eric Blake   ebl...@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Reply via email to