Re: [v2 PATCH] eval: Only restore exit status on exit/return

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

 



On Fri, Dec 14, 2018 at 08:02:04AM +0000, Harald van Dijk wrote:
> On 14/12/2018 03:10, Herbert Xu wrote:
>
> > The reason this is needed is to support a naked return.  With
> > your patch a naked return would either have to always return the
> > saved status or the new status.  Neither of which is what we
> > want.
> 
> I actually saw the commit you referenced already and tested that with my
> patch before sending. This is how I tested it:
> 
> Returns 1:
> 
>   f() {
>     false; return
>   }
>   f

That's not a naked return.  A naked return is one used outside of
a function.  I know this is unspecified under POSIX, but for dash
this has a specific meaning and that is the return is equivalent
to exit.

Cheers,
-- 
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux