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
[bug] coproc construct-level fd redirect (3>file) is dropped at the spawn boundary: body writes fail 'Bad file descriptor' #2200
[bug] A construct-level fd redirect on a coproc is not established for the respawned child: the file is created but the body's write to that fd fails with "Bad file descriptor" and nothing is delivered. Body-internal redirects work; the construct-level redirect is dropped at the coproc spawn boundary.
Repro (verified 2026-10-30 on master acf8fef, GNU bash 5.3.20 as oracle):
GNU 5.3.20: fd3out.txt contains hello-fd3, no diagnostics.
rubash: stderr 3: Bad file descriptor, fd3out.txt is empty.
Regression seed: the script above; assert the file content equals hello-fd3 and stderr is empty. Sibling shapes worth pinning in the same pass: construct-level redirects on the other respawn sites (async &, procsub consumer/producer) and a numbered-fd input redirect on coproc.
Context: found by the #2058 respawn-transport census (its REPORT §3 side note) and re-verified by the main session against the oracle. Same spawn-boundary fd-state family as #2195 (procsub consumer spawn-time fd state) — adjudicate together when dispatching; the fd governance fixes in #2170/#2171 are the neighboring precedents.
Activity
executor: bind coproc construct-level redirects for fds >= 3 at spawn
Merge pull request #2232 from unixwin/fix/fd-family-2195-2196-2200
caomengxuan666 commentedon Oct 30, 2026
已随 PR #2232 合入关闭(第二轮 CI run 41074215620 全绿)。
修法:
apply_coproc_redirects收集编号 fd 绑定(文件入/出/追加/读写、关闭、dup 含3>&1这类管道源 dup;词 dup 按 GNU 报ambiguous redirect),并把绑定传进 coproc 子进程的两条路线(respawn 走 env、direct 走 pre-exec pin);dup 只在遍历完成后创建,退让路径不泄漏任何绑定。钉 4 枚(issue2200 文件),基线红、修复绿,探针与 GNU 逐字节一致(含 coproc 输入与3>&1管道 dup)。