Repository navigation
test(3051): pin PTY byte-level ^D EOF deferral with stopped jobs (Refs #3051) - #3110
Merged
Merged
Conversation
…#3051) GNU: parse.y handle_eof_input_unit rolls this/last with exit_builtin and runs the same exit_builtin, so a ^D at an empty prompt defers on stopped jobs (builtins/exit.def:100-131) and the next ^D exits at once. Rubash's byte-level ^D path (apply_edit_char -> EditOutcome::Eof) sets eof directly with no job scan, so the shell exits immediately. Pins: ^D once defers (banner + child alive), ^D twice exits on the second, ^D with no jobs exits at once (control), piped-stdin EOF with a stopped job still defers exactly once (#2397 control). Fail-first on base 1c132f6: 2 passed / 2 failed.
…ferral (Refs #3051) PTY byte-level ^D on an empty buffer ended the session at once even with stopped jobs: the three EditOutcome::Eof consumers in run_interactive_stdin (Windows RawConsole branch, Unix tty branch, cooked-line chars loop) set eof=true without consulting the job table, while the piped/script Ok(0) and Err arms already defer via Executor::defer_interactive_eof_for_jobs (rubash#2397). GNU's handle_eof_input_unit runs the same exit_builtin for every EOF (parse.y:516-523, 6973; builtins/exit.def:59-62 echo first, then exit_or_logout checks STOPPED jobs; the deferral pins this/last to Exit so the next EOF is immediate). Route all three byte-level EOF sites through the same deferral; hangup EOFs (rubash#2233) and the nonempty-buffer accept-line shape still fold at once.
This was referenced Nov 8, 2026
caomengxuan666
marked this pull request as ready for review
November 10, 2026 03:56
caomengxuan666
added a commit
that referenced
this pull request
Nov 11, 2026
第二波钉先行 J1 组(#2340 #2697 #2769 #2777):修法面被在飞 PR #3110(#3051,jobs/table 同面)占着,本 PR 只落钉 + 根因/修法设计(车道 REPORT),不写产品代码。门开后修法车道按 REPORT 设计动。 Refs #2697 — tests/issue2697_subshell_member_death_notice_regressions.rs(5 格):前台子 shell 成员被 SIGXFSZ 杀死时期望裸成员文本(通知由子 shell 自身作业表视角打印);exec 形与后台子 shell 作业两控制格期望整段子 shell 文本。 Refs #2769 — tests/issue2769_death_notice_line_stamp_regressions.rs(5 格):边界通知行戳 = 读位置行(下一命令行 / EOF 末行 +1 / 多行复合的终点行);前台通知格守即时打印方向(戳死亡命令本行)。 Refs #2777 — tests/issue2777_stopped_job_state_regressions.rs(7 格):深审 B4 原会话(kill -STOP $! 后立即 exit)期望 "There are stopped jobs.";含 jobs 列表状态格、STOP→CONT 链路格、TSTP 形、PTY 无观察点格、脚本模式控制格(GNU 脚本内显 Running,防过修)。 Refs #2340 — 已由 56dc41a 修复且钉已在仓(tests/issue2340_wait_job_retention_regressions.rs,9 格),本 PR 不含 #2340 新钉;本车道在基底上复跑既有钉存证,供关单裁决。 期望值全部以 GNU bash 5.3.20 oracle 脚本文件实测为准(2026-11-09);fail-first 逐格结果见车道 REPORT。 ## 本 PR 删除了什么 无(纯测试新增)。净行数 +960 行(3 个新测试文件),未删除任何文件或代码。 ## 队长复核附记(rebase 轮,2026-11-11) PR #3319(Refs #2340 的修法本体)合入 master(71de8b76)后,本 PR 头 c2a5ab1 与现 master 的组合头(eca5e5ca,合并无冲突、产品面与 master 逐字同)上四茎复跑,卷宗 review-3180-rebase/CAPTAIN-VERIFY.md: - issue2340 茎 9/9 四连绿;窗口强制探针(%1 于 0.3s 处杀 %2、死亡落在 wait 阻塞期内)组合头 5/5 输出 done 1、与 GNU oracle 5/5 同形,基底 0/5。基底茎采样另见 survivor 删除签名三形(8/1、6/3、8/1)。 - issue2697 茎双边皆 1 过 4 红、红名集与登记四名逐字同;issue2777 茎组合头 5 过 2 红两轮(登记两名,皆红于 kill 后 wait 状态 W 断言),整茎约 16.4 秒有界完成;issue2769 茎双边皆 2 过 3 红,eof 格经多采样裁定为 EOF 死亡通知的出现竞速(失败原文为通知缺席、戳值恒对,GNU 同构造 40/40 确定),属既存产品面、非本轮引入。 - lib 组合头 1243 过 0 败 4 忽略、基底 1206 过 0 败 4 忽略,失败名集双边差为空;fmt、全树 UTF-8 卫生、marker-lint 皆 rc=0;RUSTFLAGS 带 -D warnings 的 lib 与 bins 检查 rc=0(带旗痕迹亲核),四茎逐个 scoped 同旗检查 rc=0;全树 tests 同旗检查的红仅在 master 既存 tests 警告族(issue2584、issue2514 两文件,不在本 PR diff 内)。 - 本 PR 合入后,#2340 由队长以证据评论另行处置;#2697、#2769、#2777 保持开启,钉即其 fail-first 证据。
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 #3051
根因
交互 PTY 下的字节级 ^D(
apply_edit_char在空缓冲上见\x04→EditOutcome::Eof)在run_interactive_stdin(src/script_driver.rs)的三处消费点直接置eof = true,根本不查作业表:Unix tty 分支、Windows RawConsole 分支、cooked-line 字符循环。共享的 EOF deferral(Executor::defer_interactive_eof_for_jobs)只挂在管道/脚本Ok(0)与Err两臂上(#2397),所以有 stopped 作业时 ^D 直接退出。GNU 侧:^D 在空提示行即 EOF 单输入单元——parse.y:516-523(
yacc_EOF动作)调handle_eof_input_unit()(parse.y:6973),其 roll this/last 为exit_builtin并跑同一exit_builtin;builtins/exit.def:100-131exit_or_logout扫 live 作业表:有 STOPPED(checkjobs开时 RUNNING 也算)即 stderr 报There are stopped jobs.(+ 列表),pin this/last 为 exit_builtin,返 EXECUTION_FAILURE 拒绝退出;下一次 ^D/exit因exit_immediate_okay立即退出。修法(已落实,
0d3badef)defer_interactive_eof_for_jobs();defer 则继续读(下一 EOF 因 pin 住的 Exit 类立即退出),否则按原路置eof。echo 顺序与 GNU 一致:exit/logout先打(exit.def:59-62),再查作业表。Ok(0)/Err两臂([bug] 交互退出时作业保护缺失:checkjobs 运行作业不延迟、停止作业恒不保护 #2397 已绿)、存储形态、src/lexer/continuation.rs、docs/api-ledger.md。单文件src/script_driver.rs,+51/−4。队长复核前自验(车道自跑)
issue3051_pty_eof_deferral,15.67s;脚本内重跑 5.62s)ctrl_d_once_*与ctrl_d_twice_*红,两个对照形绿;基底1c132f68干净 worktree 移植,25.30s)api::consumer_tests(issue822 winsize + 4× GAP-13)与fd::unix spawn_whitelisted,基底 2 个为builtins::kill(handshake nonce + pdeathsig)——均为时序/全局态敏感形,与本修法面(script_driver EOF)无交。孤立重跑裁决:8/8 通过(头 6 格 + 基底 2 格各 1/0),全量 lib 两跑的失败均为负载下时序 flake,无一为本修引入(见 REPORT §5)。RUSTFLAGS="-D warnings":cargo check --locked --lib --binsrc=0,无警告cargo fmt --checkrc=0;marker-lint OK(117 registry consts, 265 allowlisted sites);utf8-boundary hygiene clean;api-ledger 281 symbols 全在;CR 计数 0\x04形:GNU 与修复后 rubash 均exit+There are stopped jobs.+ 次 EOF 退出,逐字节同形(除 rubash 沿用既有 raw 回显多一个\x04字节)。UNVERIFIED-BY-CAPTAIN
本 PR 删除了什么
无(钉文件新增;修法为三处 Eof 消费点加同一 deferral 调用,无文件/函数/行为删除)。