Repository navigation
WIP: #2359 engine special-path faces (/dev/fd, /dev/std*, /dev/tcp|udp) vs GNU bash 5.3 - #2383
Merged
Merged
Conversation
Preservation commit by finisher: uncommitted state left by the original S2 agent (executor /dev-fd alias handling, special_paths, pin file). Adjudication against GNU bash 5.3 source follows in later commits. Refs #2359
GNU's $(<file) shortcut is optimize_cat_file (subst.c:6666) over open_redir_file (builtins/evalstring.c:759): a plain open(fn, O_RDONLY) at evalstring.c:781 that never consults redir.c's special-filename table. The #1904 ladder arm in comsub_cat_file_substitute CONNECTED for /dev/tcp|udp spellings — returning a live server's banner where GNU fails ENOENT, and blocking forever reading a UDP peer. The spelling now falls through to the plain filesystem read and fails there. The fd-table, null-device and synthetic-/proc arms of the ladder stay: the OS open behind GNU's call resolves those itself on a HAVE_DEV_FD / HAVE_DEV_STDIN build. tests/regression.rs: the #1904 tcp pin asserted the banner read; rewritten to the GNU contract (live listener, never accepted from) with the correction recorded in the module doc. Sibling #1904 pins (proc content, /dev/null) are unaffected.
The inherited preflight twin (pipeline_stage_output_redirect_fails) added OutputFdState::preflight_stage_stdio so a stage's alias spellings are judged against the stage's bindings — but nothing ever set the flag, and the only consumer sat behind the gate's defer_stdout_writes blanket return, unreachable. Stage faces with a numbered fd on a regular file (echo x > /dev/fd/3 | cat, set -C) wrote through where GNU's stage child refuses the fresh open (redir.c:676 noclobber_open over redir_open's plain open). command_output_redirect_fails_impl now arms the flag for stage preflights, and dev_stdio_target_reopens_disk judges in order: preflight stdio spellings (fd 0/1/2) against the stage, preflight numbered fds against the ambient resolver, then the defer blanket for the routing walks. Probes s06/s07/u06 byte-match GNU bash 5.3.20; stage fd-1 spellings still name the stage pipe.
{ echo x; } > /dev/stdout under set -C with stdout a regular file
printed the noclobber refusal once but the group reported status 0:
the AST loop's brace IoError arm reported the failure and set
exit_code=1, then fell through to execute_simple_pipeline, whose
re-dispatch of the same group reset the status to 0 — && ran its
right-hand side, || skipped its own, and set -e did not exit.
Subshell/loop/if/function faces were already correct.
The arm now consumes the command like the Ok(true) arm
(skip_and_or_rhs + close region + continue) with the
ExpansionFailure arm's errexit promotion — the same ending that
arm's comment documents for this exact fall-through hazard
(rubash#1240). GNU: the refused group fails with status 1 and
drives the lists (redir.c do_redirections failure reached from
execute_cmd.c's brace-group execution). Probes r03/e/e3
byte-match GNU bash 5.3.20.
fd_alias_reopen_path keyed its stdio arms on descriptor NUMBERS (fd == 0/1/2). An alias open names the open file DESCRIPTION the number carries, so three GNU faces diverged: - > /dev/stdin with stdin a character device (/dev/null): the arm required a regular file, and disk_file_path answers regular files only by design (src/fd/unix.rs) — the face fell to the dup serve and the builtin's flush failed EBADF. The arm now accepts a character device; its path comes from the /proc/self/fd/0 magic link. Pipes/sockets earn no path (their link text is the pipe:[ino] form, which fails the metadata test) — the complementary-end shapes keep the dup serve. - exec 3>&1, then > /dev/fd/3 (also inside a pipeline stage): fd 3's write endpoint is Stdout but the fd==1 arm missed it, so the stage wrote into its pipe where GNU refuses (stdout a regular file, set -C). The Stdout/Stderr arms are now keyed on the endpoint for any fd. - exec 3<&0, then > /dev/fd/3 with stdin a regular file: the inherited-stdin arm is likewise endpoint-keyed (any fd whose read endpoint is InheritedProcessStdin), not fd == 0. Probes r07/t31/t32 byte-match GNU bash 5.3.20; all probe rounds re-run clean except the pipe complementary-end class (documented in the cluster report as the remaining model gap).
…e/dup faces, stage dup refusals Seven pins added: the cat shortcut's ENOENT for TCP and UDP spellings against a live listener; the brace group's failure status across plain/&&/||/set -e shapes; writes through /dev/stdin and /dev/fd/0 with stdin the null device; the stage refusal for an append-mode fd 3; the stage refusal for a stdout-dup fd 3 (exec 3>&1); fresh-open writes through a stdin file and through a stdin dup (exec 3<&0). One inherited pin corrected: the /dev/stderr sub-case of the stdio-spellings refusal test expected a refusal under a harness that leaves stderr a PIPE — with stderr a pipe GNU writes through (oracle-verified). The sub-case now runs under a new stderr-file harness and asserts the file shape. Suite: 16 passed / 0 failed under the scrubbed-fd runner.
This was referenced Oct 31, 2026
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 #2359
Finisher #2 on cluster S2. Stack: preservation commit
68c71a91(the original agent's uncommitted work, pushed verbatim by finisher #1) + 5 adjudication/fix commits. Full per-face table, inherited-work adjudication, and verification evidence:~/workspace/fix-2359-dev-paths/REPORT.md(cluster report; summary below).Faces fixed on top of the preserved work
exec 3>&1spellings resolve to stdout's file incl. in stages;exec 3<&0spellings resolve to stdin's file.Verification (local, scrubbed-fd runner where fd-sensitive)
tests/issue2359_dev_paths_regressions.rs: 16 passed / 0 failed (9 inherited + 7 added; one inherited pin's /dev/stderr sub-case was oracle-adjudicated as a wrong pin — harness left stderr a pipe — and moved to a new stderr-file harness).tests/regression: 218 passed / 10 failed = 6 stock reds + issue_niubash_362 (known Background spawn with a large function table (~200 KB) hits execve caps / wedges — in-repo pin issue_niubash_362 case_1 is RED on master #2356 red on this base) + 3 load flakes (1951/1212 pass isolated; 1776 is a 60s harness-cap timeout under load avg ~3–4). No new semantic reds.Remaining face (documented model gap, not fixed here)
Complementary-end opens of pipe endpoints (s02/u01/u02 probes): GNU's open of a pipe read end's /proc/self/fd/N in write mode materializes the pipe's other end in the kernel. rubash materializes procsub streams as in-memory TextInput with no appendable channel and inherits stdin as a direction-locked virtual endpoint; no OutputTarget variant can carry such a write channel (external stages have none at all). Needs an appendable byte-channel endpoint kind — an engine design item.
Draft — do not merge; main session collects.