Repository navigation
WIP: fix(fd): /dev/fd spelling gate judges the at-position endpoint (#2316) - #2326
Merged
Merged
Conversation
The #2276 ENXIO gate (reject_invalid_redirects) judged a /dev/fd/N spelling target against the source fd's ambient endpoint, plus a side scan for an earlier entry binding the fd from a net target. GNU performs one ordered walk (redir.c:237 do_redirections, list loop at redir.c:254): the spelling opens the binding the fd carries at that list position, so a dup of a socket earlier in the same list makes the target a socket (ENXIO), and a file bind earlier in the list shadows an ambient socket. Give the gate scan a positional endpoint-class overlay (opened_socket) beside its existing opened overlay: every entry that binds an fd records the class of what it bound — a net open records socket, a file/text/heredoc bind records non-socket, a dup records its source's class resolved at the dup's own position (scan_endpoint_is_socket), so dup chains compose. The spelling arm now judges exactly that at-position endpoint; the ambient table judges only when the list never bound the fd. Pins: tests/issue2316_spelling_gate_position_regressions.rs (8). GNU 5.3.20 oracle probes for both mirror shapes are recorded in the cluster report. Controls stay green: issue2276 (7), issue2272 (24), issue2281 (6). Refs #2316
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 #2316 (the #2276 residual; user directive 2026-10-31: residuals get fixed, not parked).
Defect
The #2276 ENXIO gate (
reject_invalid_redirects, PR #2300) judged a/dev/fd/Nspelling target against the source fd's ambient endpoint, plus a side scan for an earlier entry binding the fd from a net target. GNU performs one ordered walk —redir.c:237 do_redirections, list loop atredir.c:254— so the spelling opens the binding the fd carries at that list position: a dup of a socket earlier in the same list makes the target a socket (ENXIO), and a file bind earlier in the list shadows an ambient socket (the spelling opens the file).Fix (mechanism, no per-shape guards)
src/executor/redirection.rs(+71/−14): a positional endpoint-class overlayopened_socketbeside the scan's existingopenedoverlay. Every entry that binds an fd records the class of what it bound — a net open records socket; a file/text/heredoc bind records non-socket; a dup records its source's class resolved at the dup's own position (new helperscan_endpoint_is_socket), so dup chains compose. The spelling arm judges exactly that at-position endpoint; the ambient table (via the #2276fd_alias_spelling_open_error) judges only when the list never bound the fd. The old ambient-plus-net-side-scan expression is deleted.Evidence
file-bodyrc=0; C dup chain → ENXIO rc=1; D net bind then file rebind →file-bodyrc=0; E dup-face control → streamshellorc=0. Full table + methodology in the cluster REPORT.md.tests/issue2316_spelling_gate_position_regressions.rs: 8/8 green (scrubbed runner). Mirror ("must not refuse") shapes are pinned on the exec face — see the adjacent-gap note below.issue2276_socket_spelling_enxio7/7,issue2272_fdvar_spawn_delivery_regressions24/24,issue2281_pending_close_positions6/6.Adjacent gap found while probing (NOT this issue; flagged for homing)
On the plain command face, a spelling of an in-list binding is resolved ambient-only by the applier/spawn plan — independent of the gate and of sockets:
cat 9<data.txt 0</dev/fd/9→ ENOENT on master and on this branch alike (GNU:file-body). So plain-face shapes B/D still end rc=1 below the gate (B now refuses in the applier with ENXIO, D with ENOENT). That is why the mirror pins run on the exec face, whose applier walks the same list sequentially; the gate inputs are identical. Suggested home: a new issue in the fd/spawn-plan family.