zsh-workers
 help / color / mirror / code / Atom feed
From: Philippe Altherr <philippe.altherr@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [PATCH] Even more ERR_EXIT (was Re: More ERR_EXIT Re: Tests RE behavior of ERR_EXIT)
Date: Tue, 15 Nov 2022 20:50:25 +0100	[thread overview]
Message-ID: <CAGdYchsByxRy+VksacUEnNAM-jjaFJbaUuBT9-XpAKMo31X0DQ@mail.gmail.com> (raw)
In-Reply-To: <CAGdYchs4vtWJL0SC8GhkEDrNf42eXDya6rVpkpuoSd8oKagazw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2321 bytes --]

As commented in the other thread, code like the following should NOT
trigger an ERR_EXIT (because of exception 3 in the POSIX specification of
"set -e"
<https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#set>
).

setopt err_exit
> if true; then
>   false && true
> fi
> print OK


The non-zero status of the "if" statement only triggers an ERR_EXIT if it
becomes the result of a function call. Then the return of the function
triggers the ERR_EXIT, like in the following code:

setopt err_exit
> fn() {
>   if true; then
>     false && true
>   fi
> }
> fn
> print OK


The test exit status changes in 50928: fix tests for 50897, mention
behavior change in NEWS
<https://sourceforge.net/p/zsh/code/ci/1ba8714a7ac665e661c1b3a716ffe2af73d1e443/>
are
incorrect and several tests in the new patch are incorrect.

Philippe


On Tue, Nov 15, 2022 at 8:30 AM Philippe Altherr <philippe.altherr@gmail.com>
wrote:

> Oops, I see this only now, just after sending my other reply. I will have
> a look later. I first need some sleep.
>
> Philippe
>
>
> On Tue, Nov 15, 2022 at 8:01 AM Bart Schaefer <schaefer@brasslantern.com>
> wrote:
>
>> On Mon, Nov 14, 2022 at 5:11 PM Bart Schaefer <schaefer@brasslantern.com>
>> wrote:
>> >
>> > [if workers/50929 makes 50897 redundant then] there's no point in
>> > bashing through if/case/for/while/repeat/select individually -- the
>> > only case we have to fix is this one:
>>
>> I was half right.  Fixing that case revealed that it was necessary to
>> go through the others, because the "redundant" fix is one level too
>> far up the stack.
>>
>> Attached patch removes 50929 again, and amends this_noerrexit from
>> 50897 in each of the complex command exec* functions.  Finally it adds
>> tests to E01options for each of the cases that Philippe previously
>> outlined, with the exception of "select" which is interactive.
>>
>> The tests from 50928 still pass with this patch.  I spent a ridiculous
>> amount of time with every change I made flopping back and forth
>> between C03 working and the new E01 failing and vice-versa, before
>> noticing what happened when I nested a brace expression inside another
>> one.
>>
>> Also a minor fix for TRAPDEBUG that caused me some confusion earlier
>> in the process.
>>
>> Are there more cases that need testing?
>>
>

[-- Attachment #2: Type: text/html, Size: 3555 bytes --]

  reply	other threads:[~2022-11-15 19:50 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-12 22:16 [PATCH] More ERR_EXIT (was " Philippe Altherr
2022-11-13  3:59 ` Philippe Altherr
2022-11-13  4:11   ` Bart Schaefer
2022-11-13 13:55     ` Philippe Altherr
2022-11-13 14:24       ` Philippe Altherr
2022-11-13 15:45         ` Philippe Altherr
2022-11-13 16:52           ` Bart Schaefer
2022-11-13 16:45       ` Bart Schaefer
2022-11-13 16:53         ` Bart Schaefer
2022-11-13 18:37           ` Philippe Altherr
2022-11-13 20:55             ` Philippe Altherr
2022-11-13 22:27               ` Bart Schaefer
2022-11-13 23:10               ` Lawrence Velázquez
2022-11-13 22:12             ` Bart Schaefer
2022-11-15  1:11         ` Bart Schaefer
2022-11-15  7:01           ` [PATCH] Even more ERR_EXIT (was Re: More ERR_EXIT " Bart Schaefer
2022-11-15  7:30             ` Philippe Altherr
2022-11-15 19:50               ` Philippe Altherr [this message]
2022-11-15  7:26           ` [PATCH] More ERR_EXIT (was " Philippe Altherr
2022-11-15 19:18             ` Philippe Altherr
2022-11-15 21:08               ` Bart Schaefer
2022-11-16  2:41               ` Lawrence Velázquez
2022-11-16  6:31                 ` Philippe Altherr
2022-11-16  5:51               ` Bart Schaefer
2022-11-16  7:56                 ` Philippe Altherr
2022-11-16 14:21                   ` Philippe Altherr

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGdYchsByxRy+VksacUEnNAM-jjaFJbaUuBT9-XpAKMo31X0DQ@mail.gmail.com \
    --to=philippe.altherr@gmail.com \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).