Skip to content

docs: platform gap — foreign children cannot receive exec-established numbered fds (#378) - #580

Merged
caomengxuan666 merged 1 commit into
masterfrom
docs/378-fd-inheritance-limit
Oct 13, 2026
Merged

caomengxuan666 merged 1 commit into
masterfrom
docs/378-fd-inheritance-limit

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

Summary

Durable documentation for rubash#378, closed as platform-gap. Adds docs/platform-fd-inheritance.md:

  • The gap, stated plainly: GNU's exec N>&M contract (redir.c:1170/1188-1192) relies on fork-style full fd-table inheritance, which Windows cannot express for foreign children — std::process passes exactly three std handles.
  • Why no sound fix path exists: PROC_THREAD_ATTRIBUTE_HANDLE_LIST is a filter, STARTF_USESTDHANDLES has exactly three value-remapping slots, DuplicateHandle's target value is [out] — anchored to Microsoft docs; plus the CRT lpReserved2 io-inherit-block channel, its "Reserved for use by the C Run-time" boundary, and why MSYS2 children are unreachable (their runtime claims the same reserved field — fork.cc:341-342).
  • Runtimes that land in the same place: Cygwin (cooperative fork), Python (pass_fds POSIX-only), libuv (private lpReserved2 layout), Rust std (no mapping API).
  • Supported-forms ledger — what does work today, each with its mechanism and anchor: stdio redirections/pipelines; planned redirects resolved against the fd table (regression(ba69f0d9): exec-copied fds (exec 3>&2) no longer honored by external command redirects (>&3 lands on wrong stream) #370); /dev/fd/N argv rewriting on Windows (dev_fd_operands.rs:285); the cooperative __RUBASH_FD_* env-key channel for rubash→rubash children (external_inner.rs:755).
  • Verdict: per the 2026-10 ruling the gap is not fixed; native-Windows identity (no MSYS/cygwin runtime, platform-identity.md) is load-bearing. A one-paragraph "if ever needed" candidate route (handle-reuse naming protocol / UCRT-only io-inherit bridge) is recorded without commitment.

No GPL C source is reproduced; all GNU/Cygwin/Wine/libuv semantics are anchored by file:line references.

Closes #378 (closed via issue comment after merge, per verdict).

Checklist

  • Docs-only change; no `src/` behavior touched
  • File anchors verified against the current tree at 7f18b44

… numbered fds (#378)

Durable record for rubash#378, closed as platform-gap: Windows has no
fork-style fd-table inheritance (std::process passes exactly three std
handles), so a foreign child that itself dups an fd established by an
enclosing `exec N>&M` cannot receive it. Documents the OS-level facts
(filter-only handle-list attr; three STARTF_USESTDHANDLES slots;
DuplicateHandle out-param), the CRT io-inherit-block channel and its
reserved-field boundary (MSYS2 children unreachable), the runtimes that
land in the same place (Cygwin/Python/libuv/Rust std), and the
supported-forms ledger: stdio redirections, planned redirects resolved
against the fd table (#370), /dev/fd/N argv rewriting
(dev_fd_operands.rs:285), and the cooperative __RUBASH_FD_* channel
(external_inner.rs:755). No GPL source pasted; semantics anchored by
file:line.
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.

[platform-gap] Foreign children cannot receive exec-established numbered fds (no fork-style fd-table inheritance via std::process on Windows)

1 participant