Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] Fix ERR_EXIT behavior in function calls and "always" statements
- X-seq: zsh-workers 51030
- From: Lawrence Velázquez <larryv@xxxxxxx>
- To: "Philippe Altherr" <philippe.altherr@xxxxxxxxx>
- Cc: zsh-workers@xxxxxxx
- Subject: Re: [PATCH] Fix ERR_EXIT behavior in function calls and "always" statements
- Date: Wed, 23 Nov 2022 01:59:14 -0500
- Archived-at: <https://zsh.org/workers/51030>
- Feedback-id: iaa214773:Fastmail
- In-reply-to: <CAGdYchvM8uwvQ9B-S4n_-oMQkNqgZZrqG9jwYCV7Nz+5Lo6Q=w@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CAGdYchvfLWmxrCZ3-8ThXdyeuMAUWbV=SqFrXCjSJ8AnWpek9A@mail.gmail.com> <CAGdYchufLwUgpKVU6b5eOiF15p0njFr59H1q9XizypwNjzqKzw@mail.gmail.com> <CAH+w=7ZLr8R_pQfpcAdHiNyYH0K_A8ha815nz1zPBakYmCJ6Dg@mail.gmail.com> <230a78bb-fa97-4f3a-94a2-86982316274b@app.fastmail.com> <CAGdYchvM8uwvQ9B-S4n_-oMQkNqgZZrqG9jwYCV7Nz+5Lo6Q=w@mail.gmail.com>
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