Repository navigation
WIP: fix(jobs): disown -r deletes/marks only running jobs (#2496) - #2505
Merged
Merged
Conversation
caomengxuan666
changed the base branch from
fix/2488-2489-job-warnings
to
master
November 1, 2026 18:07
GNU delete_all_jobs (running_only) (jobs.c:5066) deletes a job only when running_only == 0 || ISRUNNING (job) (jobs.c:5091), after clearing the current/previous markers (jobs.c:5078-5079); nohup_all_jobs (jobs.c:5111) applies the same JRUNNING filter to the `disown -h` marking arm. The executor's All arm ignored running_only and cleared / marked the whole table (cluster E REPORT section 5). - disown -r now deletes only Running jobs, with the same child/fd cleanup as per-spec disown so deleted pids stop being waitable children (DEL_NOBGPID parity); stopped and completed jobs survive, and the current/previous markers are cleared like GNU (JobTable::clear_current_markers). - disown -h -r marks only Running jobs. - The plain arm is unchanged: E's #2489 warning loop and the full clear_jobs stay byte-identical. New pins tests/issue2496_disown_r_set.rs (8 tests), every shape byte-compared against GNU bash 5.3.20; issue2488 (3/3) and issue2489 (6/6) pins stay green. Refs #2496
caomengxuan666
force-pushed
the
fix/2496-disown-r-set
branch
from
November 1, 2026 18:09
21f45df to
847b423
Compare
caomengxuan666
marked this pull request as ready for review
November 1, 2026 18:30
Member
Author
|
[win-acceptance] #2505 PASS — pin Environment: Windows 10 19045 real machine, MSVC Rust debug build of master 9348b8d (contains this merge). No BLOCKER. |
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.
Refs #2496
disown -rdeleted (anddisown -h -rmarked) the WHOLE job table. GNU restricts both arms to running jobs — cluster E found this while pinning #2488/#2489 (its REPORT §5); this PR is the follow-up cluster F fix, stacked on E's branch.GNU semantics (bash 5.3 sources)
delete_all_jobs (running_only)(jobs.c:5066): a job is deleted only whenrunning_only == 0 || ISRUNNING (job)(jobs.c:5091). Before the sweep it clears the current/previous markers (js.j_current = js.j_previous = NO_JOB, jobs.c:5078-5079), and deletion goes throughdelete_jobwithDEL_NOBGPID— a deleted job's pid stops being a waitable child.nohup_all_jobs (running_only)(jobs.c:5111): same JRUNNING filter for the-hmarking arm.-r, never raises the DEL_WARNSTOPPED warning there, and keeps answeringwait %n(147 + the wait_for_job warning) andfg %n.Change
execute_disownAll arm,running_onlydelete branch: collect Running-state job ids, remove each with the same child/fd cleanup the per-spec paths use (background_childrendrop, coproc endpoints, fd table), thenremove_job(purges pid map + retained statuses, DEL_NOBGPID parity); afterwards clear the table's current/previous markers like jobs.c:5078-5079. New helperJobTable::clear_current_markers.nohup_onlyarm: withrunning_only, only Running jobs get the nohup mark.-r) arm is untouched — E's shell exit with a stopped job misses GNU's 'deleting stopped job' warning #2489 warning loop and fullclear_jobsare byte-identical, so no warning behavior changes.Verification
tests/issue2496_disown_r_set.rs— 8 tests, 8/8 green under the scrubbed-fd runner (logs in the cluster workdir). Every shape was byte-compared against the GNU bash 5.3.20 oracle binary (identical modulo pid values): list shape incl. marker clearing, stopped survivor waitable (147 → CONT → 0) and fg-able, deleted running pid →wait127 "not a child", completed job kept,-h -rlists unchanged, sole-running-job table emptying,disown -aguard.Donelisting line is racy across identical runs, and-h -r's marking scope is observable only on the interactive hangup path — the pin covers the deterministic subsets; both behaviors follow the jobs.c state condition/filter in code.cargo checkclean; per-file rustfmt applied.Base / landing
Base is E's branch
fix/2488-2489-job-warnings(PR #2494) because the fix builds on therunning_onlyplumbing E added to the disown parser — do not merge before #2494. After E lands, the captain rebases this branch onto master and readies the PR.Residual (not this issue; for the captain's ledger)
Adjacent wait face found while shaping the pins, reproducible WITHOUT any disown:
set -m; sleep 30 & p=$!; kill -STOP $p; <poll>; kill -CONT $p; kill -KILL $p; wait $p→ GNU returns 147 silently (recorded stop status), rubash returns 137 and prints theKilledjob notice — rubash's wait observes live reap state where GNU answers from the last waitchld-recorded state (the deferred job-state family). Details in the cluster REPORT.