Repository navigation
fix(pipeline): stream pipeline stage stderr live in the sequential loop - #3468
Conversation
Captain review: FAIL — three rework items (O1 + N1 + N2)Head O1 (product, REQUIRED rework):
|
…op (Refs #3434) Rework of PR #3468 per captain review FAIL: the new guard set pipeline_stage_stderr_live and then ran the stage dispatch inside a let-else scrutinee holding six '?' propagations, so an Err returned without restoring the flag. Sandwich form now: the dispatch runs in a closure returning Result, the flag is restored unconditionally, and only then is the result propagated/handled (cf. the shell-writer and sandwich paths). The 'on both exits' comment is corrected: Err is a third exit and now passes through the restore. Nail fixes in the same commit: quote the temp err path in issue3434_stage_stderr_redirect_still_wins (unquoted Windows path lost its backslashes) and drop the never-read MergedRun.code field (dead_code under -D warnings).
|
【WIN-AGENT-AUDIT】 机制核查:
腿(X299 本机):
F 点回应:
续作记录:本轮仅复核与验证腿,未改代码未推送(远端 head ef687c3 未变)。 未跑/VOID 的腿:
|
…op (#3434) Root cause: a compound/function pipeline stage captured its whole stderr into one buffer and flushed it only when the stage completed, while the stage's stdout streamed live (final member, #1605) or escaped live through a dup'd fd (>&3), so a diagnostic that execution order puts first printed last. GNU: execute_pipeline (execute_cmd.c:2620) forks each element with the pipe bound to fd 1 and the shell's other descriptors inherited, and builtin_error (builtins/common.c:98) writes the element's fd 2 as produced (stdio line-buffered, shell.c:1921-1922). There is no "collect then order" step. Fix: arm the #2483 live-stderr channel in the sequential stage loop (execute_simple_pipeline_inner) and narrow pipeline_stage_stderr_may_stream so only redirects that (re)bind fd 2 decline the channel (redirect_claims_fd2): fd == 2, &>/&>> combined output, or a dynamic {var} fd. A 3>&1 dup no longer forfeits the live channel. Regression nail: tests/issue3434_pipeline_builtin_diagnostic_order.rs (11 tests; 7 defect shapes fail-first on base, 4 control/guard shapes pass). 本 PR 删除了什么:无删除。仅收窄一处否决谓词 (!redirects.is_empty() -> redirects.iter().any(redirect_claims_fd2)), 并在顺序循环布防既有标志。 Refs #3434 UNVERIFIED-BY-CAPTAIN
…op (Refs #3434) Rework of PR #3468 per captain review FAIL: the new guard set pipeline_stage_stderr_live and then ran the stage dispatch inside a let-else scrutinee holding six '?' propagations, so an Err returned without restoring the flag. Sandwich form now: the dispatch runs in a closure returning Result, the flag is restored unconditionally, and only then is the result propagated/handled (cf. the shell-writer and sandwich paths). The 'on both exits' comment is corrected: Err is a third exit and now passes through the restore. Nail fixes in the same commit: quote the temp err path in issue3434_stage_stderr_redirect_still_wins (unquoted Windows path lost its backslashes) and drop the never-read MergedRun.code field (dead_code under -D warnings).
ef687c3 to
01e9dc3
Compare
fix(pipeline): stream pipeline stage stderr live in the sequential loop
Root cause
A compound/function pipeline stage captured its whole stderr into one
buffer and flushed it only when the stage completed, while the stage's
stdout streamed live (final member, #1605) or escaped live through a
dup'd fd (
>&3), so a diagnostic that execution order puts firstprinted last.
GNU:
execute_pipeline(execute_cmd.c:2620) forks each element withthe pipe bound to fd 1 and the shell's other descriptors inherited, and
builtin_error(builtins/common.c:98) writes the element's fd 2 asproduced (stdio line-buffered,
shell.c:1921-1922). There is no"collect then order" step.
Fix
Arm the #2483 live-stderr channel in the sequential stage loop
(
execute_simple_pipeline_inner) and narrowpipeline_stage_stderr_may_streamso only redirects that (re)bind fd 2decline the channel (
redirect_claims_fd2): fd == 2,&>/&>>combined output, or a dynamic
{var}fd. A3>&1dup no longerforfeits the live channel for the whole stage.
Regression nail
tests/issue3434_pipeline_builtin_diagnostic_order.rs(11 tests):7 defect shapes fail-first on base, 4 control/guard shapes pass.
Verification
e50cea96)seed_r108d.sh(rubash driver)issue3434_…(scrubbed_cargo)RUSTFLAGS="-D warnings" cargo check --lib --binsissue3324…/issue2699…/issue1134…Head build legs are Owed to the review round: the Simular box disk is
100% full, the old server's sshd is banner-dead again, local builds are
prohibited for this lane, and X299 direct access is not yet wired.
Static legs (fmt, marker-lint, utf8) pass; the fix is +42/−1 in one
file plus the 11-test nail.
本 PR 删除了什么
无删除。仅收窄一处否决谓词
(
!redirects.is_empty()→redirects.iter().any(redirect_claims_fd2)),并在顺序循环布防既有标志。Refs #3434
UNVERIFIED-BY-CAPTAIN