From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 31922 invoked from network); 15 Nov 2022 19:50:57 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 15 Nov 2022 19:50:57 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1668541857; b=c5Nw1mF2zGNEul9pYrmHIXyQt5/PLd3J8G9pTrMmabYhC1P2e4yDe255W/dvNSBhiXNWbJdxi4 sCRiRZbHBfvuDc0THR2JUtGBsabsrWVeJ89/NfwRTAQKjjzxnCG39TBxGbmSA8+ifXvth9Wvbq pFzwthzXVnv8Bzw2hHPP5ZtuPkRho2D8Ceu/kdKOw/nmr40uQVu3hOOZQfJEjt3dTGZIJbcDHe CZrWpOzEZdnlLYQypSsCJHE2/XbqVEqW4UBi/rYBNcWgqBzkjqyd5IbDPoAPZi9wc5TaMu2AT7 AzEPCIBC1Xzu3Z0vH0OL6gtGA3O8/hXRWXqqlnuQUMhtYw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-vs1-f47.google.com) smtp.remote-ip=209.85.217.47; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1668541857; bh=46w2sLyWUfdXDJXlI/G6Jdq3Rsf9WlEnmS+jhrzJ0G8=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=MkFif75jq98tx9qBLD6lq84cs/TN6JmWh84rSryJ77m8Dxv5N1wr3TXWHxDtALkEnLPlPpByV7 QWLfRB2HIZcaVLVHGQCNZcf3bwQR/dpZvMVBFwc/R4Z0ibav17LQRIs1HJMZkB/TCmVfPOKQgr QMqgdFaBHMuyGFg4qdw619amizbtTwoYPA4DAgj8ytcuPfwgeSNLojD7yqR15H/u+6SoFg82Qh MLIa5AXwBoYY/SeotsLzwpnzhxdEpk9qGwVlokbonttb9bqpXA3XOIlP8Wy2bDrbqd+Joic5Bu bxEXry3KKoZ6vat/ReRGDnV/WZpzFHQ/j5/2WyT/I8uaRA==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=raILgyEOg/LtWLs3MYp1VYhU3v8CCIXkKoCaqGiWmuo=; b=NLgs4hqqItutoJiENdGM6BEjz3 UPv1r/fZMxMiUHenyEiE4vin/yLLm+/SaTD210g8ec+Lp5xlkeipjbNT3jnIPUcDOZGjDkMnsjP8d xfWCG3eugf7/AQVWmvsWYEb07scvvWhXCGd7zbe/MnC7uy+h7MQs5StYiTDnVDTk94bMKbPE9z42C 6ZP3A3j3Az0wRzmdRah/BRx40VY7xU2Mav5PPqG+fLMt/BizEBkGA6YUrGotnAFGJ1xy3iSXFjQVW kMXVyeFkbL/KgTEnrwOBtMwDhuXgsXuixOWsSTK3+SkV45wFtwDgRppqQ/xtlVBp8qa5oEH8aU7JG FOUfnrFg==; Received: by zero.zsh.org with local id 1ov1xQ-0001pJ-Jp; Tue, 15 Nov 2022 19:50:56 +0000 Authentication-Results: zsh.org; iprev=pass (mail-vs1-f47.google.com) smtp.remote-ip=209.85.217.47; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-vs1-f47.google.com ([209.85.217.47]:39920) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1ov1x7-0001UK-Ud; Tue, 15 Nov 2022 19:50:39 +0000 Received: by mail-vs1-f47.google.com with SMTP id m4so8959290vsc.6 for ; Tue, 15 Nov 2022 11:50:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=raILgyEOg/LtWLs3MYp1VYhU3v8CCIXkKoCaqGiWmuo=; b=OmQo4WdQuiXMwArOPa9rT6qLnONANOytutsdnJ4f2mAFRwqMqolP8/+6gv10zaKIme W7eVfIu3ad1wCttOMYZgAXylhCqAr6IHStpwJ9+Q4r+RKA50nQU+tpbGrMgkUvE5K29e CVJ12ls1J7msPfcXl8qYsD+18JQgfKTFhMH7Z5tx4ENnKl8yWfopqJWVwAFfubZs2++g gybRGrMN+PrSRHUVGqhhYfrnlfjfJjrsMUGLeUrdVEaAaP9PZePlax5iNL2/Q43zkFR+ vATnGg7DZnhXjNXW7uKgb6z0Ic0ljp9+G0jIpWBiUP2Rrnz1t3NQlkHmAJNYDn4pI0JF 5kuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=raILgyEOg/LtWLs3MYp1VYhU3v8CCIXkKoCaqGiWmuo=; b=ZDCFjLya6M2TjhsjqyjX3LhOrzAC7AdGZ20oC3oj9NOYb7mMVXsk/xyWFqTJuRvM/k hGsqc6bl3T9rDB9oXk3ANgd+DDpIUkIrxmd7VdnnQnaSYCARM2So3eelbWbZxtMO5OcL SIvHUBqs+v7T+9+sEoa5OID/802G3M2rHNZ4ABloGTsHaW3A8C7ZH6Oxr+8LPPPjoECw s/1p6oAG2N4pAZzwNzCouxYsve+fskHHkBpMlp6OH5Z0FXAIyuQ1VUFbm9bXMuf8VUVj hX1iV8JY8tdUnpS/VmXr6CGLSnclzmLj2DTEcw5IKVG1JJA60ilCKjCS/1v73mnYjTPe aD/A== X-Gm-Message-State: ANoB5plN27ejzexn9+4rdM15m0EEapEjr4DEzIos9kxtHu39ymNXVRPM u6wT8/yfIslO/fdm4Z6syUmy6/h16IgykYqmC5Y3jgnWjOE= X-Google-Smtp-Source: AA0mqf5oX7C5KLpk1qtNTmdLeazN52sfL6ebNOhdM8mGkcI/4DLSSjxYnObNJqMCj7M91GuuycZ3+dk90VDQu77UqmU= X-Received: by 2002:a67:dd85:0:b0:3ac:bd5b:31e5 with SMTP id i5-20020a67dd85000000b003acbd5b31e5mr9139878vsk.56.1668541836609; Tue, 15 Nov 2022 11:50:36 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Philippe Altherr Date: Tue, 15 Nov 2022 20:50:25 +0100 Message-ID: Subject: Re: [PATCH] Even more ERR_EXIT (was Re: More ERR_EXIT Re: Tests RE behavior of ERR_EXIT) To: Bart Schaefer Cc: Zsh hackers list Content-Type: multipart/alternative; boundary="00000000000076ccbc05ed87ab62" X-Seq: 50973 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: --00000000000076ccbc05ed87ab62 Content-Type: text/plain; charset="UTF-8" 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" ). 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 are incorrect and several tests in the new patch are incorrect. Philippe On Tue, Nov 15, 2022 at 8:30 AM Philippe Altherr 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 > wrote: > >> On Mon, Nov 14, 2022 at 5:11 PM Bart Schaefer >> 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? >> > --00000000000076ccbc05ed87ab62 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
As commented in the other thread, code like the following = should NOT trigger=C2=A0an ERR_EXIT (because of exception 3 = in the POSIX specification of "set -e").

setopt err_exit
if true; the= n
=C2=A0 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() {
=C2=A0 if true; then
=C2=A0 =C2=A0 false && t= rue
=C2=A0 fi
}
fn
print OK

The= test exit status changes in=C2=A050928: fix tests for 508= 97, mention behavior change in NEWS=C2=A0are incorrect=C2=A0and several= tests in the new patch are incorrect.

Philippe



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<= br> > bashing through if/case/for/while/repeat/select individually -- the > only case we have to fix is this one:

I was half right.=C2=A0 Fixing that case revealed that it was necessary to<= br> go through the others, because the "redundant" fix is one level t= oo
far up the stack.

Attached patch removes 50929 again, and amends this_noerrexit from
50897 in each of the complex command exec* functions.=C2=A0 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.=C2=A0 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?
--00000000000076ccbc05ed87ab62--