Repository navigation
WIP: fix(executor): deliver an ambient /dev/full binding to external children (#2550) - #2555
Merged
Merged
Conversation
…ren (Refs #2550) plan_external_stdio declined the whole plan whenever an ambient fd 1/2 binding (or a dup source) was rubash#1898's symbolic FdWriteEndpoint::FullDevice, and the legacy routes that took over apply no ambient binding at all — so after `exec 1>/dev/full` a foreign child inherited the HOST stdout and its writes silently succeeded (rc 0, no diagnostic). GNU installs the opened device itself in the shell's descriptor table for a permanent exec redirection (redir.c:237 do_redirections -> redir.c:790 do_redirection_internal, the open at redir.c:725 redir_open) and the forked child inherits that descriptor (execute_cmd.c make_child): the write fails ENOSPC inside the child, which diagnoses itself and exits 1. Fix by mechanism: a FullDevice table binding now resolves to a stdio slot through full_device_stdio_slot() — a fresh open of the real device where the platform has one (an independent open is indistinguishable; the device keeps no offset or state). Both planner sites that resolve table bindings speak it: the fd 1/2 ambient seeding and the dup-source fallback (so `>&4` after `exec 4>/dev/full` resolves too). Where no kernel device backs the spelling (Windows simulation) or the open fails, the slot stays unresolvable and the plan declines exactly as before, keeping the #1898 sink contract for the in-shell faces. The command-local target route is untouched (owned by #2533). Pins: tests/issue2550_devfull_ambient.rs, 7 shapes incl. /dev/null and regular-file controls — 7/7 green under the scrubbed harness. Guard issue2483_stream_drain 6/6. Guard issue1496_write_error_diag_regressions is red on this base before and after this change (identical probe output): its failing leg is the command-local face owned by PR #2549, not in base 9348b8d.
caomengxuan666
marked this pull request as ready for review
November 2, 2026 05:35
Member
Author
|
[win-acceptance] #2555 — unix-only face on Windows: the new pin Environment: Windows 10 19045 real machine, MSVC Rust debug build of master b41e8b6 (contains this merge), oracle |
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 #2550
Defect
exec 1>/dev/full; /bin/echo hi— the foreign child inherited the HOST stdout: printshi, rc 0, no diagnostic. GNU bash 5.3.20: the child inherits the opened device, its write fails ENOSPC inside the child (/bin/echo: write error: No space left on device), rc 1.Root cause
plan_external_stdiodeclined the whole plan whenever an ambient fd 1/2 binding (or a dup source) was rubash#1898's symbolicFdWriteEndpoint::FullDevice; the legacy routes that take over apply no ambient binding at all, so the binding was silently dropped at spawn.GNU: a permanent
execredirection installs the OPENED device in the shell's own descriptor table (redir.c:237do_redirections-> redir.c:790do_redirection_internal, open at redir.c:725redir_open) and the forked child inherits that descriptor (execute_cmd.cmake_child).Fix (mechanism, one file: src/executor/external_redirects.rs)
A
FullDevicetable binding now resolves throughfull_device_stdio_slot(): a fresh open of the real device where the platform has one (independent open is indistinguishable — the device keeps no offset/state). Both planner sites that resolve table bindings speak it: the fd 1/2 ambient seeding and the dup-source fallback (>&4afterexec 4>/dev/full). Where no kernel device backs the spelling (Windows simulation) or the open fails, the plan declines exactly as before — the #1898 sink contract for in-shell faces is unchanged. The command-local target route is untouched (owned by #2533 / PR #2549).Verification (build slot + scrubbed_cargo)
issue2550_devfull_ambient(new pins, 7 shapes: fd 1, fd 1 append, fd 2, merged2>&1, fd>=3 dup source, /dev/null + regular-file controls): 7 passed, 0 failedissue2483_stream_drain: 6 passed, 0 failedissue1496_write_error_diag_regressions: red on base 9348b8d BEFORE and AFTER this change (probe output identical: rc=1/rc2=0/rc3=1) — its failing leg is the command-local face owned by PR WIP: fix #2524 #2533 #2534 #2535 #2549, which is not in this base; expected green once WIP: fix #2524 #2533 #2534 #2535 #2549 lands and this branch is rebased at harvest.Cluster report: ~/workspace/rubash-wave-20261102/w11-devfull/REPORT.md