Repository navigation
fix(executor): route pipeline stage stderr through the fd table in command substitution - #3364
Merged
Merged
Conversation
…mmand substitution In script mode the first stage of a pipeline inside $(...) wrote its stderr straight to the process console, bypassing all redirects. Pipeline stage fd 2 must be resolved from the executor fd table, and collected stage stderr re-emitted through the fd-2 face, never through raw process stderr. Refs unixwin#3308 Regression pin: tests/issue3308_comsub_pipeline_stderr_redirects.rs (18 tests; fail-first 13 failed on the unpatched tree, 18/18 pass after). issue1552 ambient-stderr family 8/8 green. GNU 5.3.20 probe matrix 12/13 match (one concurrent-write ordering case is nondeterministic in GNU itself). Owed: Windows twin paths carry the same mechanism bug and are unverified on this Linux VM; d2 sequential-loop residual (2>&1 snapshot not honoured when fd 1 is rebound); unixwin#1967 counting-server flake is pre-existing.
Member
|
Thanks for the PR. This is queued for captain review — collaborator PRs are reviewed by the captain before merge, and #3308 stays open until that review lands. CI at intake: all checks green. No action needed unless the review asks for changes. |
This was referenced Nov 11, 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.
Fixes #3308
What was fixed
In script mode,
$(external | external)let the first pipeline stage's stderr bypass every redirect and write straight to the console (-cmode was fine). A pipeline stage's fd 2 must be resolved from the executor's fd table, never from the process's raw stderr.The fix adds a
ConcurrentPipelineStderrplan (Inherit / Null / Direct / Piped) to the Unix concurrent twin paths, resolving each stage's fd 2 from the fd table and re-emitting collected stage stderr throughwrite_default_stderr. The prefix-streaming-tail path, which never set stderr on spawn at all, gets the same plan plus per-member drain threads and ordered re-emission after reap. The sequential path'spipeline_stage_stdio_targetsno longer misreads "no output redirect" as unparseable.What was deleted
Nothing. No files, features, or tests were removed. (A temporary
DBG3308debug print added during the work was deleted before this PR.)Verification (all run, per-item counts)
tests/issue3308_comsub_pipeline_stderr_redirects.rs: 18/18 pass. Fail-first on the unpatched tree: 3 passed / 13 failed (16 pre-existing cases; the 2 prefix-streaming-tail cases were evidenced by a probe leak on the unpatched tree).issue1552_ambient_stderr_pipeline_diagnostic_regressions: 8/8 pass.cargo build -j 2 --bin rubashclean,cargo fmt --checkclean.src/lexer/continuation.rsuntouched.Owed
{ echo hi | ls /bad; } 2>&1 1>out.txt— GNU puts the error on stdout; rubash's sequential loop puts it inout.txt. Addressing it means reworking the [bug] 计时管道以 dash 词作首段时丢失 command not found 诊断 #1552 merge semantics; left out of scope.