You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fd: redirect failure mid-list does not undo partial binds (GNU undo_partial_redirects) #3733
#3706 isolated the hazard and #3723 fixes it for group redirects: a scope save that only Rc-clones the userspace FdEntry, followed by a bind that retires the displaced kernel descriptor (retire_read_arm/retire_write_arm, #3213), followed by a restore that re-inserts the retired entry — the next spawn's pin pass then dup2's whatever recycled that kernel number onto the fd. GNU's undo save IS a kernel dup (fcntl (fd, F_DUPFD, SHELL_FD_BASE), redir.c:965/1082/1144; compound groups run do_redirections (..., RX_ACTIVE|RX_UNDOABLE), execute_cmd.c:854). Fix direction: snapshot via a kernel dup the way #3723 does (FdTable::saved_entry / FdEntry::dup_file_endpoints), never a bare clone.
Destination
Fix lane, same wave as #3723. The lane must first reproduce the divergence against GNU bash 5.3 with a fail-first regression pin (named with this issue), then fix by mechanism. Dispatch only after a fresh open-PR guard scan on the touched files.
Site
When a redirect list fails part-way, the numbered binders do not undo the binds already applied; GNU calls undo_partial_redirects (execute_cmd.c:855) so a failed redirect list leaves the fd table exactly as before. The #3723 fix's saved dups close cleanly via Drop (no leak), but the partial-bind restore itself is missing — a separate face from #3706, same area. Repro: a redirect list whose later element fails (e.g. N</nonexistent after an earlier successful bind in the same list) must leave the earlier fd untouched; GNU does, rubash keeps the partial bind.
Activity
caomengxuan666 commentedon Nov 17, 2026
【WIN-AGENT-AUDIT】续作完成 — 建议 PASS(待队长终审)
PR #3853(head
2dea6fe73,基底3d8c9ff8f)。根因:
open_compound_numbered_input_redirects(command_input_scope.rs)在_in出错时丢弃已累积的saved快照——输出侧 wrapper 本就 unwind,输入侧漏了。GNU 依据:undo_partial_redirects(execute_cmd.c:855)+add_undo_redirect内核 dup 保存(redir.c:1326)。同法补齐 same-exe script face 的bind_script_numbered_inputs_and_fd_vars(trap_exec.rs)Err 臂。证据:master 上可复现(
{ :; } 8<f9 9<f8 7</non/nope后 fd8/fd9 互换,GNU 保持原绑定);修复后 49-cell cfg(unix) 钉全绿,base 上 28 红(fail-first 成立);WSL 原生 lib 双边 1274/0 差集空;GNU 5.3.20 脚本对照一致。相邻残差(另列,未扩 scope):输入/输出两遍绑定 vs GNU 单次有序 walk 的副作用顺序差(
8>newfile 7</non/nope中文件创建与否),fd 状态两侧均正确。fix(executor): undo partial binds on mid-list redirect failure (Refs #…