bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SIGINT handling


From: Stephane Chazelas
Subject: Re: SIGINT handling
Date: Tue, 22 Sep 2015 07:41:09 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

2015-09-21 22:07:55 +0100, Stephane Chazelas:
[...]
> Can you please clarify why the check for EINTR was needed?
> 
> What do you suggest we do to fix that issue?
[...]
> The thing is that thread was about the opposite problem at the
> other end of the spectrum so we need to find the right way to do
> it so we don't cause one problem or the other.
[...]

OK, I get it now, that other thread was about a totally
different scenario where ^C is pressed in between waitpid()
returning for a normal exit and bash restoring the normal
handler for SIGINT which explains the check for EINTR which is
intended as a race-free check that SIGINT was received before
the child died.

Now, that check for EINTR is wrong as well as it introduces that
other bug, so it could very well be that the only thing we can
do is reduce that window above to a minimum or give up on WCE.
Unless there's a clever thing that can be done in SIGCHLD and
SIGINT handlers. I wonder how FreeBSD sh addresses that.

BTW, ksh93 has the problem (the 2011 one) as well as in:

ksh93 -c 'while :; do /bin/true; done'

Sometimes is not interrupted by the first ^C. (same with bash
with my patch applied).

Note that the WCE/WUE was discussed in 2009 on the zsh mailing
list: http://www.zsh.org/mla/workers/2009/msg00943.html
where the order of delivery for SIGCHLD and SIGINT was already
noted.

It looks like the zsh maintainers are no big fan of WCE either.

-- 
Stephane



reply via email to

[Prev in Thread] Current Thread [Next in Thread]