bug-bash
[Top][All Lists]
Advanced

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

Re: [patch #7637] bash 4.1 return builtin violates posix in checking for


From: Chet Ramey
Subject: Re: [patch #7637] bash 4.1 return builtin violates posix in checking for options
Date: Sat, 22 Oct 2011 18:50:54 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1

On 10/21/11 3:50 PM, Linda A. Walsh wrote:
> URL:
>   <http://savannah.gnu.org/patch/?7637>
> 
>                  Summary: bash 4.1 return builtin violates posix in checking
> for options
>                  Project: The GNU Bourne-Again SHell
>             Submitted by: law
>             Submitted on: Fri 21 Oct 2011 12:50:32 PM PDT
>                 Category: None
>                 Priority: 6
>                   Status: None
>                  Privacy: Public
>              Assigned to: None
>         Originator Email: 
>              Open/Closed: Open
>          Discussion Lock: Any
> 
>     _______________________________________________________
> 
> Details:
> 
> in bash 4.1, the return cmd now checks to see if it has
> options and parses them as 'illegal' (not very helpful and 
> certainly not a usability feature).  Posix says the return command takes no
> options.

This changed between bash-4.0-alpha and bash-4.0-beta.  You missed the
ensuing discussion by around three years.

The rationale at the time was that Posix specifies the argument to return
to be an `unsigned decimal integer', so negative numbers should not be
allowed.  The Bourne shell has never accepted them, for instance, and
other shells claiming Posix conformance (e.g., dash, mksh, FreeBSD 8 sh)
don't either.

The issue came up again recently, and the resultant discussion convinced
me that it would be a reasonable, if non-portable, extension to Posix.
No application should be passing anything but {0..255} in any case.
Accepting it as an argument doesn't mean the value isn't going to be
masked with 0xff, though.

The next version of bash will allow negative numbers as arguments to
return, which has the added benefit of rationalizing the values passed
to `return' and `exit'.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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