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.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 9386 invoked from network); 13 Nov 2022 16:52:43 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 13 Nov 2022 16:52:43 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1668358363; b=IawmbFqGiq6yLlK1fWcAtcOEw0IEc+3Gh+VQJVvJsJ25fP2RF66f6pzmGDaVJJ3Sqx25qAHOJb 6lIsRu6pYcT/2s5a6eks2i2zIRqClB8ftWz8s0Dda2AUW5Yti//PXtTwpRjOhyjA+lXVgiO2JG AesbRWhqp6xxGSEwH+KR6YL/11I3nD74Kj1X1CmyKeLBXjesTqrlSRIJn5oTjAEUh3w3HjcgTs tg2dRtOtD9Hkm5hmyv2he3r4eFTV4HZf2NAJpxpGH4H0WUXD8ViRLg8AvuILT6oG2zi+UkdRBl lf8A6V2/g1jxkWkLpUiK3grSJEFDyPzFLaPCfqwOvj22zw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ed1-f45.google.com) smtp.remote-ip=209.85.208.45; dkim=pass header.d=brasslantern-com.20210112.gappssmtp.com header.s=20210112 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1668358363; bh=BTrrkGteOHQ8wyTI3IJsMfZV7TY0+fJ0T273TJqqqn8=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:Cc:To:Subject: Message-ID:Date:From:In-Reply-To:References:MIME-Version:DKIM-Signature: DKIM-Signature; b=poPD0pBYbqvFrftSvcx6S4VqXBsfzyT7PeZDIZChyg+rQNSGTMOOeO4VC8GgZBcHQoqST0F8Wu 1uf7ef7Ovbud3rwnE//Ljm6gIUuBuBhiId0JnFaxUdbaeUZGvnwkD4K2qO6sHgb4MRivlh+367 synUYL4CORGDR428rJgMe94F+jFLa4U7E9T9rmknG8NQpOQ6XBO+PhvyQuKhQAbhMnCj71gmKI QYY5oueamIRs3Kt9pzIk453nO/ND/VAJujVowNvi03HW1/kTq5UyCDhSf0+PNXzWONJue7w+mL AoT1OubUQIcyCRNSxO3Ak/fiajcF8YETIoqvC9E0NDx/Rw==; 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-Transfer-Encoding: Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References: MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=VXTKdFEsrY9Ifcn1J9uFH+R8WKEW4ldbiCvxb2eILn4=; b=SeqJQu/gvua679Xr/9BDDxDC87 bjuNB9K0v9lIIoIPyiLjXas/6U/oeqMEOOVDVw5SPfu0YAQpdfXhAwWLWYN9NuT+R4pfPgQvhGI0N OrEiEgjxTGmBLKkE4bRcCms813hg6tyPWtLvIZeYJQSoyPKS2Vqavw5ZIMdOHxC6BApe/mr4rL+re TPxEBmfSK+WFTIA/Gz/4KwZsXszdugzFDXnDu/Xz0X9a6QPNFIa3ViMEYTjvgA9XcSfetJB1ZYIn4 eDSIcYFntLW1DltI/NSQfAssX9a+084RpbX37BoaKBiEFbqgzVn+2YTyqmA7BuDpxZyWknHAotZGG NsEoQ35Q==; Received: by zero.zsh.org with local id 1ouGDr-000DvS-AC; Sun, 13 Nov 2022 16:52:43 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ed1-f45.google.com) smtp.remote-ip=209.85.208.45; dkim=pass header.d=brasslantern-com.20210112.gappssmtp.com header.s=20210112 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-ed1-f45.google.com ([209.85.208.45]:35799) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1ouGDY-000DZe-8t; Sun, 13 Nov 2022 16:52:25 +0000 Received: by mail-ed1-f45.google.com with SMTP id x2so14142567edd.2 for ; Sun, 13 Nov 2022 08:52:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=VXTKdFEsrY9Ifcn1J9uFH+R8WKEW4ldbiCvxb2eILn4=; b=g1sPzA3AxvFFcmFl7zURBjviAg/8Y1sbTqK5D4S/odnyLrgl5rqOIzE4QrVIuskaQZ jTFIRhWX71o2Tb4qwB6U3a9WF021cMtg/ALAaSgRa2HXhNJnoV9HSPUy701x5hd3I2Cz fjkiiOgAbLrGBG8HfOduah14+M3FdFN45UJ3WmclS+vUIH0jcUoCVONFSWahbB5l/61R teoipGs3UAcyUbi2w1+fvt5GdonBHRreYy4DNCOATcE5H1XMYr+8O/B3a5pEtR4lysq/ BkMiSoBjOlxWwhx4Vz+dG6uZJV+cB/+CivFJwkXziuWjXY1vX8MdcpFCO1jgX9oT2Cr+ AEdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding: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=VXTKdFEsrY9Ifcn1J9uFH+R8WKEW4ldbiCvxb2eILn4=; b=Xw7vrCWxHH6ASxjAGFXPkcZQJP8v2rrGlLufRjSIlPwHusJcLP4ffW+vc0jOQc3wzV gl109/8aDm4ZfmQKjop7ESxdArjgYaO/Rhs0XkEqBP8mEOPU4sOVaXkdorBmjuPkn95+ 7jwcWlS47F4UOO7AWcUuwsnKmG9wE9eHK1mxmaoTc3IsNuxldvsMZL33d6CyYuE0e92M xFJuEkWdMTFjNtBzJMw50EpQ5d/dmRIA9vDwF2E+fwOI8Vttt/6DIxoBVoNng82uE5js uEtMQyxX0HNlZIcmB6xfdgwbU6kxEpypa62scp4Z3YDUm3vgVonnVn2xp89ZswhF0cVM tnSA== X-Gm-Message-State: ANoB5pmgB/6s4/Tvwryx1cYfKAfQjSdqpus0g+YNpcQsG/PDOk9z5o+1 P3aSCmnHOt7U/SFuLdOJm9LrYrKZdQ5HCn/R0FrkYA== X-Google-Smtp-Source: AA0mqf53aWF5LBPn774lNQ5MTyqHJ+EgEQb9pSdriS+36DGYhrIZInrF070ShxP5fmanjWT1TXEW7YKfszvBSJalLOA= X-Received: by 2002:aa7:c683:0:b0:45a:1af2:ed6d with SMTP id n3-20020aa7c683000000b0045a1af2ed6dmr8297598edq.364.1668358343910; Sun, 13 Nov 2022 08:52:23 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Bart Schaefer Date: Sun, 13 Nov 2022 08:52:12 -0800 Message-ID: Subject: Re: [PATCH] More ERR_EXIT (was Re: Tests RE behavior of ERR_EXIT) To: Philippe Altherr Cc: zsh-workers@zsh.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Seq: 50955 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: On Sun, Nov 13, 2022 at 7:46 AM Philippe Altherr wrote: > > Now let's remove the following code from exec.c > >> if (!(oldnoerrexit & NOERREXIT_UNTIL_EXEC)) >> noerrexit =3D oldnoerrexit; > > > With that change the two functions still behave exactly the same but if y= ou replace the while statement with any other statement (if, case, for, ...= ) then no ERR_EXIT is triggered in foo. Instead the non-zero exit status co= rrectly bubbles up to the caller and triggers an ERR_EXIT in bar. > > I still don't understand why the change above fixes the problem for if, c= ase, for, ... statements. I understand even less why it doesn't fix it for = while statements. NOERREXIT_UNTIL_EXEC is what protects the tests between keywords "if" and "then" and those between "while" and "do" from triggering ERR_EXIT. The problem is that when an && || conditional expression appears between "then" and "fi" or between "do" and "done" the assignment of noerrexit =3D olderrexit still happens, which resets the state too far into the past.