Repository navigation
fix7 fd-source slice: fd delivery to external children, source /dev/stdin fd-0 binding, bare builtin redirections - #1689
Conversation
|
Update per the 2026-10-26 fd-source dual-route ruling (DECISIONS.md; full comparison in the collab review report §3): this slice is the landing route for #1642/#1643; the single-issue PRs #1682/#1685 will be closed as incorporated after this merges. Added one tests-only commit (8577d42) pinning the two test shapes that only #1685 carried, into
No production code change. Targeted expectation for the verification run is now 30 passed / 0 failed / 2 ignored (the two ignored pins remain the #1687/#1688 known-gap pins). Full gate results will be posted as a verification comment before merge. |
…lot numbers (rubash#1626) The fd table's descriptors reached only rubash children via the __RUBASH_FD_* env channel; foreign children got EBADF for every fd bound by exec N>file / N<file / N<>file, and the handles are opened O_CLOEXEC so nothing leaked through the raw fd space either. On Unix the spawn path now registers a pre_exec pin that dup2's each ambient fd-table descriptor (File/Coproc endpoints) onto its slot number in the child, mirroring GNU fork inheritance. Slots the command itself redirects are skipped (its binding is the more local one), and the spawn machinery's own exec-error pipe is never clobbered. Regression tests: tests/issue1626_exec_fd_child_visibility_regressions.rs (9 pass; the pipeline-member listing form is pinned #[ignore] as an adjacent gap — pipeline spawns do not pass through this path).
…bash#1642) The /dev/stdin arm consulted only the pipeline stage buffer and the process stdin handle, so source /dev/stdin <<< '...' and source /dev/stdin < file silently sourced nothing — the command's fd-0 binding lives in the command node / virtual fd table and never reaches the process handle. The arm now resolves through the same stdin ladder every other consumer uses (command stdin text via stdin_string_for_command, exposed to builtins as command_stdin_text), and when the command carries its own fd-0 redirection that resolves to no text it sources nothing instead of falling through to a stdin GNU would not consult. Regression tests: tests/issue1642_source_dev_stdin_regressions.rs (11 pass; pipeline / process-stdin / function / compound forms are controls that already worked).
The no-name arm of execute_builtin_direct_command returned success without applying the invocation's redirections, so builtin > f created nothing. GNU performs the command node's redirections regardless of the named builtin; the arm now runs the same apply_no_output_builtin_redirects_with_status helper the :/true/false arms use, with status 1 on redirect failure. Regression tests: tests/issue1643_bare_builtin_redirect_regressions.rs (8 pass; the numbered-fd 3> form is pinned #[ignore] — the shared helper walks only the stdio fields, a gap bare ':' shares).
…6-10-26) Tests-only incorporation per the fd-source dual-route ruling (~/workspace/collab-pr-review/REPORT.md §3.2): the slice takes the route, and the two test shapes only the single-issue PR #1685 carried are pinned in the slice's regression file before #1685 is closed as incorporated: - explicit fd-0 redirection wins over piped process stdin (GNU: redir.c binds fd 0 before the builtin runs) - /dev/fd/0 alias spelling of the same binding No production code change; the slice's read-only stdin ladder already resolves both shapes (redirect_cmd before FUNCTION_STDIN; /dev/fd/0 shares the /dev/stdin matches arm).
8577d42 to
b38e59b
Compare
|
Integration verification — all gates green on the landed tree (master 38062f5 + this slice, head b38e59b; all cargo runs through the single build slot, JARVIS_*-purified env, JOBS=1, debuginfo=0):
Notes: the two tests added by the tests-only commit (8577d42, rebased to b38e59b) — explicit redirect wins over pipe, /dev/fd/0 alias — are inside the 13/13 green of the #1642 file. During verification master advanced twice (#1670 history-eng, then #1647 perf-parse, then #1701 expand-param); the slice was rebased onto 38062f5 and the full gate set re-run on that tree. The final merge adds only #1701, which has zero file overlap with this slice (verified by diff). Merging now. |
fix7 fd-source slice: deliver shell fds to external children;
source /dev/stdinhonors the command's fd-0 binding; barebuiltinperforms its redirections.Three commits cherry-picked from the fix7/fd-source cluster branch onto master 9c90ab9 (zero conflicts). Cluster report:
~/workspace/rubash-fix7/clusters/fd-source/REPORT.md, probes in the same directory.Contents
spawn_external_processonly handed fds ≥3 to children through the__RUBASH_FD_*env channel, which only rubash children restore; real external children (with all handles O_CLOEXEC) always saw EBADF forexec-opened fds. On Unix, spawn now pins each real-descriptor-backed ambient fd to its own slot number via a two-phasepre_exec(F_DUPFD_CLOEXEC lift, then dup2 onto the slot). Slots the command itself redirects are skipped (the more local binding wins — pinned by a "never write to the wrong file" safety test), as is spawn's own exec-error pipe slot. Non-Unix keeps the env channel.source /dev/stdinwith file/herestring stdin redir reads nothing (GNU executes it) #1642 —source /dev/stdinonly consulted the pipeline buffer and the process stdin handle; a command-level fd-0 binding (<<<,<<EOF,< file) lives in the virtual fd table and was never read, so the source silently ran empty with rc=0. The branch now resolves through the executor's existing stdin ladder (same ladder asread/cat, with the fd-table shadowing rules); a command that carries an fd-0 redirect resolving to nothing sources empty text instead of falling back to the process stdin GNU would not touch.builtinwith redir-only ignores output redirections (GNU performs them) #1643 — barebuiltinwith no name argument returned rc=0 without applying the command's own redirections. It now calls the same redirect helper the:/true/falsearms use; redirect failure sets rc=1. Thebuiltin -- > fform lands in the same branch and is fixed with it.Out of scope (Refs only — filed separately, do NOT close with this PR)
Refs #1686
Refs #1687
Refs #1688
These are adjacent gaps recorded by the cluster: command-level fd redirects are likewise not delivered to external children (#1686); numbered-fd redirects (
3>) missing for barebuiltinand:(#1687 — the#[ignore]GNU-expectation pinissue1643_bare_builtin_numbered_fd_redirect_known_gapin this slice's #1643 test file stays ignored until it lands); pipeline members do not inherit ambient fds (#1688 — the#[ignore]pinissue1626_exec_fd_listed_in_pipeline_child_known_gapin the #1626 test file likewise).Verification (on the landed tree)
To be filled in by the integration verification comment: targeted three test files, full lib suite, 306-case differential, redir-fd regression surface.
Fixes #1626
Fixes #1642
Fixes #1643