From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10596 invoked by alias); 24 Mar 2018 17:34:21 -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: 42522 Received: (qmail 14290 invoked by uid 1010); 24 Mar 2018 17:34:20 -0000 X-Qmail-Scanner-Diagnostics: from mail-wr0-f175.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.128.175):SA:0(-1.9/5.0):. Processed in 6.742503 secs); 24 Mar 2018 17:34:20 -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,FREEMAIL_FROM, RCVD_IN_MSPIKE_H2,SPF_PASS,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: stephane.chazelas@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=5mJ55/misuf2B4OQPrE69NTTdh5aNkr++T5M50AHZcU=; b=DN3iWYWJ3247yKH9SJxa3vkEj4b0oDa0XmeRWNS/3D3jKID+EM9zzmwL5wMzGmIQVL VTHNjET1nwHIjt2jqpQfI2m/z5EuTRq/1wedDMzNYdjpwLaZE3JB5i6XGBN+bHzAC9QJ P6trdanxvPBR/tvLlzXZbtFrtTMmG3CPaiQsbdQaADYHDSUtl5IRrPfvORNZsIlkKdn/ o4ym94D169J1DiOaQigy1oEO0MJOz0RZgZ/zXvH8NJeuyWYw35QoCT0u1ixMq3JEO+uG rTTRIUwuwAflShfeKpx5oJ2+SVX6VvCv8A5RzWjWpWdmQxBSOegPhzgCyS0E1bMpAJvK Ag2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=5mJ55/misuf2B4OQPrE69NTTdh5aNkr++T5M50AHZcU=; b=riHkUVHyMpKVzMyxymuTJ4LHKm6MxDTLd8lesbjHeGcqVnesPJ/brNz6U1bDsR8sWQ dLSm5iAYI76visgFQc/6rQofyDW2bpPKQxbcb/AChpaPbhIyBF+KXSAxzamcNLhpMnZk A/wqoRqPJUuLM6kfETrGF1rIvz68ksGajAmTNit62qv9oFrlq1Y4NLfgRnVL/P4O13kq OO8d2LbsDOrbqYXwZg6FdAGMnsCNo8mcNjeSfPKgkqYhynb6petbsrqQUuiOTBAqbuu2 1xkLYMQmrLCghP1uICNoY0EsVNoYJ5pfiLGhZfHLe4kz7ZA9QRXXd7YvHORFZXpWpT8E kF1g== X-Gm-Message-State: AElRT7EaQSAYxlmZy0uPsAJNvOIoOSK82eaYFjhT4wm9R3hnpNQhMO2H Wjsz3MHQE19yEcBsJhYZsVY= X-Google-Smtp-Source: AG47ELu+2AfBYDyGwSzRcBUGYwzFurUi0S0y4iEbRQQ2CqEz4kqgfCjY1bhKIknNecUvuI2LPGAdQQ== X-Received: by 10.223.142.164 with SMTP id q33mr25634232wrb.72.1521912849815; Sat, 24 Mar 2018 10:34:09 -0700 (PDT) Date: Sat, 24 Mar 2018 17:34:06 +0000 From: Stephane Chazelas To: Joey Pabalinas Cc: Bart Schaefer , Zsh hackers list Subject: Re: "echo | ps -j $(:) | cat | cat | cat" runs components in different process groups Message-ID: <20180324173406.GA18604@chaz.gmail.com> Mail-Followup-To: Joey Pabalinas , Bart Schaefer , Zsh hackers list References: <20180323161612.GB4857@chaz.gmail.com> <180323163614.ZM10192@torch.brasslantern.com> <180323221959.ZM27569@torch.brasslantern.com> <20180324080514.txxyrb3qiztu4pqt@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180324080514.txxyrb3qiztu4pqt@gmail.com> User-Agent: Mutt/1.5.24 (2015-08-30) 2018-03-23 22:05:14 -1000, Joey Pabalinas: [...] > The "cat: -: Input/output error" and differing number of entries is kind > interesting, although I would be lying if I said that I understood why. [...] Yes, I should have mentioned that the initial problem was that some of the processes in that command line are not running in foreground, are not in the foreground process group of the terminal. The initial problem at unix.stackexchange.com was on something like echo x | $(echo vipe) | cat or echo x | vipe $(:) | cat And vipe (running an editor to edit the pipe) is suspended when trying to read from the terminal while it's not in the foreground process group of the terminal. And: echo x | ps -j $(:) | cat | cat | cat shows that all those ps/cat processes running in different process groups instead of just one process group as one would expect. Bart explained that it was because zsh uses the first spawned process (here to run a builtin) for the process group, makes that the foreground process group, but by the time it spawns the 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. >>From stracing mksh, it looks like that's what it does. Stracing ksh93, I can't seem to make it have the first process end before the other ones are started, I'm not sure why that is. That in a | b $(c) | d c is not run in the same process group as the rest is probably a separate though related issue I'd say. That means, that one can't ^C sleep 1 | cat $(sleep 10) for instance. -- Stephane