bug-bash
[Top][All Lists]
Advanced

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

Re: [BUG] Bash not reacting to Ctrl-C


From: Oleg Nesterov
Subject: Re: [BUG] Bash not reacting to Ctrl-C
Date: Tue, 8 Feb 2011 22:17:13 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

On 02/08, Bob Proulx wrote:
>
> Oleg Nesterov wrote:
> >     $ sh -c 'while true; do /bin/true; done'
>
> Be careful that 'sh' is actually 'bash'.  It isn't on a lot of
> machines.  To ensure that you are actually running bash you should
> call bash explicitly.  (At least we can't assume you are running bash
> otherwise.)

It is. In fact I did "./bash" while testing.

> Is the behavior you observe any different for this case?
>
>   $ bash -c 'while true; do /bin/true || exit 1; done'
>
> Or different for this case?
>
>   $ bash -e -c 'while true; do /bin/true; done'

The same.

I do not know what "-e" does (and I can't find it in man), but how
this can make a difference?

Once again. If bash gets ^C and at the same time the current foreground
child exits normally (either because this jctl signal races with exit()
or because the child hooks SIGINT and exits after that) SIGINT is lost.

set_job_status_and_cleanup() insists that WTERMSIG(child->status) should
be SIGINT, iow the child should be killed by the same signal. Otherwise
it is not going to kill itself, and the next wait_for() clears
wait_sigint_received.

This all looks intentional, but this means ^C can never work reliably.

Oleg.




reply via email to

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