From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3971 invoked by alias); 24 Mar 2018 08:05:22 -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: 42517 Received: (qmail 798 invoked by uid 1010); 24 Mar 2018 08:05:21 -0000 X-Qmail-Scanner-Diagnostics: from mail-pg0-f45.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.83.45):SA:0(0.9/5.0):. Processed in 1.088618 secs); 24 Mar 2018 08:05:21 -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=0.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, FSL_HELO_FAKE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS, T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.1 X-Envelope-From: joeypabalinas@gmail.com X-Qmail-Scanner-Mime-Attachments: |signature.asc| 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:references:mime-version :content-disposition:in-reply-to:user-agent; bh=mMyPKdIprvkIPMitaTnzoAcyeH5e+2JMMYvQfHFKq1E=; b=sMnm4EuM2iC7eGAze8JB6wwQiOJhnU1fABZyma9JevwAPLAtJn+zsx761iVB2Y54qX K8I3shPFRRtE4ZELuJnIcER1v3R054jEXzXflei0H1mi5lEyRuA5YnZ7wnz4+RRtmp7/ 1JaE9X28FQyXIgEcVOOeyXBwW5w8lE2/zQ5YuxrcvmLWGDK2b4NDqlVKIGI+xVU37HpH uUo+akw3B2RkzaPzVMzmSZgjFz2TkbEKu01Dg+OgOtlTXuRvn3EMBmCEWhMTqTDd55Is cGNx5YXRVaJGcAzXnzbMyTYAE5R5KAq6ymExG8o4uoN/m+1mfk5kOuz3l7zW/xtftGZ/ O0qA== 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:references :mime-version:content-disposition:in-reply-to:user-agent; bh=mMyPKdIprvkIPMitaTnzoAcyeH5e+2JMMYvQfHFKq1E=; b=Qoll8m2423VEvQXJkjhTwA2PogWEajcDIx16rnHS9A8rb46mwxhy7PmuJntPDMYbtw hrdA/jPJbnZxtaaiY0FidXpLHfZ+iyjBQ9Tnyd78rJiDl5Guu3nmLqV/BnGleRSKb2CS vzRt4uUe/bJXzkQu3R0xoHcWEQgj+hykv88C8G64JvCGdl8RvOijC2ILVrUsekqA1iju gJy/0t/mZ/MTq8Nf/xYmzDjOflurjH3H1uuSsEt3VpKXdncTE17P2Oef4zXYiE6IE9J0 0cwu0NDOP9+jad84XEs2phojwBNriU21yqFPs5H36GRMpjIJmSRgpkhVANKbvwv9vjdE zuNg== X-Gm-Message-State: AElRT7Hw9gLZCBNa+wa7LcYs7cB48u920/PHtNYmekf2wAGVKIDlOPwq zGdDYKIjleaHtrbgg/VtJ2A= X-Google-Smtp-Source: AG47ELs/ysUroO3VNyYlBWEhJ4Q0/x+Tb55Zu+l+b/DLDMT1w/PoORUNPXe31DJnsVPcg6I58tiqow== X-Received: by 10.101.97.205 with SMTP id j13mr9347377pgv.266.1521878718132; Sat, 24 Mar 2018 01:05:18 -0700 (PDT) Date: Fri, 23 Mar 2018 22:05:14 -1000 From: Joey Pabalinas To: Bart Schaefer Cc: Joey Pabalinas , Stephane Chazelas , Zsh hackers list Subject: Re: "echo | ps -j $(:) | cat | cat | cat" runs components in different process groups Message-ID: <20180324080514.txxyrb3qiztu4pqt@gmail.com> References: <20180323161612.GB4857@chaz.gmail.com> <180323163614.ZM10192@torch.brasslantern.com> <180323221959.ZM27569@torch.brasslantern.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="6l5r5jkemtttmkfh" Content-Disposition: inline In-Reply-To: <180323221959.ZM27569@torch.brasslantern.com> User-Agent: NeoMutt/20180323 --6l5r5jkemtttmkfh Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Mar 23, 2018 at 10:19:59PM -0700, Bart Schaefer wrote: > It may be this easy? >=20 > It fixes the specific example in the subject by causing the zsh parent > shell to re-assume job leader for all subsequent processes in the pipeline > if the current leader is dead. However, I'm concerned that if the first > leader is reaped after a few processes in a long pipeline are created, > there may still be a new process group asserted for remaining processes. >=20 > On the other hand I haven't found an example where that occurs, instead > I get jobs where the process group ID is the PID of the now-dead leader. > It could be I just haven't constructed the right test. It's kind of an *incredibly* unlikely edge-case but FWIW: > $ echo | ps -j $(: $(cat)) | cat | cat | cat The shell _seems_ to completely lock up after applying your patch; on my zsh 5.4.2 release version there are no problems (aside from the original process group leader issues). This is the shell output after I `pkill -9 cat`: > $ echo | ps -j $(: $(cat)) | cat | cat | cat > ^C^C^C^C^Z^Z^Z^Z > PID PGID SID TTY TIME CMD > 16007 16007 18994 pts/5 00:00:03 zsh > 17582 17582 18994 pts/5 00:00:01 zsh > 18994 18994 18994 pts/5 00:00:26 zsh > 20626 17582 18994 pts/5 00:00:00 ps > 20627 17582 18994 pts/5 00:00:00 cat > 20629 17582 18994 pts/5 00:00:00 cat The shell _appears_ to deadlock and accordingly ignores all user input such as ^C or ^D (but you can, however, still externally kill the parent zsh process group leader with any fatal signal or `kill -9 cat` without issue). It seems it's mostly an issue stemming from the parent zsh process still being the process group leader; this causes cat to wait indefinitely for input while being unable to actually receive any. In my zsh release version 5.4.2 ^C works as expected, and to be honest I don't actually know if this is anything worth being concerned about. Output from the release version (no need to ^C or ^D or anything): > $ echo | ps -j $(: $(cat)) | cat | cat | cat > cat: -: Input/output error > PID PGID SID TTY TIME CMD > 21366 21366 27814 pts/12 00:00:00 ps > 21367 21367 27814 pts/12 00:00:00 cat > 21368 21368 27814 pts/12 00:00:00 cat > 27814 27814 27814 pts/12 00:00:03 zsh 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. --=20 Cheers, Joey Pabalinas --6l5r5jkemtttmkfh Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEKlZXrihdNOcUPZTNruvLfWhyVBkFAlq2BroACgkQruvLfWhy VBkTxw//Y9eXuGuByAduOAjoQYmhhK5c2HAqOSy/3usXnvqu+VGBZpQItgcfKX0N I8goLYDiCFrwdNP6SFWa7+5H8k1nY+16vbn/lmzytGC+ExsWsBiia36W1n88o+E6 Kt/2T4+so8p3Qx1iHEvwRqLpb+9CTPe1fQcrX5usGFsm2ZhliU+lonShKBhb2uQG oHUzs9MR+q5AWU+fh2g++zHoqSL54FD/VyVVOgeKFyJ4UuhlZi1wHwB/Du/Db3Rx BWv2lSLpFutNcS8DmdPGNJKLbx9yJjBJZOopkEl48Hi+N4WgXyg0qxv2BlWhC1c0 oR5o7Mf1tfAF7I4CtVUI6pSNPHm69wiqbDd/AWN97LLH7UvWe49edhjgz1RtdKwK GkMUudojF1ddanMVwe0AFU+Yl3xhveqUAYo07OFV8CF2N2KXVJhBjhSNodMUrOWo wxt0peW5rB9AaJ45kmXSOSXdGgqgb3dEj9O5RaUGyf8yhgGpjwBvnTN5lOEkKLqj WtON9GEeO5udfnIIJkoL8U0zO5GR/DsJSVYDrHu3SMrNimCXk+o7R1E9MB59F+3R DX6dIsmgBi/q7FJGORypRwFKUZ9kAtrKNevYrupRVA1hsCnj9aVkLLbNQPqr4oyr yADGkXC6y4EuOcDsPEPRChYvLN3LhTk3adraLWSgFFQKcdIwp5Q= =Ep3Z -----END PGP SIGNATURE----- --6l5r5jkemtttmkfh--