From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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, DKIM_VALID_AU,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from zero.zsh.org (zero.zsh.org [IPv6:2a02:898:31:0:48:4558:7a:7368]) by inbox.vuxu.org (Postfix) with ESMTP id 92370243ED for ; Thu, 20 Jun 2024 19:13:06 +0200 (CEST) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1718903586; b=DzK9hflkn2cNgNygTS0Lg9l3q2/l+NTfZ+rnaPM31PXNU7mm9rAGkpKQoRovfo2ZxmrX8XuDus PbwLCXE1ngmYIljrV8ugdoxf7OhdkUSCjbGqPMMSg25WBoWsDc9JfEYDFxA5p/WKGgr0ym0fp5 GOtyytKHp5fKfDK6aTtHNvzhD3NKhbCj866rbcZ6Sr+RgVqWzw7hMsPSn9G58iABhBtSNjlKFx 3iH3kw94uFAj98O9S+Qt7eOr0OHLnxIC4mF/ADjphLNeFAHcypYF11ZOdjwFyiKce78Hdp0syM 2bkvEZpF3NjgX2Vhed6nGNNcB6hqT9UAYmHuONYzmGU2Og==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (freekahlil.inlv.org) smtp.remote-ip=46.19.33.18; dkim=pass header.d=inlv.org header.s=inlv header.a=rsa-sha256; dmarc=none header.from=inlv.org; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1718903586; bh=Ae2CFW1SaVE6AVbceX6dhejdhKoC7VtG+n24b7xvfnM=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:Subject:To:From: MIME-Version:Date:Message-ID:DKIM-Signature:DKIM-Signature; b=eM1KOyxN5PFVgOVj38EX+bgeNAZMHVMHQYrtHKHXlk5iUWBmZd4em77uiTFxxMJlhgCpUXYA9m mhsfmaDWQ8U6VBRsrVzoKKE6gndhASDrxyDfosuBF2W2BbJYQE06llSkVpa016gr23uX7FRwh6 KovanjZGySNItRauZVLCYAWe0FwtfeIj9Ob5cVRnKKgPDPoERdh65hsy2lRkF5m9X6GUZizMfW I99VsyeLJxJI3gqyWFSYs+RhV6XXclIIL5Ynr0L0BlZRlnEaCe0QRUiAw40qzUoGrLa6uSzsaL AtxcMq1+nOpJfe65CF0pwN5ZEw+t99olLIkm0I4LvblhNg==; 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:Subject:To:From:MIME-Version:Date:Message-ID:Reply-To:Cc: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References; bh=s22IZPBK+pOPSuwS6s6/NnuwX2Rl2aZ4h4oIu+DsNZo=; b=gPcpmZpwC/uE4oR8rUmxCsHbFT dW0KolBMtLiLCF8qmvrpD2VagbLLozPmmUpcNmYe02YpPgUDvVsMilePgBY5YbEU7wAUwEH2m0U9p t8ZBEXU4BS1H+NSH8f/BKw4dIhh10GjEvLeeteJ6WPFQPwwFOed5veFnG0tzYsPYK1qw1oqcM0qVj vekjJWlEoi2A61t7urelJXNn7U+Bk3uY4r0d5xYwXEn0nILDmf/gSemEX24Z/P3H9ekGcyo/lr2JE itOrnbl2YjCom2qcdpVBTAaMdeVAabep55x4nkuxZTNjgOkp76iHVimIJgh5jLqNjdx8zaYdm/w5J rIU+FSDw==; Received: by zero.zsh.org with local id 1sKLLN-000OfM-DP; Thu, 20 Jun 2024 17:13:05 +0000 Authentication-Results: zsh.org; iprev=pass (freekahlil.inlv.org) smtp.remote-ip=46.19.33.18; dkim=pass header.d=inlv.org header.s=inlv header.a=rsa-sha256; dmarc=none header.from=inlv.org; arc=none Received: from freekahlil.inlv.org ([46.19.33.18]:21718) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1sKLL3-000ON3-1c; Thu, 20 Jun 2024 17:12:46 +0000 Received: from [IPV6:2a00:23c6:5398:5e01:61a5:abe2:ca5b:4544] ([IPv6:2a00:23c6:5398:5e01:61a5:abe2:ca5b:4544]) (authenticated bits=0) by freekahlil.inlv.org (8.16.1/8.16.1) with ESMTPSA id 45KHCiNF017611 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO) for ; Thu, 20 Jun 2024 19:12:44 +0200 (CEST) (envelope-from martijn@inlv.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=inlv.org; s=inlv; t=1718903564; bh=Ae2CFW1SaVE6AVbceX6dhejdhKoC7VtG+n24b7xvfnM=; h=From:From; b=YG9ff6GQGv87smpb69gWQ+evPloOgwmTarakIttbremv/+na/jzPNduU4ist92uoq y5r2jZt2O+0qdU6a3vN8CWOS7cni/gXGAh5J4vfQrj7psxuYCgTN/30iBwgm6qI2qt 7rQmkAkx87Qy/3bwwekyXWnb6JywAbFykgxz3lgM= Message-ID: <5d54375e-8673-45f0-b5ac-f5e0e233d56f@inlv.org> Date: Thu, 20 Jun 2024 18:12:43 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Martijn Dekker Content-Language: en-GB To: Zsh hackers list Subject: errexit and (Z)ERR trap regression Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Seq: 52967 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: Two manifestations of the same bug in the current dev version: $ zsh -e -c 'true && false; echo NOT REACHED' # no output; correct $ zsh -c 'true && (set -e; false; echo NOT REACHED)' # incorrect output NOT REACHED and $ zsh -c 'trap "echo Trapped!" ERR; true && false' # correct output Trapped! $ zsh -c 'true && (trap "print Trapped!" ERR; false)' # no output; bug The -e option and the (Z)ERR trap should be disabled for the left hand side of &&/|| but not for the right hand side (or, as POSIX puts it, set -e should be disabled for "any command of an AND-OR list other than the last"). zsh 5.8.x works correctly. A 'git bisect' revealed that this bug was introduced in: commit 259f1e944b96715fda25f7ba227da05bdb7e600f Author: Philippe Altherr Date: Sat Dec 3 21:03:36 2022 -0800 51071: fix ERR_RETURN for functions in conditional statements -- || modernish -- harness the shell || https://github.com/modernish/modernish || || KornShell lives! || https://github.com/ksh93/ksh