Subject: Re: [PATCH v2 22/22] run-command.c: remove "pp->max_processes", add "const" to signal() handler

From: Ævar Arnfjörð Bjarmason <[email-masked]>
Date: Wed, 12 Oct 2022 20:58:22 +0200

On Wed, Oct 12 2022, Ævar Arnfjörð Bjarmason wrote:

There's a really stupid logic error here where...

> -static struct parallel_processes *pp_for_signal;
> +static void kill_children_signal(const struct parallel_processes_for_signal *pp_sig,
> +				 int signo)
> +{
> +	kill_children(pp_sig->pp, pp_sig->opts, signo);

...this pp_sig is always NULL...

> +}
> +
> +static struct parallel_processes_for_signal *pp_for_signal;
>  
>  static void handle_children_on_signal(int signo)
>  {
> -	kill_children(pp_for_signal, signo);
> +	kill_children_signal(pp_for_signal, signo);
>  	sigchain_pop(signo);
>  	raise(signo);
>  }
>  
>  static void pp_init(struct parallel_processes *pp,
> -		    const struct run_process_parallel_opts *opts)
> +		    const struct run_process_parallel_opts *opts,
> +		    struct parallel_processes_for_signal *pp_sig)
>  {
>  	const size_t n = opts->processes;
>  
> @@ -1559,7 +1572,8 @@ static void pp_init(struct parallel_processes *pp,
>  		}
>  	}
>  
> -	pp_for_signal = pp;

...because this removal has no corresponding addition...

> +	pp_sig->pp = pp;
> +	pp_sig->opts = opts;

...there's a missing:

	pp_for_signal = pp_sig;

Here, sorry!

Junio: If you do pick up this re-roll please just peel off this 22/22.