Repository navigation
WIP: #2287 background-pipeline pgrp — no-repro evidence + guard pins (no product change) - #2288
Merged
Merged
Conversation
caomengxuan666
commented
Oct 30, 2026
Member
) Investigation result: the #2287 claim does not reproduce on master. The issue's grep premise is literally true (pipeline_exec.rs has no setpgid), but its behavioral conclusion does not follow in rubash's architecture: a background pipeline's job is the grouped background wrapper wired by #2251 (spawn_whitelisted new_process_group under monitor mode), and every pipeline stage is a child of that wrapper inheriting its group. The recorded pgrp (wrapper pid, `jobs -p`) is a real, populated kernel group, so hangup_all_jobs' killpg and `kill -- -<pgrp>` deliver to every stage. Probed on a master-equivalent build against GNU bash 5.3.20, three independent paths, same outcomes both shells: - login route (pty, --login -i): set -m + shopt -s huponexit, `sleep N | cat &`, exit -> wrapper and both stages die; without huponexit all survive (control). - script route: set -m, `kill -HUP -- -$(jobs -p)` -> killpg rc=0, both stages die. - /proc membership: stages' pgid == recorded pgrp == wrapper pid. GNU spec (for the record): jobs.c:2265 make_child — child-side setpgid(mypid, pipeline_pgrp) at jobs.c:2390, pipeline_pgrp set to the first child's pid at jobs.c:2372, parent repeats setpgid(pid, pipeline_pgrp) parent-side (~jobs.c:2455, errors ignored), job pgrp recorded at jobs.c:649; jobs.c:1783 hangup_all_jobs killpg's jobs[i]->pgrp; shell.c:1017 is the huponexit exit path. GNU reaches the observable contract by grouping the shell's direct children; rubash reaches it through the wrapper group. No product code changes: grouping pipeline_exec stage spawns per the GNU in-shell model would move stages OUT of the group that reaches them today — foreground stages would leave the tty's foreground group (rubash performs no tcsetpgrp handoff, so SIGINT/SIGTSTP/SIGTTIN delivery would break), and background stages would leave the wrapper's group so hangup_all_jobs' killpg(wrapper pgrp) would miss them, creating the alleged failure. These pins lock the invariant at the /proc level (membership, killpg delivery by the recorded pgrp, and a no-monitor control asserting nothing is grouped without job control) so a future refactor that detaches stages from the job's group fails here. Refs #2287
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.