[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: why is the pipeline_pgrp reset to 0 only when the pipeline_pgrp and
From: |
alex xmb ratchev |
Subject: |
Re: why is the pipeline_pgrp reset to 0 only when the pipeline_pgrp and shell_pgrp are different |
Date: |
Wed, 15 Mar 2023 16:03:22 +0100 |
im not related , but , you sent & nbsp ; html containing
send file
On Wed, Mar 15, 2023, 3:42 PM wang yuhang via <help-bash@gnu.org> wrote:
> Hello
>
> I use the fork bomb to start the process. When the number of processes
> reaches the maximum limit with command "ulimit -u". In bash version 5.1,
> function terminate_current_pipeline does not send sigterm signal, just
> because pipeline_ pgrp is the same with shell_pgrp.
>
>
> I found bash-5.1 the following difference compared with bash-5.0
> ```
> +jobs.c
> + - {start,stop}_pipeline: don't reset pipeline_pgrp to 0 if it's
> already
> + the same as shell_pgrp, since we don't want to reset it in
> the middle
> + of a shell started to run a command or process substitution
> (after
> + forking a child to run one command, but before forking
> another, for
> + instance). Reported by Rob Landley <rob@landley.net>
> ```
>
>
> ```
> diff --git a/jobs.c b/jobs.c
> index b791900..f98e2e6 100644
> --- a/jobs.c
> +++ b/jobs.c
> @@ -519,7 +519,12 @@ start_pipeline ()
> if (the_pipeline)
> {
> cleanup_the_pipeline ();
> - pipeline_pgrp = 0;
> + /* If job_control == 0, pipeline_pgrp will always be
> equal to shell_pgrp;
> + if job_control != 0, pipeline_pgrp == shell_pgrp for command and
> + process substitution, in which case we want it to be the same as
> + shell_pgrp for the lifetime of this shell instance. */
> + if (pipeline_pgrp != shell_pgrp)
> + pipeline_pgrp = 0;
> #if defined (PGRP_PIPE)
> sh_closepipe (pgrp_pipe);
> #endif
> @@ -632,7 +637,8 @@ stop_pipeline (async, deferred)
>
> the_pipeline = (PROCESS *)NULL;
> newjob->pgrp = pipeline_pgrp;
> - pipeline_pgrp = 0;
> + if (pipeline_pgrp != shell_pgrp)
> + pipeline_pgrp = 0;
>
> newjob->flags = 0;
> if (pipefail_opt)
>
> ```
>
>
> I'm sorry I can't find the original issue. Could you tell me why is the
> pipeline_pgrp reset to 0 only when the pipeline_pgrp and shell_pgrp are
> different?
>
>
> Thanks !