Skip to content

fix(redir): materialize undo-save slot saturation EMFILE diagnostics (Fixes #4043) - #4057

Merged
caomengxuan666 merged 240 commits into
masterfrom
fix/4043-exec-walk-emfile
Nov 30, 2026
Merged

caomengxuan666 merged 240 commits into
masterfrom
fix/4043-exec-walk-emfile

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

Fixes #4043.

Summary

  • Materialized/checked undo-save slot allocation under ulimit -n fd-table saturation (base -> 10 -> 0 fallback) matching GNU redir.c:1296-1316 (add_undo_redirect) and redir.c:123-132 (REDIRECTION_ERROR -> EMFILE):
    • src/executor/trap_exec.rs: added try_fd_walk_undo_save_slots, try_fd_walk_register_saves, undo_save_error_target_name, and updated execute_stdio_only_exec_redirect_inner to emit GNU's two-line EMFILE diagnostic (redirection error: cannot duplicate fd: Too many open files + <target>: Too many open files, rc=1).
    • src/executor/redirection.rs, src/executor/command_dispatch.rs, src/executor/command_prepare.rs, src/executor/pipeline_exec.rs: gated undo-save EMFILE checks on undoable_walk in reject_invalid_redirects.
    • src/executor/command_input_scope.rs: updated compound_dup_bad_fd and abandon_compound_for_dup_bad_fd to detect undo-save EMFILE on undoable compound walks.
  • Added regression suite tests/issue4043_exec_walk_emfile.rs (6 tests).

Verification

  • rustfmt --edition 2021 --check passed on all 7 modified/added files.
  • cargo test --test issue4043_exec_walk_emfile --test issue4024_exec_walk_save_stdio_source --test issue4024_exec_walk_save_stdio_graft: 6/6 + 7/7 + 8/8 passed.

…n diagnostics (rubash#4029) (#4039)

Captain graft onto 54aef43: reconciled with #4025 (rubash#3543) — the raw channel names which word is cited; bad_substitution_display decides how a parser word's comsub spans print (canonicalized), runtime text stays raw. Prompt-string passes now suppress the outer parser word's raw record.
… trailing separator (Fixes #4017) (#4026)

* fix(funsub): accept compound-command-terminated funsub bodies without trailing separator (Fixes #4017)

* chore(funsub): reword tokstr comments to dodge the comment-blind registry scan

The registry consistency test's claim_literals scan is comment-blind and extracted a shadow claim for `{` from the `== "{"` shape in five single-line comment copies (command_substitution.rs, embedded_mutations.rs, alias_stream.rs, skip.rs x2). Reworded to `is the single-char "{"` -- comment text only, zero behavior change. Captain review-4026 section 2.
…ialize comsub2 (Refs #4038)

Per-slice split of the goldens snapshot test so one slice's mismatch no longer masks later slices; comsub2 serialized via the existing heavy_lock. Refs #4038 (the slice nondeterminism itself remains open there).
@caomengxuan666

Copy link
Copy Markdown
Member Author

CAPTAIN REVIEW — not mergeable in current form; the direction has since been superseded, see the decision at the end.

Hard gaps in the current form:

  • CI: zero workflow runs on the head, and mergeable=CONFLICTING against current master. No name-set differential is possible — and the slot fallback-order change (base → 10 → 0) affects every walk, exactly the surface the issue3991/4024/4033/4041/4042 pins are sensitive to, so CI evidence is not optional here.
  • Oracle: the body carries no oracle evidence. The first diagnostic line matches the GNU text quoted in the issue, but the second line in full, the close shape's target name (currently hardcoded "0"), and the open-preoccupation shape have no GNU-side evidence.
  • Coverage inconsistency: call sites still on the infallible wrapper keep silently dropping saves at saturation (including the ordered walk consumed next to fix(redir): preserve undo-saved source bindings against same-walk persist move closes (Fixes #4027) #4041's persist guard), and the pipeline stage is explicitly excluded without a GNU basis — the same saturation yields EMFILE on some shapes and silence on others.

Direction decision: the captain's debt-paydown plan has fixed the fd direction as completing real descriptor materialization and retiring the symbolic walk simulation layer. #4043 is to be redone along that line. This PR's model-layer approach — making the model's occupancy set failable and synthesizing the diagnostic — is not the direction that will be merged, independent of the open fidelity question (model saturation ≡ kernel saturation is unproven in the window where the process holds descriptors the model doesn't track).

So: please either redo #4043 on the materialization direction, or align the design with the captain before investing more in this branch. If you take it on, the gates are: rebase + fresh CI with a clean name-set differential, a cloud GNU 5.3.20 oracle matrix (saturation original + the 6 pin shapes + close-shape second line + partial-table slot placement), and fail-first on pristine (expected 5 red / 1 guard green).

…cts (Refs #3969) (#4020)

Captain graft on top of the original PR head (rebased to master 38fdd99): the brace-product bad-substitution verdict is latched with a discard-only class marker (ShellState.bad_substitution_discard_only), so the generic latch consumers no longer promote it to FORCE_EOF under POSIX mode. GNU returns &expand_wdesc_error for expand_word_internal's backquote case in every mode (subst.c:11568-11593) - under the argv[0] `sh` name the un-grafted head aborted the whole script (exit 1, -c exit 127) where GNU-as-sh discards the command and continues (exit 0, -c exit 1). The ${...} class keeps its FORCE_EOF semantics. Adds sh-name regression pins (script-file and -c forms) to tests/issue3969_brace_backquote_rescan_regressions.rs.
…(Refs #3994)

execute_empty_words_command never routed through
command_with_process_substitution_files, so a parser-recorded
<(...) / >(...) redirect target on a command-less assignment
reached the redirect apply layer as literal text and was probed
as a filesystem path: `x=1 < <(sleep 1)` reported
`<(sleep 1): No such file or directory` and failed, where GNU
(execute_null_command -> do_redirections over the same list;
redirection_expand, redir.c:298) silently succeeds.

The wrapper admits exactly the redirects the materialization
arms themselves admit (redirect_target_span_is_recorded,
rubash#1931 — a quoted "<(cmd)" stays a literal filename),
materializes through the same function, and finishes through
the same finish_process_substitutions with the materialized
paths' completion convention (inner Err governs, finish runs
best-effort; on inner Ok the finish result governs).

What this PR deletes: nothing. The former
execute_empty_words_command body is renamed
execute_empty_words_command_inner unchanged; the wrapper is the
only new code.

UNVERIFIED-BY-CAPTAIN
caomengxuan666 and others added 27 commits November 29, 2026 02:54
…rd position (Refs #4273) (#4277)

* fix(exec): quoted "$*" joins with IFS[0] under a null IFS in every word position (Refs #4273)

* fix(exec): quoted "$*" joins with IFS[0] under a null IFS in every word position (Refs #4273)

Refs #4273 (not Fixes).

v2: fixes the issue2827 regression introduced by v1. A fully
double-quoted assignment-shaped conditional operand
([[ "k0=v0" =~ ^k0=(v[0-9]+)$ ]]) failed to match: the
STORAGE-prefixed word was claimed by expand_marked_or_special_word
before expand_assignment_word, leaving the lexer's 0x1C IFS_GLUE
(QUOTED_WORD_VALUE_PREFIX) in the comparison value. The fix records a
`marked` flag in expand_conditional_word_inner and strips the glue
with markers::strip_ifs_glue for marked words after expansion
(conditional words are comparison values with no field-split consumer
downstream); unmarked words keep the old path.

Re-verification (devin-mac): issue2827_regex_compile_cache 5/5,
issue4273 pins 5/5, issues_4200_4299 33/33; oracle (bash 5.3.20)
25/27 verbatim, the 2 diffs being pre-existing residual (a)
(CTLESC affix leak, same shape on base).
…r set -f (Refs #4272)

Refs #4272 (not Fixes).

gen_globpat_matches (pcomplete.c) hands the -G pattern straight to
glob_filename; the subst.c word-expansion admission gates never
apply. rubash routed compgen through pathname_expand_word, whose
gates dropped two faces: a pattern without unquoted metacharacters
never produced a result (glob_vector's stat fast path returns the
dequoted literal when the file exists), and under `set -f` every
-G pattern returned nothing (noglob is a glob_expand_word_list
check, not a glob.c one).

Add compgen_globpat_expand_word in glob.rs: the same machinery as
pathname_expand_word with the word-expansion gates (empty word,
byte whitelist, noglob, whole-word unquoted_glob_pattern_p)
skipped; glob.c's per-component glob_pattern_p admission decides
instead. Both compgen call sites in complete.rs (the builtin and
the compspec completion attempt) use it. Ordinary expansion is
untouched: `set -f` still suppresses echo fi*, nullglob/failglob
keep their word-list behavior, and neither leaks into compgen.

Pins: tests/issues_4200_4299/issue4272_compgen_globpat_literal_
and_noglob.rs (5 tests: literal face incl. escapes/trailing
slash/absolute/nonexistent, noglob face + expansion guard, empty
pattern, invalid bracket + prefix filter, nullglob/failglob
neutrality). Oracle-verified against bash 5.3.20 on every case.
fix(complete): compgen -G returns literal-path matches and globs under set -f (Refs #4272)
…stderr redirects

Test-only. The reported bug (arithmetic eval error diagnostics bypass
the calling function's stderr redirect) does not reproduce on master
60ed70e: 32 probe scripts on macOS run byte-identical against the
GNU bash 5.3.20 oracle, including the nested-caller DISCARD face.
Adds 6 regression pins so the face stays covered.

Refs #4254 (not Fixes).
Test-only. All twelve case-syntax-error forms (c01-c12) on master
60ed70e are byte-identical with the GNU bash 5.3.20 oracle; the c01
fix noted on the issue holds and no adjacent face has a residual.
Adds 4 regression pins so the token selection cannot drift.

Refs #4227 (not Fixes).
…e chdir line

A shell born in a deleted cwd seeded its logical cwd as Some(""):
the empty adoption was stored as a live value. GNU keeps tcwd NULL
in that state, and the cd entry re-derivation gate
(get_working_directory "chdir", cd.def:529-534) is exactly
logical_cwd.is_none() -- mid-session poisoning (#3574) uses None and
prints the chdir: line, birth poisoning used Some("") and never did.
Both seeding points (Executor::new, in-process subshell seeding) now
store None for an empty adoption, sharing the single poisoned-state
representation. Healthy shells are unaffected (non-empty values are
identical). Adds 5 pins; fail-first verified on base.

Refs #4120 (not Fixes).
move_to_high_fd scanned downward from a shared ceiling for an empty
slot and then dup2'd into it: probe and dup2 were not atomic. Two
threads necessarily find the same first empty slot T; the second
dup2 atomically closes the first thread's descriptor, the first
Drop then closes the second thread's live descriptor, and the
second Drop's close hits EBADF -- the std debug-build IO Safety
abort of #4274. The hot trigger is file-redirect execution lazily
installing the cwd anchor (probe_output_redirect_file ->
output_fifo_validation_via_anchor), several moves per test pair in
lock-step threads. A process-level static Mutex now covers the
scan+dup2+close section (the HANDSHAKE_LOCK pattern); landing band,
cloexec and failure fallback are unchanged, and every caller
(capture pipes, signal relay, anchor refresh) is covered by the
single mechanism. Adds a barrier-synchronized regression pin that
aborts 10/10 on base and passes 20/20 with the fix.

Refs #4274 (not Fixes).
…lements

In a plain compound assignment, an element concatenating a $'...'
segment with another quoted segment had its decoded blank bytes
(tab, newline) replaced by spaces: f=('a'$'x\ty') stored 'ax y'
instead of 'ax<TAB>y'. The compound walker decodes $'...' and
re-wraps it in raw quotes with the U+E401 ANSI_C_IFS_GUARD marker
intact, but split_requoted_hoisted_compound_word had no arm for the
guard, so the guarded byte fell to the bare-IFS arm, was field-split
and re-joined with a space. GNU hands the decoded span back wrapped
by sh_single_quote (parse.y:5564-5571) and never splits it. A new
guard arm glues the guard and the following byte into the current
field (+16 lines, single mechanism). The issue's title forms were
already correct on master; 14 new pins cover them plus every
corrupting and control shape. Bucket 52/52.

Refs #4200 (not Fixes).
test(issue4254): pin arithmetic-error diagnostics following function stderr redirects
fix(fd): serialize move_to_high_fd's probe-and-dup2 under a process lock
test(issue4227): pin case-syntax-error token selection
fix(exec): entry-poisoned shells store no logical cwd so cd prints the chdir line
Fix compound-assignment field split of decoded $'…' blanks in mixed-quote elements (Refs #4200)
fix(glob,cond): protect full GNU glob-char class at [[ == ]] and pathname-glob boundaries (Fixes #4126)
…4288)

Convergence to GNU bash 5.3.20, not a regression. Both diffs were
verified byte-for-byte against the pristine 5.3.20 oracle and
current rubash (see lane-master-ci-red-2026-11-30.md):

- errors.snap: `ivar -3` (`${!1:-${1}}` with $1=`-3`) no longer
  outputs `-3`; GNU and current rubash both report bad substitution
  / invalid variable name with empty stdout. The old snapshot
  recorded the loose fallback (two lines, normal + `-o posix` runs
  of errors6.sub). Suspected engine change: 975af9c indirect
  expansion (2026-11-09) — not bisect-confirmed.
- exp.snap: six `$xxx""`-style concatenations (exp.tests:82-93)
  now keep one empty word (`argv[1] = <>`), matching GNU: a quoted
  empty string keeps the word, only a bare unquoted empty expansion
  is dropped. The old snapshot (recorded 10-26) dropped all six.
  Suspected engine change: 568dce3 word-walk / quoted-result IFS
  protection (2026-11-03) — not bisect-confirmed.

Bytes are the runner-true recording from the goldens job of master
run 46312294455 (artifact regression-snapshots.zip, ID 15330985687),
recorded with RUBASH_REGRESSION_RECORD=1 per the re-record protocol
in tests/regression.rs; the other 11 snapshots in that artifact are
byte-identical to the committed ones. The snapshot tests are
#[cfg(windows)], so the recording could not be reproduced on the
macOS lane host; the artifact is the protocol-prescribed source.

Refs #4288 (not Fixes).
…11-30

test(regression): re-record errors/exp upstream-suite snapshots (Refs #4288)
…k (Refs #4288)

Refs #4288 (not Fixes).

A background death observed by an intervening foreground wait
was printed at the wait builtin's own reader boundary, and the
boundary emit's cleanup retired the job but also populated
the #2777 retained link (completed_job_pids) -- so
`kill -KILL %1; sleep 0.3; wait %1` answered 137 from the
link where GNU answers 127 + `no such job`. GNU's pull-driven
notify_and_cleanup (parse.y shell_getc) deletes the row in
the same pass it prints the notice; no jobspec record
survives for the list being read.

Give the cleanup a no-link form and use it for exactly the
reader-boundary pass: cleanup_dead_jobs delegates to a shared
cleanup_dead_jobs_impl(retain_link); the boundary report
(report_pending_signal_notices_at_line, the #2928 stamped
flush) routes through a new report_pending_signal_notices_
no_link / emit_signal_notices_with_link pair. Print timing,
stamps, marking, and deletion are unchanged -- only the
link insert is skipped. Mid-list retirements (the `jobs`
builtin's notify, a wait's own tail cleanup, the stream-end
flush) keep the link: there a following wait in the same
list is the reap's peer (#2777 cells).

Net lines: +50/-3 (2 production files; no test files -- the
pin already exists and was red on master). Nothing deleted:
the link mechanism stays for its mid-list domain; the
boundary pass now uses the same single cleanup impl with
the record left unpopulated, so there is no second path.
fix(jobs): reader-boundary notice pass retires without a retained link (Refs #4288)
#4203) (#4287)

* fix(redir): redirection_error diagnostics honor gnu_errfmt via error_prefix (Refs #1038, #4203)

* fix(coproc): gate redirect-word expansion errors on gnu_errfmt (round-1 rework, Refs #1038)
Generated with [Devin](https://devin.ai)

Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Bring the #4043 EMFILE undo-save work onto current master. The branch had
fallen behind two redirect-walk changes on master and had four conflicting
files; all four are resolved without dropping either side.

Conflicts and resolution:

1. src/executor/command_dispatch.rs
   Master (rubash#4036) moved the reject gate AFTER the xtrace head block
   (GNU execute_cmd.c:4648-4649 prints the head before do_redirections) and
   added a redirect-target pre-expand pass. Kept master's placement and
   pre-pass; moved the branch's `undoable_walk` computation to master's
   post-xtrace gate call site instead of the old pre-apply position.

2. src/executor/command_prepare.rs
   Same shape: kept master's `preexpand_redirect_targets` at the
   pre-binding point and threaded `undoable_walk` into the post-xtrace
   `reject_invalid_redirects` call (the branch's old call site no longer
   existed).

3. src/executor/trap_exec.rs
   Master renamed the `compound_dup_bad_fd` verdict flag from the branch's
   `is_emfile` to `cannot_duplicate` (rubash#4028/#4046). Kept master's
   naming for the move-undo verdict and carried the branch's new EMFILE
   verdict as a separate fourth tuple field.

4. src/executor/command_input_scope.rs
   `compound_dup_bad_fd` now returns `(index, name, cannot_duplicate,
   is_undo_save_emfile)`. `abandon_compound_for_dup_bad_fd` keeps master's
   `compound_redirect_error_prefix` routing and EBADF text verbatim, and
   gains an EMFILE arm. The branch's ad-hoc
   `subshell_command.is_none() && pipe.is_none() && pipeline_command.is_none()`
   undoable test is dropped in favor of master's shared
   `move_walk_is_undoable` (rubash#4046), so every redirect walk of one
   command agrees.

Also removes the now-dead `fd_walk_undo_save_slots` wrapper (its only
caller, `fd_walk_register_saves`, now delegates to the fallible
`try_fd_walk_register_saves`), keeping its documentation on the surviving
function.

GNU C source (third_party/bash, bash.git @9c465866, Bash-5.3 patch 20):

  redir.c:1296 add_undo_redirect()
    redir.c:1303-1310  save-slot ladder: fcntl(F_DUPFD) tries
                       (fdbase < SHELL_FD_BASE ? SHELL_FD_BASE : fdbase+1),
                       then SHELL_FD_BASE, then 0.
    redir.c:1312-1316  when every candidate fails, sys_error
                       "redirection error: cannot duplicate fd" and the
                       undo-save registration returns -1, failing the
                       redirection walk (errno EMFILE here).
  redir.c:223          internal_error ("%s: %s", filename, strerror(error))
                       is redirection_error's second line, so the same
                       failed entry reports "<target>: Too many open files"
                       (strerror(EMFILE)), not "Bad file descriptor".

Before this change rubash's `fd_walk_undo_save_slots` silently dropped a
save when `fd_walk_lowest_free` returned None, so an undoable walk
succeeded instead of failing EMFILE.

Verification:

  * cargo build --tests: 0 errors.
  * cargo test --test issue4043_exec_walk_emfile: 6 passed, 0 failed.
  * Neighbor suites unchanged vs pristine master (identical pass/fail
    counts AND identical failing-test sets):
      redirect   124 passed / 0 failed  (both trees)
      bad_fd      11 passed / 0 failed  (both trees)
      exec_walk   15 passed / 0 failed  (both trees)
      issue4028_move_fd10_bad_fd_diag   8 passed / 0 failed
      dup         26 passed / 8 failed  (both trees, same 8 tests)
      undo_save   14 passed / 15 failed (both trees)
    The dup/undo_save failures are pre-existing and environmental: those
    tests `cd <dir.display()>` with a Windows backslash path
    (`cd: C:UserscmxAppDataLocalTemp...`). Pristine master fails them
    identically. The same script bodies replayed with a POSIX cwd produce
    byte-identical output across GNU bash 5.3.20, this lane and pristine
    master.
  * GNU comparison from a script file
    (wsl /usr/local/bin/bash /mnt/d/repo/lanes-r/pr4043-probe.sh, 5.3.20):
    all six #4043 cases match byte-for-byte -- two-line EMFILE diagnostics,
    status 1, target named as source fd / 0 / expanded path, and the
    RX_ACTIVE-only subshell head still succeeding.
  * scripts/check-rustfmt.py: ok, 226 targets (2021: 226), 2 batches.

Fixes #4043
@caomengxuan666

Copy link
Copy Markdown
Member Author

复核结论:需要返工,不可合入

头 4be7c69f。先说新头是什么:这是一个 merge 提交(把分支并到当前 master),分支自有内容只有 7 文件、+505/−76,与正文所列一致、无无关混入;gh pr view 显示的 +58068/−22797、1952 文件是过期基线漂移。测试文件与旧头逐字相同。

4 个自带新 pin 在本 PR 自己的 census 里失败(6 测仅 2 绿),正文称本地 6/6 passed 与 CI(2/6)及 devin-mac 安静机实测(3/6)均不符。诊断面本身经 oracle 核对无误——6 条 pin 的期望与 GNU 5.3.20 逐字一致(见下),问题在实现只覆盖了 exec walk。

Census 差分

CI 除 census 外全绿(goldens、Rust tests、fmt、API ledger 均 PASS)。PR census 32 个 FAIL 名,master 同期 26 名;PR 多出 6 名:4× issue4043(自带 pin)+ 2× issue2340(已记录轮换族,本轮 master 未现)。其余 26 名与 master 逐名相同(#4291 烧掉的 24 茎在 master 上仍红,与本 PR 无关)。0 SIG。

4 个失败 pin(断言原文取自 CI 日志):

测试 期望 实际
issue4043_simple_builtin_dup_emfile_at_saturation rc=1、两行 EMFILE 诊断、hi 不执行 无诊断,hi 打印,rc=0
issue4043_exec_open_consumes_last_slot_then_save_emfile 两行诊断齐全 仅 /dev/null: Too many open files,无 dup 诊断行
issue4043_compound_dup_emfile_at_saturation rc=1、两行诊断 同 builtin:hi 打印,rc=0
issue4043_subshell_head_active_only_succeeds_at_saturation rc=0、stderr 严格等于 hi\n rc=0、hi 正确,但 stderr 另有 5× line 4: /dev/null: Too many open files 噪音

通过的 2 测:issue4043_exec_dup_emfile_at_saturation、issue4043_exec_close_emfile_at_saturation。

Oracle 核对:pin 的期望没错(GNU 5.3.20 同款探针,6/6 一致)

  • exec-dup / builtin-dup / compound-dup:rc=1 + redirection error: cannot duplicate fd: Too many open files + <target>: Too many open files(dup 面目标为 2、close 面为 0、open 面为 /dev/null);hi 不执行。
  • exec-open-last:两行诊断齐全(open 先占掉最后一槽、dup save 再失败)。
  • subshell-active:rc=0、stderr 严格 hi\n。
  • 关键对照:GNU 的填表循环 0 次失败;rubash 在 CI 上 5 次、devin-mac 上 1 次。

机制:exec 通、builtin/compound 不通的原因

  • exec walk(trap_exec.rs)有第二道防线:try_fd_walk_register_saves 失败报诊断,且其后真实 save 的 exec_walk_saved_entry 还有 Err 分支报诊断——所以 exec-dup、exec-close 通过。
  • gate(redirection.rs reject_invalid_redirects)与 compound preflight 只做模拟:fd_walk_occupied_set 的占用集仅来自虚拟 fd_table.entries,看不见进程在虚拟表之外持有的 OS fd,于是模拟认为仍有空槽、接受 save,真实应用 walk 走旧的静默丢弃路径(fd_walk_register_saves = try_...unwrap_or_default()),命令照常执行、rc=0。
  • 已核 fd_var_walk_undoable(command_execute.rs:2128)对 echo hi 1>&2 与 { echo hi; } 1>&2 均为 true——裁决为真、gate 确实跑到了,是占用模型看不见饱和,不是 verdict 算错。
  • 结论:[gnu-baseline] exec-walk save slots are not kernel-materialized at fd-table saturation — GNU EMFILE dup diagnostic cannot arise #4043 的本意(save 槽分配层饱和时内核物化并报 EMFILE)只在 exec walk 落地;builtin/compound walk 仍是旧的静默丢弃。正文「undoable walks(exec、builtins、compounds、functions)」的范围表述言过其实。
  • exec-open-last 与 subshell-active 是 fixture 面:填表循环的噪音是 rubash 进程自身的 fd 占用(平台相关:CI 5 次、mac 1 次、GNU 0 次)。exec-open-last 的「恰剩 1 槽」前提在 mac 上成立(该测在 mac 上通过)、在 CI 上不成立;subshell-active 的语义正确,只败在严格 stderr 断言被循环噪音污染。

返工清单

  1. 把 gate/compound 的 EMFILE 检查扎到真实 fd 表上(核心):fd_walk_occupied_set 的占用集须包含虚拟表之外的 OS fd(或在 gate 接受 claimed save 槽前用真实 dup 验证)。目标:builtin-dup 与 compound-dup 在饱和时像 GNU 一样 rc=1 + 两行诊断、hi 不执行。
  2. 修 pin 的饱和算术:填表循环改为按实际空闲槽数动态填满,或使断言容忍循环自身的 EMFILE 噪音(尤其 subshell-active 的严格 stderr 断言与 exec-open-last 的「恰剩 1 槽」前提)。不能靠 hardcode seq 3 31 假装 rubash 与 GNU 的 fd 占用相同。
  3. 修正 PR 正文:6/6 passed 与 CI 及安静机实测不符;收窄范围表述(目前仅 exec walk 真正报诊断);注明旧头未跑过 CI、无「曾经绿过」的基线。
  4. 重跑后 census 差分须回到 ⊆ 已知轮换集 + 0 SIG(issue2340 两测属轮换,无需修)。

未回归面

goldens PASS;#4032 p01–p13 矩阵与 issue3991 15 钉无失败名出现;其余 CI 腿全绿。PR 除自带 4 pin 外未引入新回归。

短板说明:旧头无 CI 可比对(分支上只有新头的 run),「merge 是否弄坏」无法用 CI 差分裁决;但测试文件新旧头逐字相同、失败签名与实现缺口一致指向实现问题而非 merge 损坏。rubash 多占 OS fd 的精确身份未完全拆清(glob 探针的 fd 3 含自身句柄),返工第 2 项不依赖此数精确。卷宗:lane-4057-rereview-2026-11-30.md。

@caomengxuan666
caomengxuan666 merged commit 3ef1895 into master Nov 30, 2026
12 of 13 checks passed
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.

[gnu-baseline] exec-walk save slots are not kernel-materialized at fd-table saturation — GNU EMFILE dup diagnostic cannot arise

2 participants