Skip to content

WIP: fix(jobs): stopped-job warning faces — wait jobspec-only, disown deleting-stopped (Refs #2488, #2489) - #2494

Merged
caomengxuan666 merged 3 commits into
masterfrom
fix/2488-2489-job-warnings
Nov 1, 2026
Merged

caomengxuan666 merged 3 commits into
masterfrom
fix/2488-2489-job-warnings

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

修复簇 E:r46 裁决在冻结 master 上新炸出的 jobs 警告面两条(进 1.5.0 发布门)。

#2488(多打) wait $pid 对已停止作业多打 warning: wait_for_job: job 1 is stopped。GNU 门控是词法的:wait builtin 只有 %... jobspec 操作数走 wait_for_job(builtins/wait.def:316 → jobs.c:3409-3410 才警告),数字 pid 走 wait_for_single_pid(wait.def:277;jobs.c:2729)静默返回 147。rubash 三个渲染点一律改为按操作数形态门控(多操作数路径逐个操作数判),状态值不动。钉 issue2488 3/3(jr09 原形 + % 形保留警告 + 混合操作数两种顺序各只响一声)。

#2489(漏打) disown 删除已停止作业时漏打 warning: deleting stopped job %d with process group %ld。GNU 门控在 jobs.c:1495-1496 delete_job:调用方带 DEL_WARNSTOPPED + 作业处于 STOPPED + subshell_environment == 0。disown 的全部删除路径都带此旗(jobs.def 单个 delete_job (job, 1);jobs.c:5091 delete_all_jobs 管 -a),故 spec 形、pid 形、裸 disown(当前作业)、-a 逐条补警告;-r 按 GNU delete_all_jobs(running_only) 语义不报(解析层新区分 -a/-r 并透传 running_only)。普通脚本退出不是 delete_job 路径,GNU 实测不警告——钉里留了负向守卫防误加。钉 issue2489 6/6。

相邻存量钉复跑:issue1304 5/5、issue1048_1256 1/1。本地 cargo check 干净;两钉均 scrubbed 跑。REPORT 在簇目录(主会话留存)。

Refs #2488
Refs #2489

GNU's wait_for_job stopped warning (jobs.c:3409-3410) is reachable
from the wait builtin only through the jobspec path
(builtins/wait.def:316). A numeric pid goes to wait_for_single_pid
(wait.def:277; jobs.c:2729), which returns the stop status 147
silently. rubash rendered the warning on every operand form; gate
all three render sites on the operand being a %-jobspec, per
operand in the multi-operand dispatcher. Statuses are unchanged.

Refs #2488
GNU delete_job warns 'deleting stopped job %d with process group
%ld' (jobs.c:1495-1496) only when the caller passes DEL_WARNSTOPPED,
the job is stopped, and subshell_environment == 0. Every disown
deletion carries the flag (builtins/jobs.def: delete_job (job, 1)
per spec; jobs.c:5091 delete_all_jobs for -a), so add the report to
rubash's spec/pid/current-job disown paths and, per stopped job in
slot order, to disown -a. The parser now keeps -a and -r apart and
threads running_only through (jobs.def: delete_all_jobs takes the
-r flag as its argument): disown -r reports nothing, matching GNU.
Plain shell exit is not a delete_job path and stays silent, as a
negative pin records.

Refs #2489
@caomengxuan666
caomengxuan666 marked this pull request as ready for review November 1, 2026 17:29
@caomengxuan666
caomengxuan666 merged commit 6f27091 into master Nov 1, 2026
11 checks passed
@caomengxuan666
caomengxuan666 deleted the fix/2488-2489-job-warnings branch November 2, 2026 01:10
@caomengxuan666

Copy link
Copy Markdown
Member Author

[win-acceptance] #2494 PASS — both pins (issue2488_wait_stopped_warning_regressions, issue2489_disown_stopped_warning_regressions) are #![cfg(unix)] (0 tests on Windows by design); live probes on Windows are byte-identical to WSL GNU Bash 5.3.20 (stdout+stderr+rc, pids normalized): jr09 shape (set -m; sleep 2&; kill -STOP; wait $pid → no wait_for_job warning, waitrc=147, then killrc=143) and disown-deletes-stopped shape (warning line present, pid normalized) both IDENTICAL — probes D:/repo/win-accept/wave2/probes/p2488., p2489..

Environment: Windows 10 19045 real machine, MSVC Rust debug build of master 9348b8d (contains this merge). No BLOCKER.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant