From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: zsh-workers-return-43387-ml=inbox.vuxu.org@zsh.org X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,T_DKIMWL_WL_HIGH autolearn=ham autolearn_force=no version=3.4.1 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 508ab67c for ; Wed, 5 Sep 2018 13:21:45 +0000 (UTC) Received: (qmail 8499 invoked by alias); 5 Sep 2018 13:21:33 -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: 43387 Received: (qmail 26311 invoked by uid 1010); 5 Sep 2018 13:21:33 -0000 X-Qmail-Scanner-Diagnostics: from mailout2.w1.samsung.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(210.118.77.12):SA:0(-6.9/5.0):. Processed in 1.2812 secs); 05 Sep 2018 13:21:33 -0000 X-Envelope-From: p.stephenson@samsung.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20180905132128euoutp029ea1d73eec0f6dfedb2b99c901530ee5~Rg6P--_As0245902459euoutp025 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1536153688; bh=EPqcx2lNFAPRwl9YsoVKPd1RnlzCxxIVzgU1TCneBPs=; h=Date:From:To:Subject:In-Reply-To:References:From; b=Txk2VCKebqEXmm8nUGDTB5w0d9LtMhvn65trRwbnFw7RHZyMdmxgGNRFY90ywFm36 1Vhyxu9M+IhKEpwcoQFnb1rmJ2lQkpg9rNK5lI1cnV+ttxNpgu5ssC7D8lEk15pX3d r9y3bpYAi619E7vGTxhEREtsEyIbwqMIq1Y7u6Gs= X-AuditID: cbfec7f5-79db79c0000012c6-70-5b8fd857f3cf Date: Wed, 5 Sep 2018 14:21:24 +0100 From: Peter Stephenson To: Subject: Re: zsh 5.6 regression: a pipe sometimes yields a TTOU signal In-Reply-To: <20180905105510.GA2116@cventin.lip.ens-lyon.fr> Organization: SCSC X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrHIsWRmVeSWpSXmKPExsWy7djP87rhN/qjDb7PZrU42PyQyYHRY9XB D0wBjFFcNimpOZllqUX6dglcGX2rpzIX3OSq2PL0IFMD42aOLkZODgkBE4nrl7axdzFycQgJ rGCUmDHtMBOE08cksaxzEVSml0niw4KZTDAtUy6dZYVILGeUePtvLyNc1d9vs1kgnNOMEpv+ b4fqP88o8WbbLDaQfhYBFYlHF/ewgNhsAoYSUzfNZgSxRQQkJa41nwayOTiEBdwk7u2qBAlz CthI/D1zjwUkzC8gJHGh2RbiCnuJo3tOgl3EKyAocXLmE7CJzALyEtvfzmEGWSsh8J5N4tTE 9ewQRWUSsy7+Z4dodpE4tHcHlC0s8er4FihbRuL05B4WiOZ2Rok1k16zQzg9QN8cvcMIUWUt 0Xf7ItihzAKaEut36YOYEgKOEp+/eEOYfBI33gpC3MMnMWnbdGaIMK9ER5sQxAw1iR1NWxkn MCrPQvLBLCQfzEIYv4CReRWjeGppcW56arFxXmq5XnFibnFpXrpecn7uJkZgKjj97/jXHYz7 /iQdYhTgYFTi4V1wrj9aiDWxrLgy9xCjBAezkgiv0UmgEG9KYmVValF+fFFpTmrxIUZpDhYl cV4+rbRoIYH0xJLU7NTUgtQimCwTB6dUA+PaqE28NpJ+cQarE4zLnyguFdURCtP+MW1TvkhN uvD0qorEddYnJOX+bZXiFRT5fvpJWNKPsoQdq09zXwq77nnHOfvrybVzHkcF7lN241R+u07c ocRTWvJS0/MX59+78kbLThdmV3w9dT2bRBjvz/dTbvfYeH5snXRSsW7Ko0q+mNgp1/81/FZi Kc5INNRiLipOBACHmsIhAQMAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuplkeLIzCtJLcpLzFFi42I5/e/4Pd2wG/3RBsd3c1gcbH7I5MDoserg B6YAxig9m6L80pJUhYz84hJbpWhDCyM9Q0sLPSMTSz1DY/NYKyNTJX07m5TUnMyy1CJ9uwS9 jL7VU5kLbnJVbHl6kKmBcTNHFyMnh4SAicSUS2dZuxi5OIQEljJKLLq1nwUiISPx6cpHdghb WOLPtS42iKJuJomNLTOhOk4zSsx6cZYRwjnPKPFo/RImkBYWARWJRxf3gI1iEzCUmLppNiOI LSIgKXGt+TSQzcEhLOAmcW9XJUiYV8BZ4u3Sk2AlnAI2En/P3GOBmLmeSWLxnNnsIPX8AkIS F5ptIS6ylzi65yQTRK+gxMmZT8BWMQvoSJxYdYwZwpaX2P52DvMERuFZSMpmISmbhaRsASPz KkaR1NLi3PTcYiO94sTc4tK8dL3k/NxNjMCo2Hbs55YdjF3vgg8xCnAwKvHwepzpjxZiTSwr rsw9xCjBwawkwmt0EijEm5JYWZValB9fVJqTWnyI0RQYFhOZpUST84ERm1cSb2hqaG5haWhu bG5sZqEkznveoDJKSCA9sSQ1OzW1ILUIpo+Jg1OqgXF6/My9tzte11+zKsqReX7rikaA2MYn i1XeH1Yr6e58ncyiMcVjtpbnl7RZ58sEOoyLLnMmHZERDsxymeW9buM3j30ps/Kap/45WFzF 5/zjh03+EpusMOcHP7TfGbtcvmvXnXwpfP/yBdmJUY1CLttSbLIurtrwJsGgYELSl0hfc/Op 6TJbGpVYijMSDbWYi4oTAQBOFiSgAgAA Message-Id: <20180905132126eucas1p255bad6207f0b3f35e6ac7395adf3dce1~Rg6OT_Bnt0561505615eucas1p2J@eucas1p2.samsung.com> X-CMS-MailID: 20180905132126eucas1p255bad6207f0b3f35e6ac7395adf3dce1 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20180905091407epcas1p1ff78da39bfd4f3e4201f467683288a7b X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180905091407epcas1p1ff78da39bfd4f3e4201f467683288a7b References: <20180905090339.GA18116@cventin.lip.ens-lyon.fr> <20180905100356eucas1p29702acd7569a94c8c78003e6b124daaa~ReNxz4yht0327203272eucas1p2s@eucas1p2.samsung.com> <20180905105510.GA2116@cventin.lip.ens-lyon.fr> I've now been testing with echo foo | { : | more } though the exact form isn't going to be important. My theory is the following is happening: - Process "echo foo" gets control of the terminal. - The shell forks ":". This is group leader for the new pipeline but doesn't get control of the terminal. Note the { ... } is directly under the control of the main shell, as as is the "echo foo | ..." pipeline. We are in the world of nested pipelines. (Remember "Rimmerworld"? Yes, exactly.) - "echo" exits - The shell looks for a process to attach the tty to and finds ":" which is currently group leader. - ":" exits leaving the process group without a leader. - "more" is forked but doesn't get the TTY because nobody knows no one ain't got it. This is different from the case where there's no nested pipeline. As evidence, replacing ":" by "sleep 0.01" eliminates the problem (or "zselect -t 1" which is equivalent --- but it's not just builtins, you can put a "cat" there, but please don't swing it as you haven't got room, and the bug still happens). So I think there's some problem with the way transferring group leadership (the job gleader struct field) interacts with attaching the TTY (the call to attachtty()) when we've got a nested pipeline. Please tell me someone finds this an interesting problem... pws