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 12526 invoked from network); 13 Nov 2022 20:56:32 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 13 Nov 2022 20:56:32 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1668372992; b=pRR29fIeU76FM+N8KSSJ6HrSL3EFrpnPfUpgZaKAF/sadKstpv7z6hUtpq6Jv9lpXi2z1oz6nT VZZNu1bdztuhy3FJxN8wIzawKAZkgMmCBCQxjGM/0uXfKb9tmZSTUORf3rVKm8aASQ2GmEEq8o 5UxeCoUX0dQRW3cHMICdJFxayzf+MutytKD5+gzloiX01H9YEa7hxh8vCX/EflMd6SyfzPMAT0 jsfhcJNzmyuyPLIh/LtfWzuUAJ+Jvxu9TMc3BaNM24vV1EhSLjVCXOSo/ztMryOnjoFY1iG20b iKQaAQE387ZIoRVXg8mSkhnTSapqE+G/MZhp9v0InoL5Yg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-vk1-f181.google.com) smtp.remote-ip=209.85.221.181; 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=1668372992; bh=qoe6BXQVKuF9fh20HjxRuTImuqGyEz2hJueiuX3m2BI=; 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=Ts4+7RX7oe06JwK5H+vkMnjTUp9738h5XV0j0d67Nhg26VNMammTKg+zs9UFI3g0sALP6LUXMw KBdPE3QblXRS7Pbw/jg3gXHjdhMn0tgfOYbfKW92Im3wCofXWJ4t3pwlD1i3lB/jZno4gU0+Nb 5+TeWcUmAkePSGWKlVhtSR4KKbQp0DiAMdGlGQfFV38T/6/UjRwXwWIOL0jBmlBf5znf3cxVJR lzZS8Nji87hXiJNBV9/FF9n3zb1mx2tPsu9loogAK179ib7rldiK3KK5XnxqHbmfdaKEb9cE8w wxUjkEe+U1x9ABGqHiXX+b7/Yd9kN/S7Ur4gOObkKLhzAQ==; 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=qoe6BXQVKuF9fh20HjxRuTImuqGyEz2hJueiuX3m2BI=; b=qckzRXNmjA8EPivyepw2BrQGpj 6cVs1D59Im7clfM8NIONuadjfAQN88FwMHduk77YtfaZT9QpO6j+ufXXb7WwJvWohoqPtexL2LAx7 7jg7cJNTCBTPXett8tZKybAMHmWYpc6Moaks9QKf+4vQFLpJkqHWgcTPBvlyTxNagkC6zS5HSwYHS PivP3IxwKcC6qSIb9PfYwWnGYj1EvNK2xWzX2741m6NpNosvUt2CJEDJDir6/hPvqOCW5r2sOF7oG 2g6rkUrlnAlHBiDj1PcHskYmCzV/N0in6xklen/0X50yd4WZR02iJWr8NbQQdfJym0dz/G3iif6hy xaZPm45g==; Received: by zero.zsh.org with local id 1ouK1m-000LUr-UG; Sun, 13 Nov 2022 20:56:30 +0000 Authentication-Results: zsh.org; iprev=pass (mail-vk1-f181.google.com) smtp.remote-ip=209.85.221.181; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-vk1-f181.google.com ([209.85.221.181]:41617) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1ouK1T-000L9f-9y; Sun, 13 Nov 2022 20:56:12 +0000 Received: by mail-vk1-f181.google.com with SMTP id f68so4083816vkc.8 for ; Sun, 13 Nov 2022 12:56:11 -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=qoe6BXQVKuF9fh20HjxRuTImuqGyEz2hJueiuX3m2BI=; b=YbXUnqlgyTaPzci4/5LTU6jr5pQJHOTzrbOuNdF5GEbiPTyruTo+malb9z6ZOKxNej fKy5yqKAvOZNOjOgBWvTKYpJkdvKbKZRh2ENCzmQjCVWbhXHr1dfdB1wFmQ7N0PX2q48 tlSU90D2B3jDhjB8RwEswvdlozPz8ztMmnTKQ5Cgiu6dQnsDfFFhpOlFZteYfKK8hhAz rR6D52/lTy2AocDHBft71LFwlOFvDVWKiFbYG7p/0Fc62hrTYOMLoYMVhFvaDJTZGXu9 2kUDZ+3fyoULHrPizcxVpaVFka6QrQExneNrgXqXsCuDuUGhMRb7Ou9cmky/xiZVnl0n mviw== 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=qoe6BXQVKuF9fh20HjxRuTImuqGyEz2hJueiuX3m2BI=; b=KkelzPWKWknCBnKmPevDjlX06MD4ExYAV6neWEQUTWoIP5xafm0A6dkoF2Oc91quHq XQ8x5tyA6WbAbaI0hPG77bDh6wZQ/y2sQVciFBnQn0FpjKGL0v+dt5BVhjg/Jy9RFL9F PoCbbZrjpW+TQlbru4VRYhthnebXNKIXg7Dji9Gn9gNTiwM0ZL97MMxDiieo/kkKvGnQ LY5CWWD6z/hBtwvm5+HX55WYvjiyOf79y81xcnmd++TrT/sBm/g2PWrEyci3LpeLjsyd 4Hu9pMftlyYIXDSnmSkif42xUCOm32Ejo7+GfMTUm351zLqXwEsa+U7BnQ/JoaLvFIXG Ic1A== X-Gm-Message-State: ANoB5pkk/84eJ1JfGHqybKfKPQqG3+WrxBvWv2AFPmC7M6NK1wxwspsO mCQr8qA/aM23vE2RpdVz0h3IJ6gvicu/FiXPXtPMr02KFp8= X-Google-Smtp-Source: AA0mqf4xMtQuAbXYnmxYU6KJXLnXVnFakcHnsokBt/W8OuSeYaqIzPJZN5NUKQY2ABmmRlNREUJ8QVAbJ2HY7xrVwmc= X-Received: by 2002:a05:6122:12b2:b0:3b5:e89c:9351 with SMTP id j18-20020a05612212b200b003b5e89c9351mr5201395vkp.25.1668372970000; Sun, 13 Nov 2022 12:56:10 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Philippe Altherr Date: Sun, 13 Nov 2022 21:55:58 +0100 Message-ID: Subject: Re: [PATCH] More ERR_EXIT (was Re: Tests RE behavior of ERR_EXIT) To: Bart Schaefer Cc: zsh-workers@zsh.org Content-Type: multipart/alternative; boundary="0000000000003ad6d005ed605afb" X-Seq: 50958 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: --0000000000003ad6d005ed605afb Content-Type: text/plain; charset="UTF-8" Here is one thing that could explain why the "where" statement is an outlier (at least compared to the other compound commands that I have tested so far). It's the only case where after evaluating "false && true" you have to first evaluate a whole other command, the loop condition, before deciding whether you trigger an ERR_EXIT for the "while". For the other compound commands, you evaluate the "false && true" and then immediately decide whether you trigger an ERR_EXIT for the compound command. Here is an observation that could save some complexity. A non-zero exit status either immediately triggers an ERR_EXIT, like in "false" or it doesn't like in "false && true" and instead bubbles up to the first enclosing function or subshell thanks to exception 3. Thus, compound commands other than subshells never have to trigger an ERR_EXIT. That's a nice and not necessarily obvious side benefit of exception 3. I wonder whether the code was designed without that insight or maybe without knowing about exception 3 altogether. Without exception 3, compound commands sometimes have to trigger an ERR_EXIT and that could explain some of the current code and behavior. Philippe On Sun, Nov 13, 2022 at 7:37 PM Philippe Altherr wrote: > NOERREXIT_UNTIL_EXEC is what protects the tests between keywords "if" >> and "then" and those between "while" and "do" from triggering > > ERR_EXIT. > > > Really? NOERREXIT_UNTIL_EXEC is only ever set in execif. How can it impact > the code of a while statement? There is no trace of it in execwhile. What > am I missing? > > Philippe > > --0000000000003ad6d005ed605afb Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Here is one thing that could explain why t= he "where" statement is an outlier (at least compared to the othe= r compound=C2=A0commands that I have tested so far). It's the only case= where after evaluating=C2=A0"false && true" you have to = first evaluate a whole other command, the loop condition, before deciding w= hether you trigger an ERR_EXIT for the "while". For the other com= pound commands, you evaluate=C2=A0the "false && true" and= then immediately decide whether you trigger an=C2=A0ERR_EXIT for the compo= und command.

Here is an observation that could sav= e some complexity. A non-zero exit status either immediately triggers=C2=A0= an ERR_EXIT, like in "false" or it doesn't like in "fals= e && true" and instead bubbles up to the first enclosing funct= ion or subshell thanks to exception 3. Thus, compound commands=C2=A0other t= han subshells never have to trigger an ERR_EXIT. That's a nice and not = necessarily=C2=A0obvious side benefit of exception 3. I wonder whether the = code was designed without that insight or maybe without knowing about excep= tion 3 altogether. Without exception 3, compound=C2=A0commands sometimes ha= ve=C2=A0to trigger an ERR_EXIT and that could explain some of the current c= ode and behavior.

Philippe


On = Sun, Nov 13, 2022 at 7:37 PM Philippe Altherr <philippe.altherr@gmail.com> wrote:
NOERREXIT_UNTIL_EXE= C is what protects the tests between keywords "if"
and "t= hen" and those between "while" and "do" from trigg= ering
ERR_EXI= T.

Really? NOERREXIT_UNTIL_EXEC is only eve= r set in execif. How can it impact the code of a while statement? There is = no trace of it in execwhile. What am I missing?

Ph= ilippe

--0000000000003ad6d005ed605afb--