From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1388 invoked by alias); 25 Mar 2018 18:09: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: 42532 Received: (qmail 20713 invoked by uid 1010); 25 Mar 2018 18:09:20 -0000 X-Qmail-Scanner-Diagnostics: from mail-wm0-f50.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(74.125.82.50):SA:0(-1.9/5.0):. Processed in 2.108359 secs); 25 Mar 2018 18:09: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_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=FOl+85hLh81GwgIp/jQI2+XlrsCivTnL3m6H3yE+8f8=; b=ZBhj2wrvxdA1MARuqQCrxXR3/zSqEuOzy7Gzzi0KTsT1+382yWIqZYi05fIww5UCLo 9uljdPiYjH07D5+XFtrJzyTz+9BeK+XqOBV6j5wvz1XdJUNmrAow78lfipFE08vbqZjf 2eVtKIE3aCfLHyXf1/7cHtHCwPauhRZK2aLMGkiWnXsVwvj4Bv/aWTWMwZR/O+Z5MUDz ePHVHVX0YkL4kt77WFLjwk8zhSnM0ZtZTJMUDnSQYtB95QQ9viUl3cD5nnddckqe4VwC y3pTZtRpsXnSq8AWtr3+Yvxc/6gNsHr0dGdtzDnkO8ofpVED5TTKXghShqv6KSvttGy9 /O4g== 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:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=FOl+85hLh81GwgIp/jQI2+XlrsCivTnL3m6H3yE+8f8=; b=U1DulimZTIf0wdNvieagPmRXtOHoW9ixsDeK5jAeSB03bd37DV+N2uTNE9K8ARLq4B JnUZO8yvDgqAVAY8l0xiOIXV3ohWXkC8jpiIANjiFXyDYR5z3fcvBGXrQx7Hln8jF7Rb B81U0K7cOv1suVpg7q12QNKkkK1Q9HHm0imEIJipIPFgSFDsvLGK4T7BdgnHdDjppGwN xUi5WfYqYG7RMikORMk1v5bvj+57EedRBASX8Yckpej6eXpg5Qr4PluiJq1G0h07/wcd tLIRwFO2qZc6v+4F5WUzexPopcrk2zfY8L6GT6WUZ5nvxM6SieXCHKdaC66Zw821XTfI O/Yg== X-Gm-Message-State: AElRT7GCiW1KzWc0wWfLsFx0MJ+iIzr4nd1immH/Vm4hi471Da71kMEv BP90D5SbIXT4i4fk/ZcAs+PqKg== X-Google-Smtp-Source: AG47ELuRRpckjpnpof8yR+s9KHWcMeyhjviXd2zlWtxeVnMSFfBi5r8d0Uju19ktZ8cZYl9aB8xW/A== X-Received: by 10.28.160.9 with SMTP id j9mr14378445wme.51.1522001355036; Sun, 25 Mar 2018 11:09:15 -0700 (PDT) Date: Sun, 25 Mar 2018 19:09:13 +0100 From: Stephane Chazelas To: Bart Schaefer , Zsh hackers list Subject: Re: "echo | ps -j $(:) | cat | cat | cat" runs components in different process groups Message-ID: <20180325180913.GA20656@chaz.gmail.com> Mail-Followup-To: 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> <20180324173406.GA18604@chaz.gmail.com> <180324152357.ZM32580@torch.brasslantern.com> <20180325074827.GB7561@chaz.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180325074827.GB7561@chaz.gmail.com> User-Agent: Mutt/1.5.24 (2015-08-30) 2018-03-25 08:48:27 +0100, Stephane Chazelas: [...] > Note that with ksh93, like in other shells, one can't delay the > creation of the other processes with command substitutions as > they are not done in the main process. [...] Well, no that's not true. Since like in zsh, the last pipe component is not evaluated in a child, in: sleep 1 | { ps -j; sleep 2; ps -j; } the second ps -j will be started while the original job process group leader and everybody else in the group is gone, so has to be in a different group. I find that ksh93 uses the shell's process group in that case: ksh93$ alias sleep=/bin/sleep # otherwise sleep is the builtin one ksh93$ sleep 1 | { ps -j; sleep 2; ps -j; } PID PGID SID TTY TIME CMD 7765 7765 7765 pts/6 00:00:00 zsh 7771 7771 7765 pts/6 00:00:00 ksh93 20782 20782 7765 pts/6 00:00:00 sleep 20783 20782 7765 pts/6 00:00:00 ps PID PGID SID TTY TIME CMD 7765 7765 7765 pts/6 00:00:00 zsh 7771 7771 7765 pts/6 00:00:00 ksh93 20785 7771 7765 pts/6 00:00:00 ps I find that a sleep 1 | { sleep 2; echo go; sleep 10; } cannot be suspended after "go". I've seen ksh93 also become very confused and claiming "no job control" in one situation. Do we agree that in: { a; b; c & } | d $(e) > $(f) | { g $(h); i; } All those processes should ideally run in the same process group as they're meant to be part of the same job? Or at least that at any given time, all running processes in there should be in the same process group and that process group be the foreground one? process substitution probably have to be different. AFAICT, in all shells, they run in background. Some even let you access them with $! (or $apids in rc) and wait for them. There's also the exec 3> >(cmd) where clearly cmd has to be in background. -- Stephane