dash

Dennis Kaarsemaker dennis at kaarsemaker.net
Fri Sep 15 20:26:20 BST 2006


On vr, 2006-09-15 at 14:06 -0500, Rocco Stanzione wrote:

> [...] returning -1 is good POSIX behavior which dash cannot handle.
> 
> To quote,
> 
> "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."
> 
> and in the documentation for wait(),
> "If wait() or waitpid() returns due to the delivery of a signal to the calling 
> process, -1 shall be returned and errno set to [EINTR]."

First of all: that part of the standard has NOTHING to do with what
values you can return with the 'return' builtin. Please look at
http://www.opengroup.org/onlinepubs/000095399/utilities/return.html

"""
EXIT STATUS
        The value of the special parameter '?' shall be set to n, an
        unsigned decimal integer, or to the exit status of the last
        command executed if n is not specified. If the value of n is
        greater than 255, the results are undefined. When return is
        executed in a trap action, the last command is considered to be
        the command that executed immediately preceding the trap action.
"""

An *unsigned* decimal integer, so negative values are completely bogus.	
-- 
Dennis K.

Time is an illusion, lunchtime doubly so.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/ubuntu-devel/attachments/20060915/eac7fe42/attachment-0001.pgp 


More information about the ubuntu-devel mailing list