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,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 9561 invoked from network); 1 Jul 2021 13:32:44 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 1 Jul 2021 13:32:44 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1625146364; b=AlZfUOygRCmesT3FQajh2CToDOfZc31vUI7eP6gV3loKV0stwUsXiLn1M2LbyrBaZsvZ+Ml16m GC9Y3AwG96yrykXY3jFogUyrNKH/V1CuGBygwTf/1cRs3Rl1cYouzu8zt0tZ9hrjPUzXWUg1fA rdRc2waP2oWkJnZIRmVdVRtoBn0OkFszGJJlZ56Qwl4mCDK29T1W1E52+U00i2k9vOEN0APsYQ 7dNKS2AhRqVRqTl4EP2grIYGJ/9RDApDct4wZo2PxG6CHi4MPSI2jpGnbtFjJX73j/h4l6fc6s IRKIGugQ0782g4yy9RVHBHHo2oSiitVVH5YnOkBwedGFMg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (joooj.vinc17.net) smtp.remote-ip=155.133.131.76; dmarc=none header.from=vinc17.net; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1625146364; bh=X5bQMaECldPeOL+RBsptBRpRYMKF6/KAXxdAsTlgvkw=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:MIME-Version: Message-ID:Subject:To:From:Date:DKIM-Signature; b=INZ/kSRZ1s86p4knd9P5o64uUae7oEJVnmpbJ29+OHRwJFYYWzj+Wdi6STW6IRCRc4G5EEE53C vN/zQQxodA/PopSEXDNr7PCtf9tRZj/gMq2CgbY6GwFUm3wEkPrLfR4ESZobOYklaodUvDZFjF 18KhhsGp34ZWlS2baRzBgrSCe1Myqbi9F2mrGZt5/8jtB3A0qB9lREV3j1taO1XWs3+cVU+Xrn a87Nz0FG71uivMEhMn5MYOQb5p/MXg0YrHTdFWMKSpTnC6fT7ziKiI1BDkmMOWWNRwOvBqz6Zo HMoCLtsUnROby/k2AG39FJ7BnuSanLOcRwXrwu5DU19ZZQ==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Message-ID:Subject:To:From:Date: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=8KgsQh3JG3hVpr0CDN+3+XZWGEctxKQ2Bz3s4gLFh7E=; b=QdWkJiPVCptHrIwQ5J+JXAXGZC FcWPiozTRqv2V4NqaLswu4LC3dt0z/YjO8umXHSS5SfW5pnqL/0mR0rv9RiiDCiZYj4l6YUvUsQST 3zQFMCc30erx3eGhdsGjNFO3wxMmpReyvK/aCPamEBm88S6svHTTTf7kTW0YySIMimemQUeMt7lyk s1MNLFujrovWs0dlfE1/TncglyPjpwAHsHnRC5QNwHWIB5OgYOwiYK9qmtzQnkg2vYHqeFMDa10QT SBnEeROxPc06NIF8r6NlAzECgSlE2VMtSmeibVMxPNOHLnUCQU5I+FAS/xs6/88aPWaxxN3mgPGo6 TpeiqyGQ==; Received: from authenticated user by zero.zsh.org with local id 1lywo4-0004yc-El; Thu, 01 Jul 2021 13:32:40 +0000 Authentication-Results: zsh.org; iprev=pass (joooj.vinc17.net) smtp.remote-ip=155.133.131.76; dmarc=none header.from=vinc17.net; arc=none Received: from joooj.vinc17.net ([155.133.131.76]:58420) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1lywnW-0004fD-Au; Thu, 01 Jul 2021 13:32:07 +0000 Received: from smtp-zira.vinc17.net (128.119.75.86.rev.sfr.net [86.75.119.128]) by joooj.vinc17.net (Postfix) with ESMTPSA id EEFE0FD; Thu, 1 Jul 2021 15:32:04 +0200 (CEST) Received: by zira.vinc17.org (Postfix, from userid 1000) id B82EDC225DE; Thu, 1 Jul 2021 15:32:04 +0200 (CEST) Date: Thu, 1 Jul 2021 15:32:04 +0200 From: Vincent Lefevre To: zsh-workers@zsh.org Subject: [BUG] last builtin command in a subshell and trap Message-ID: <20210701133204.GA1377664@zira.vinc17.org> Mail-Followup-To: zsh-workers@zsh.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Mailer-Info: https://www.vinc17.net/mutt/ User-Agent: Mutt/2.1+17 (9888ab2f) vl-138565 (2021-06-30) X-Seq: 49144 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: With zsh 5.8, the SIGPIPE trap is not executed when the builtin that generates it is the last command of a subshell: zira% ( trap 'echo PIPE >&2' PIPE; sleep 1; pwd; ) | : zsh: write error: broken pipe With an additional command (builtin), this is OK: zira% ( trap 'echo PIPE >&2' PIPE; sleep 1; pwd; :; ) | : zsh: write error: broken pipe PIPE I wonder whether this is related to the (undocumented?) optimization that exec's the last command of a subshell / shell script (though this is not applicable to builtins). There is the same issue with mksh, but not with dash, ksh93, bash and yash. -- Vincent Lefèvre - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)