lkml.org 
[lkml]   [2011]   [Feb]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Bash not reacting to Ctrl-C
Hi!

> > set_job_status_and_cleanup() notice wait_sigint_received and send
> > SIGINT to itself (termsig_handler (SIGINT)), but somehow it assumes
> > that the last foreground job should be terminated by SIGINT too:
> >
> > else if (wait_sigint_received && (WTERMSIG (child->status) == SIGINT) &&
> >
> > Then the next wait_for() clears wait_sigint_received and bash
> > looses ^C
>
> IOW.
>
> Now that it is clear what happens, the test-case becomes even more
> trivial:
>
> bash-4.1$ ./bash -c 'while true; do /bin/true; done'
> ^C^C
>
> needs 4-5 attempts on my machine.

Huh, this happened so often to me that I assumed it is a feature
:-(. Reproducible on both up arm and 4way x86...

Ok, it would be very good to get it fixed.


Pavel

> --- bash-4.1/jobs.c~ctrlc_exit_race 2011-02-07 13:52:48.000000000 +0100
> +++ bash-4.1/jobs.c 2011-02-07 13:55:30.000000000 +0100
> @@ -3299,7 +3299,7 @@ set_job_status_and_cleanup (job)
> signals are sent to process groups) or via kill(2) to the foreground
> process by another process (or itself). If the shell did receive the
> SIGINT, it needs to perform normal SIGINT processing. */
> - else if (wait_sigint_received && (WTERMSIG (child->status) == SIGINT) &&
> + else if (wait_sigint_received /*&& (WTERMSIG (child->status) == SIGINT)*/ &&
> IS_FOREGROUND (job) && IS_JOBCONTROL (job) == 0)
> {
> int old_frozen;


--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


\
 
 \ /
  Last update: 2011-02-11 15:45    [W:0.134 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site