Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [BUG] Ctrl-C stops working after process substitution
- X-seq: zsh-workers 43148
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Peter Stephenson <p.stephenson@xxxxxxxxxxx>
- Subject: Re: [BUG] Ctrl-C stops working after process substitution
- Date: Sat, 7 Jul 2018 16:48:09 +0200
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=r5mb42IQ2AP9HNp/9jbAC7qT+ufBBJaxLSCpmXaHOp8=; b=JP9lIUmIVSnALqbtPcqC/6e+j7AWHpH0Mbilgv9Pb2mi1HDae6KRbrFLvgvfm81trY bpgise9AxZQqHxCbpT0mhzlgW10s3O9qmUfvxKjci3sA1w6KSsfBCBF9cwOypbJKps8W qO11P9n29sVMwsTESeRhyV5Qfb2M6fJEBxPIDUeFwx3B8dMTvPZpaMlx9vBRzmMwPoVq UeY3bw6yMTXFtqyymK8Xeqog3Zv3Xb+k7l/t+fap664F0bfJd7s1wHw24SbnAPghvgXl zFa0KFtY7jYPAOFD6NVY1T6cmnU3UqczEGupJ5Y9GtZlqdlSWyzAYEpCVaCicSCgGY6Q WADA==
- In-reply-to: <20180705084448eucas1p244dbcec9f6d915655cd8bb035fb72f6e~_bI-T7ynp0198101981eucas1p2S@eucas1p2.samsung.com>
- 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
- References: <CAKc7PVAkph0UJGRojp3+H2VVYOHWsTCLQo9iONh0TnuvMwL_=Q@mail.gmail.com> <1530706152.948208.1429754600.66E3F94F@webmail.messagingengine.com> <CGME20180704170810epcas5p29840028fd34c40ae2a91008f8c25eb79@epcas5p2.samsung.com> <CAKc7PVB5fd-aqgFeuTTpBU9TYUkAfcVT1+PmCGmMFJEij2azVw@mail.gmail.com> <20180705084448eucas1p244dbcec9f6d915655cd8bb035fb72f6e~_bI-T7ynp0198101981eucas1p2S@eucas1p2.samsung.com>
On 5 July 2018 at 10:44, Peter Stephenson <p.stephenson@xxxxxxxxxxx> wrote:
At the end there's a check for errflag and if
> it's set the error bit ERRFLAG_ERROR is removed and we ignore that
> FD until the read function returns. There could be something
> unhelpful in this area. In particular we don't do anything with
> the interrupt bit ERRFLAG_INT or a hard error ERRFLAG_HARD.
>
> But that's just a guess.
I have an observation. I configure LLDB to pass SIGINT to program.
LLDB shows this table:
NAME PASS STOP NOTIFY
=========== ===== ===== ======
SIGINT true true true
So on Ctrl-C, it will be passed to program and program will be stopped
(i.e. debugger will stop program to allow stepping, etc.).
I then attach to proper PID of a Zsh instance. Then press Ctrl-C –
debugger activates, Zsh obtains signal. Ok.
Then I paste some text into Zsh so that Fast Syntax Highlighting runs
zle -F -w handlers that check if string is a path (to highlight this
string).
So far so good. Then I press Ctrl-C and (IMPORTANT) – nothing happens.
Even debugger doesn't activate. I can press Ctrl-C many times. Pasting
text that runs zle -F -w stuff leaves Zsh and debugger blind to
Ctrl-C. Isn't this a masking of interrupt? This would explain the main
problem – no reaction to Ctrl-C.
If I then use the known method to dig-out from this improper state –
Ctrl-D, then Ctrl-C starts working again – debugger notices it and
activates, program obtains it (zhandler is called).
So what could mask SIGINT as the result of pasting text and zle -F -w
invocation? There's a hint: pasting the text into command line causes
zhandler invocations (I have breakpoint in zhandler). I paste string
"NAME" (header of the table) – nothing happens. Press space, then
paste "NAME" again – now Fast Syntax Highlighting will run zle -F -w
because "NAME" occurs as program argument, and can potentially be a
path. Effect: two zhandler calls:
frame #0: 0x000000010f8517d2 zsh`zhandler(sig=20) at signals.c:601
-> 601 last_signal = sig;
602 signal_process(sig);
sig == 20, then some stuff is executed that isn't clear for me yet.
What can be happening? SIGINT (?) reaching zhandler two times, just
because I pasted text that ran zle -F -w?
I then go final minimal thing: start zsh -f and run:
noop() { print "I'm ran" >> /tmp/reply; IFS='' read line; MYFD="$1";
zle -F "$1"; exec {MYFD}<&-; };
exec {MYFD}< <( echo a test ); attach() { zle -F -w $MYFD noop; }; zle
-N noop; attach
And – zhandler is called! It's pure-empty, clear Zshell, no
fast-syntax-highlighting, so just pasting doesn't yield any debugger
reaction. But running it calls zhandler (sig==20) two times. I then
minimize further:
exec {MYFD}< <( echo a test )
This code starts zhandler 1 time (sig==20).
So my conclusion is: exec and/or <() invoke zdhandler in such a way,
that it masks SIGINT.
That said, full Zsh with Fast-Syntax-Highlighting is needed for the
effect of Ctrl-C blockage to occur, in zsh -f I can repeat zhandler
invocations, but Ctrl-C still works.
--
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Messages sorted by:
Reverse Date,
Date,
Thread,
Author