dash
Colin Watson
cjwatson at ubuntu.com
Tue Oct 10 14:08:23 BST 2006
On Fri, Sep 15, 2006 at 01:01:29PM -0700, Micah J. Cowan wrote:
> On Fri, Sep 15, 2006 at 02:06:56PM -0500, Rocco Stanzione wrote:
> > "Internally, for purposes of deciding whether a command exits with a non-zero
> > exit status, the shell shall recognize the entire status value retrieved for
> > the command by the equivalent of the wait() function WEXITSTATUS macro (as
> > defined in the System Interfaces volume of IEEE Std 1003.1-2001). When
> > reporting the exit status with the special parameter '?', the shell shall
> > report the full eight bits of exit status available."
>
> Others have already pointed out the irrelevance of these quotes to the
> actual bug under discussion. I'd also like to point out that your
> reading of them is incorrect from an exit status point of view as well.
>
> Even in bash, executing ( exit -1 ) will result in a value of 255 in $?,
> as, just with return, the exit status for all processes is stored in an
> unsigned 8-bit field within an int.
And furthermore, you can't use the WEXITSTATUS macro if wait() returns
-1 anyway.
WIFEXITED(stat_val)
Evaluates to a non-zero value if status was returned for a child
process that terminated normally.
WEXITSTATUS(stat_val)
If the value of WIFEXITED(stat_val) is non-zero, this macro
evaluates to the low-order 8 bits of the status argument that
the child process passed to _exit() or exit(), or the value the
child process returned from main().
Cheers,
--
Colin Watson [cjwatson at ubuntu.com]
More information about the ubuntu-devel
mailing list