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=-1.0 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 16184 invoked from network); 5 Jun 2020 10:22:26 -0000 Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTPUTF8; 5 Jun 2020 10:22:26 -0000 Received: (qmail 12136 invoked by alias); 5 Jun 2020 10:22:18 -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: 45983 Received: (qmail 10463 invoked by uid 1010); 5 Jun 2020 10:22:18 -0000 X-Qmail-Scanner-Diagnostics: from mail-io1-f66.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.3/25828. spamassassin: 3.4.4. Clear:RC:0(209.85.166.66):SA:0(-2.0/5.0):. Processed in 3.619214 secs); 05 Jun 2020 10:22:18 -0000 X-Envelope-From: mikachu@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.166.66 as permitted sender) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=7vm5FIdRyNl/JIJeXdKPgttPN14/KRC0eRTIQxfrWj8=; b=NrsPUTc/i03gZT4mGHixySmWdCQuRv7ykBLj8QkLRoozliUE/3Nr2u4QBRggET8J6I kl4ZNPd04/zmWVm1+yRxFui0GcATIJ70sf7Spy2DzJHTmXSZTGlDtutX80ou2JZZNlGv wOoFCnLOSUUR7D3lbadPsG6a451DvkVfingkRBnWupP6FT4gn2tZY0tc+yOdsQeHDPap KwhimeoM2tY/8tdVPCLgNo1etg9SgPfpI7YBVYvjNmo8shgxOFaN6JcPfxakxr3piVBZ UBoC2udUDu5hvxq/BZ8mpgGIC5M8WI2C05D5hmbRO74FRbOH75a8BpqZB+hN2Bg63ihT Hn+w== X-Gm-Message-State: AOAM533iaoTmSx0ZhuD4hoMvCNVc54i72hgzjFq+PBJZ00kCBGjHhOd0 +86u8rjp7RsgeOdwJsGXCKXWPDNabzJpXBY0mWY= X-Google-Smtp-Source: ABdhPJwUIl5ZvnbAOymTMgPdp7XncsrNi00xA0qst3VDSPLufJZEcRlF2dqkVMb5lZt0zIehoCXxRu+id01bs9CfVwo= X-Received: by 2002:a5e:dd07:: with SMTP id t7mr7772309iop.21.1591352502201; Fri, 05 Jun 2020 03:21:42 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20200605015338.1347787-2-sandals@crustytoothpaste.net> References: <20200605015338.1347787-1-sandals@crustytoothpaste.net> <20200605015338.1347787-2-sandals@crustytoothpaste.net> From: Mikael Magnusson Date: Fri, 5 Jun 2020 12:21:41 +0200 Message-ID: Subject: Re: [PATCH v2] exec: run final pipeline command in a subshell in sh mode To: "brian m. carlson" Cc: zsh-workers@zsh.org Content-Type: text/plain; charset="UTF-8" On 6/5/20, brian m. carlson wrote: > zsh typically runs the final command in a pipeline in the main shell > instead of a subshell. However, POSIX requires that all commands in a > pipeline run in a subshell, but permits zsh's behavior as an extension. What POSIX actually says is: "each command of a multi-command pipeline is in a subshell environment; as an extension, however, any or all commands in a pipeline may be executed in the current environment" Ie, it does not say "shall", so it doesn't require a subshell all, in fact it explicitly does permit not using one as you also say. The patch is possibly useful (seems unlikely to me), but to say it is required by POSIX is not true. If someone depends on every command in a pipeline being a subshell, they should fix their code, for example by adding ( ) around it (the command(s) or the whole pipeline). -- Mikael Magnusson