Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] Fix ERR_EXIT behavior in function calls and "always" statements



On Mon, Nov 21, 2022, at 9:52 PM, Philippe Altherr wrote:
> To help decide what to do, here is a table that lists all the different 
> cases and how they behave in the current Zsh, in a patched Zsh, and in 
> a patched Zsh where anonymous functions behave as compound commands:
>
>    Code                             Current Zsh     Patched Zsh     
> Compound command (and patches)
> A)         false                    Exit            Exit            Exit
> B)         false && true            No exit         No exit         No 
> exit
> C)     {   false && true   }        No exit         No exit         No 
> exit
> D)  () {   false           }        Exit            Exit            Exit
> E)  () {   false && true   }        Exit            Exit            *No 
> exit*    
> F)  () { { false && true } }        No Exit         *Exit*            
> No exit
> G) f() {   false           }; f     Exit            Exit            Exit
> H) f() {   false && true   }; f     Exit            Exit            
> Exit    
> I) f() { { false && true } }; f     No Exit         *Exit*            
> *Exit*
>
> Currently anonymous functions behave like function calls. My patches 
> don't change that but they change/fix cases F and I to behave as 
> mandated by POSIX.

POSIX does not mandate any behavior for case F unless one treats
anonymous functions as compound commands, in which case the new
behavior actually violates the standard.

-- 
vq




Messages sorted by: Reverse Date, Date, Thread, Author