help-bash
[Top][All Lists]
Advanced

[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: Chet Ramey
Subject: Re: why is the pipeline_pgrp reset to 0 only when the pipeline_pgrp and shell_pgrp are different
Date: Mon, 20 Mar 2023 10:43:57 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.8.0

On 3/15/23 10:20 AM, wang yuhang via 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.

Because you don't want SIGTERM to kill the entire script.

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? 

The comment seems pretty self-explanatory.

/* 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 you reset pipeline_pgrp to 0, the job control code will set up a new job
with a new process group -- the pgrp of the first child. If job control is
not active, you don't want new process groups. If job control is active,
you don't want command and process substitutions to be in separate process
groups from the rest of the pipeline.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/




reply via email to

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