On 02/11, Illia Bobyr wrote:
>
> Do we really need to check wait_sigint_received here?
> If the child exits because of SIGINT was indeed received all the
> processes on the same terminal will also receive it.
Only if SIGINT was sent to pgrp (like ^C sends SIGTERM to the
foreground process group).
> --- 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 ((WTERMSIG (child->status) == SIGINT)&&
The problems is, if WTERMSIG() == SIGINT everything is fine. Quite
contrary, we need to handle the case when the last running command
was _not_ killed but exited on its own.
Oleg.