autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/2] docs: korn shells can have $? > 256 for signal-terminate


From: Eric Blake
Subject: Re: [PATCH 1/2] docs: korn shells can have $? > 256 for signal-terminated children
Date: Tue, 04 Oct 2011 12:31:13 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.22) Gecko/20110906 Fedora/3.1.14-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.4 Thunderbird/3.1.14

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<address@hidden>
-
-       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<address@hidden>
+
+       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.

address@hidden
+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.

address@hidden
+If @command{wrapped_command} is interrupted by a @code{SIGHUP} (which
+has signal number 1), @code{ret} will be set to 257.  Unless the
address@hidden 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

address@hidden (2011) and @code{bash} 4.1.5 on Debian:
+
address@hidden
+$ @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   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]