From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 13a92263 for ; Sun, 24 Nov 2019 23:42:47 +0000 (UTC) Received: (qmail 10382 invoked by alias); 24 Nov 2019 23:42:42 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 44924 Received: (qmail 17802 invoked by uid 1010); 24 Nov 2019 23:42:42 -0000 X-Qmail-Scanner-Diagnostics: from injection.crustytoothpaste.net by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.0/25642. spamassassin: 3.4.2. Clear:RC:0(192.241.140.119):SA:0(-1.9/5.0):. Processed in 1.293269 secs); 24 Nov 2019 23:42:42 -0000 X-Envelope-From: sandals@crustytoothpaste.net X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at crustytoothpaste.net designates 192.241.140.119 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1574638926; bh=u2pzQc09hXFt+cx5AyR3xIIDkmoJx9U7kHRKzuNPXOo=; h=From:To:Subject:Date:From:Reply-To:Subject:Date:To:CC:Resent-Date: Resent-From:Resent-To:Resent-Cc:In-Reply-To:References: Content-Type:Content-Disposition; b=l9AwQKInLBIixY0ooamKc6g3WnoJiTBCkVTaG52TNtjIqWtHN5Oni2AIi69EXy9r9 m0xIqHZKyAY4hCNC2XOcMsX2aoZKhwOi3+ZFnxMAzvKOUvIwPps5+gPhH9NBHnWm0Y Orh0Hnoe4bAMh2D9CGY0I417bePF+XVqQ8a/1mo+ly5y/dMRtr5PHMZXCDrL43cSlc ncCPGcA6kMM2lpRnmV0gu+wp+YZwz7ZMDwwMt7Srp6lbC/ggcobkdh/krHVzG4aDXb losPPS9W4t8CNxzClPsHqWC0FKZwCg3Q73rhpbESW/0Pv17cdoqs/3ahd/WBaMzedC ILSZW2T0gIcEhHk40u4fDAE9dKW+pL5XueK+WM1nnQOg+OjhdWNLIFumApZ9LhLwbe hhCyUVsauRBpvearAZ85GwcUsqRGpPelTyjQEZreVn81oRfLVLXKJmCq6YSuD2Vj/S WmRWo15MDy5M2JacXZ60EkNUsxCAaZmv/R58ArD3wxh1h9Idi6A From: "brian m. carlson" To: zsh-workers@zsh.org Subject: [PATCH 0/1] Run final pipeline command in a subshell in sh mode Date: Sun, 24 Nov 2019 23:41:18 +0000 Message-Id: <20191124234119.2403456-1-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.24.0.359.ga6e4e5af0a MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Qmail-Scanner-2.11: added fake Content-Type header Content-Type: text/plain POSIX sh implementations run each command in a pipeline in a subshell, although zsh (and AT&T ksh) do not: instead, they run the final command in the main shell. zsh is starting to be used in some cases as /bin/sh, such as on macOS Catalina. Whether this is a good idea or not, it makes sense to emulate the POSIX behavior as much as possible when emulating sh, since that's the least surprising behavior. This patch does exactly that. With this patch, using "zsh --emulate sh" passes all but one test of the Git testsuite. The remaining failure is due to zsh preserving NUL bytes in the output of command substitutions, which is permitted by POSIX; I will be sending a patch to fix that bug in the Git testsuite. I will admit that some of the tests included look bizarre, such as piping to an assignment, but I felt it was important to hit as many cases as possible. I'm not subscribed to the list, so please CC me with any comments, and I'll try to address them promptly. If you'd like me to include a changelog entry, please say so, and I'm happy to include one. brian m. carlson (1): exec: run final pipeline command in a subshell in sh mode Src/exec.c | 10 ++++++---- Test/B07emulate.ztst | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+), 4 deletions(-)