From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1985 invoked by alias); 24 Mar 2018 22:24:05 -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: 42525 Received: (qmail 6628 invoked by uid 1010); 24 Mar 2018 22:24:05 -0000 X-Qmail-Scanner-Diagnostics: from mail-pf0-f180.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.192.180):SA:0(-1.9/5.0):. Processed in 1.941475 secs); 24 Mar 2018 22:24:05 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_PASS,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=7lFWVnuX2HOz1QkzXT6tUUk35YSH0gb7nhiMAFvGrqc=; b=nBiHsgsg5l+lP9UfFpEPvDcDmL/CMlD3gRiY1i9C/S1188UvgRPdeMlvyyF/pdRpd7 PaJWc2oyjl0QGm7wSPmyO24GuD9zVHyZJbOhVJ9Z2U/TG9UlPEDZVn9jCxYDWtOloJOS ZZbmcrMV5xGvc7bBUcCKcirDfmDQJR7QsUl4giav24ThqUJxiT3hEAgFlxNZk3kFz1cy 2VX9kiTkpOeiy/BhHWWoLnkqpe55uD5UmLz2juC9laCp7COBMfPzKA37UL7CJ83jZ/Cu xcpWz6UtY0bIiiyu4QmgzJZ6mmjz2YC2PqYAOBriWqOolBcNkUXXrdzBVQkXQjOkUbWb 1ZuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version; bh=7lFWVnuX2HOz1QkzXT6tUUk35YSH0gb7nhiMAFvGrqc=; b=AHXuJIwhpZm9uzND5tnOMBx694HCrkSd6h74XUUjyUc0j5uTF0/070z/Xs02ytf02d X+9OCThGFSWo2bvfCQ0RIJw/vixK3Dl3GjABtWIL0Q86K2Za7yT+Ku8rR6UZDeGGu3qp nbbgRkt4YCxKh/HKeJKiTBFq6SR3dAY765Qi91fG1TL0jpAbhQD0i+byrSjn153F+wuW iwtAv/1C0FSM7tYoxAx8sW55kQATm8ibHdJw/CEZxkQuijSegldvXr2jI1y3IRdpqP7O Y/qv9uLItopT62TzQ5thg9AlUaFfrYPUcawbtXd3STNpsNjdNNUE43BjEIHeHz1KNT7+ V+DQ== X-Gm-Message-State: AElRT7GJ6VC+lYGI8w7x4z4bQhlfCKNGP8FAPx7FnqOdyp7FEnSj0Bkg 9OH+GFJgKTrrp2EF+kLbKfwGqu4D X-Google-Smtp-Source: AG47ELtI19d1qbaQ8XlC8TQTgDKGoQtB/KFqFt8zOlCf5IgvNapxUz0iX6+j5nKUlC+xL7Mrh4np+w== X-Received: by 10.98.72.205 with SMTP id q74mr27874671pfi.70.1521930240627; Sat, 24 Mar 2018 15:24:00 -0700 (PDT) From: Bart Schaefer Message-Id: <180324152357.ZM32580@torch.brasslantern.com> Date: Sat, 24 Mar 2018 15:23:57 -0700 In-Reply-To: <20180324173406.GA18604@chaz.gmail.com> Comments: In reply to Stephane Chazelas "Re: "echo | ps -j $(:) | cat | cat | cat" runs components in different process groups" (Mar 24, 5:34pm) References: <20180323161612.GB4857@chaz.gmail.com> <180323163614.ZM10192@torch.brasslantern.com> <180323221959.ZM27569@torch.brasslantern.com> <20180324080514.txxyrb3qiztu4pqt@gmail.com> <20180324173406.GA18604@chaz.gmail.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Zsh hackers list Subject: Re: "echo | ps -j $(:) | cat | cat | cat" runs components in different process groups MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Mar 24, 5:34pm, Stephane Chazelas wrote: } Subject: Re: "echo | ps -j $(:) | cat | cat | cat" runs components in diff } } Bart explained that it was because zsh uses the first spawned } process (here to run a builtin) for the process group, makes } other processes, that first process has already returned and has } been waited for so zsh can't make the other processes join the } foreground process group. } } I think here, zsh should not wait for that process until all the } processes in the jobs have been started and joined the process } group if that's what from a now-zombie process. That's going to require a lot of mucking about, because currently all process reaping is done in signal handlers. The shell only explicitly waits for the rightmost process in a pipeline. The SIGCHLD can't be blocked because then the exit of $(cat) in the second pipe step could not be captured, so the handler *will* be called when "echo" exits. Also once that process has exited, setpgrp() won't make it a group leader any longer. Zsh would have to block "echo" from *starting* until the rest of the pipeline was built. This is all because most shells fork both sides of a pipeline, whereas zsh attempts to only fork the left side so that a builtin loop on the right can capture the output into the current shell.