Repository navigation
WIP: pipe-diag — pipeline SIGPIPE death, stage diagnostics, timed-read input family (6 fixes) - #1814
Conversation
External children born through the spawn funnel never got the child signal reset, so pipeline members inherited the executor's pipeline-period SIGPIPE block (mask survives fork+exec) and exited 1 on EPIPE with leaked diagnostics instead of dying with 141. Install child_pre_exec_reset at the funnel (external_command_for_named_program), matching GNU execute_cmd.c:4224 -> trap.c:1489 restore_original_signals. Regression: tests/issue1580_pipeline_sigpipe_death_regressions.rs
…stdout (#1605) execute_compound_pipeline_stage / execute_function_pipeline_stage unconditionally installed an fd-1 capture for the stage body, so an external command in a final stage resolved /proc/self/fd/1 to a fresh capture pipe instead of the shell's inherited stdout (residual of #1454). When the stage is the pipeline's final stage, no capture is active above it, and the existing final_member_stdout_streams_to_host predicate passes, skip the stdout capture (stderr capture kept) and let bytes flow to the real fd 1. Regression: tests/issue1605_final_compound_stage_stdout_inheritance.rs
…with 2>file (#1571) For non-first stages, the not-found arm wrote the diagnostic through the stage's 2>file, but the driver's stream routing then re-opened the target with truncation and appended the stage's empty captured stderr, destroying the diagnostic. Mark the stage's fds pre-wired after the direct write so routing skips it (same mechanism as the shared-file wiring and the function-stage #412 case). Regression: tests/issue1571_pipeline_stage_notfound_diag_redirect.rs
…the shell envelope (#1596) Emulated coreutils (cat/cp/touch) formatted their diagnostics with the shell's diagnostic_prefix(), wrapping program stderr in a "script: line N:" envelope GNU never adds — external command stderr must pass through verbatim (precedent: #1309 cat, #1372 mkdir). Drop the prefix at the cat closed-stdin and input-is-output sites, in external_cp, and in external_touch; update the one compat pin that had baked in the envelope. Regression: tests/issue1596_external_stderr_no_shell_envelope.rs
…1583) Investigation on f6b5a3f: input procsub bodies already spawn eagerly at expansion (bind_input_process_substitution_child, #1021); the reported lazy start does not reproduce (ps evidence: child present before any read; body completes after parent exit without a read). Pin the eager semantics with deterministic discriminators (side effect visible without consuming input; completion after parent exit; data-path control). Regression: tests/issue1583_input_procsub_eager_start.rs
…ut (#1581) execute_timed_read_pipeline models a literal producer's output as timing chunks and interprets the consumer body itself: the first read is computed from the model, and every followup command is then executed with an EMPTY stdin (timed_read_followup_output passes ""). The modeled bytes beyond the first read's record are never materialized for the body, so a followup that reads fd 0 — a second read, mapfile, cat — saw EOF where GNU serves the not-yet-arrived data (seed: `{ sleep 1; echo A; } | { read -t 0.3 x; read y; }` lost A). The model is only sound for followups that provably never consume the stream: gate the followup arm on timed_followup_keeps_stream (echo/printf/true/:/false/sleep, assignment-only commands, and followups that rebind their own fd 0); anything else declines to the sequential stage path, whose TimedInput judge serves the same body correctly (timeout still reports 142, late data is served). Diagnosis: instrumented build — the modeled first read never reaches execute_read, and the second read observed FUNCTION_STDIN len 0 with no timed input attached. Regression: tests/issue1581_timed_read_keeps_pending_input.rs (7 tests incl. mapfile and external-cat followups).
Integrate PR #1814 onto current master for re-gating on the merged tree. The six per-issue commits are preserved unmodified (a8463a0 #1580, a24ca53 #1605, 03e4fd8 #1571, 23cf817 #1596, 95995ef #1583, 1156ac7 #1581). Single conflict, in execute_function_pipeline_stage (src/executor/pipeline_stages.rs): master added the #1765 tempenv window (assignments_failed fatal skip + restore_temporary_assignments after the call); this branch added the #1605 stream_final_stdout uncaptured branch for a final function stage. Resolution keeps both: fatal skip first, then the #1605 uncaptured direct call, then the captured call; the tempenv restore runs after every branch. The trap-run side kept the branch's stream_final_stdout conditional. All other overlapping files (path.rs incl. the ms-stopbleed path_scan_scaffold rework, pipeline_exec.rs, external_file_builtins.rs) auto-merged; the merged tree's diff against master is exactly the six commits' 11 files, verified hunk by hunk (#1605 six hunks and #1571 two hunks in pipeline_stages.rs both present).
集成完成(主会话裁定后推送)合并 commit 合并树门(单槽、JOBS=1、净化环境,日志 +
|
Pipeline diagnostics family — six fixes, one commit per issue (baseline f6b5a3f).
Fixes #1580
Fixes #1581
Fixes #1583
Fixes #1571
Fixes #1596
Fixes #1605
What
child_pre_exec_resetinstalled at the spawn funnel (path.rs).2>fileis no longer truncated away by driver routing (stage fds marked pre-wired).diagnostic_prefix()envelope and pass through verbatim; one compat pin updated.exec N< <(slow-producer)blocks until producer exits (GNU returns immediately) #1021); no code change.timed_followup_keeps_streamgate), instead of feeding followups an empty stdin.Verification (2026-10-27, this branch's build)
141 141 0with empty stderr; [bug] External command stderr is wrapped in the shell's diagnostic envelope (script: line N: prefix) #1596 diagnostics verbatim; [bug] Pipeline consumer read -t timeout discards not-yet-arrived data for later reads (shell-form producer) #1581early_rc=142 got=A; [bug] Pipeline last stage gets a fresh pipe as fd 1 instead of inheriting the shell stdout (residual of #1454) #1605 fd/1 resolves to the output file; [bug] Pipeline last stage own 2>file loses its command-not-found diagnostic entirely #1571 matrix MATCH — all MATCH GNU.builtins::test::tests::ownership_unary_operators_check_existing_file, identical to this tree's baseline failure set.Known separate divergence (not part of this PR)
Reading from a fifo with a background writer still hangs in rubash where GNU completes —
( printf 'hello\n' > fifo) &+read line < fifo, and the delayed-writer two-read shape, both rc=124 under a 15s timeout vs GNU rc=0. Same stage-input-transport domain, different root; recorded with both sides' shapes for a separate issue.