Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: zsh 5.6 regression: a pipe sometimes yields a TTOU signal
- X-seq: zsh-workers 43387
- From: Peter Stephenson <p.stephenson@xxxxxxxxxxx>
- To: <zsh-workers@xxxxxxx>
- Subject: Re: zsh 5.6 regression: a pipe sometimes yields a TTOU signal
- Date: Wed, 5 Sep 2018 14:21:24 +0100
- Cms-type: 201P
- 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=
- In-reply-to: <20180905105510.GA2116@cventin.lip.ens-lyon.fr>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- Organization: SCSC
- References: <CGME20180905091407epcas1p1ff78da39bfd4f3e4201f467683288a7b@epcas1p1.samsung.com> <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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author