Skip to content

[bug] Hard-killed pipeline lingerer reports exit 1; GNU reports 141 (128+SIGPIPE) — yes | head -3 PIPESTATUS[0] divergence #382

Closed

Description

@caomengxuan666

Found by the wt26/pipefix lane while landing the pipe data-loss fix (2c78165).

Shape

A pipeline producer that outlives its consumer and gets the Windows broken-pipe hard-kill (the yes | head lingerer, now correctly armed only after the downstream exits) reports exit status 1 (TerminateProcess), where WSL GNU Bash 5.3.0 reports 141 (128 + SIGPIPE).

yes | head -3; echo "${PIPESTATUS[0]}"   # GNU: 141; rubash: 1

GNU spec pointer

execute_cmd.c pipeline status collection via wait_for (jobs.c:3064): a process terminated by SIGPIPE has WIFSIGNALED + WTERMSIG == SIGPIPE, surfaced as 128+13. The shell does not rewrite the status.

Direction

The hard-kill path in pipeline_exec.rs wait_for_windows_pipeline_member (the process.kill() arm) is the single producer of this status on Windows; synthesizing a SIGPIPE-shaped status (exit 141 / "terminated by signal 13") for the killed lingerer restores GNU's observable contract. Check PIPESTATUS consumers and set -o pipefail interactions (yes | head -3 && echo ok shapes) with the fix.

Activity

  1. caomengxuan666 commented on Oct 1, 2026

    @caomengxuan666
    MemberAuthor

    Additional evidence for the fix matrix (from niubash#141/#155 reporter heptaspirit, measured on the pre-fix engine): in a bare external pipeline the killed writer's PIPESTATUS[0] showed 1 instead of its real exit code — python -c "import sys;sys.exit(7)" as a bare-pipeline writer reported 1; adding any explicit redirect/compound on either side restored 7. Post-2c781657 the writer completes so real codes flow; the residue proper is the lingerer-kill arm (TerminateProcess exit 1 where GNU reports 128+SIGPIPE=141). Suggested regression shapes for whoever picks this up: yes | head -3; echo ${PIPESTATUS[0]} (want 141), a fast-exiting writer with early reader close, and set -o pipefail interactions.

  2. added 2 commits that reference this issue on Oct 2, 2026
  3. caomengxuan666 commented on Oct 2, 2026

    @caomengxuan666
    MemberAuthor

    Landed as 9755458 + 6a5ba30 (unix cross-target): both hard-kill arms return the SIGPIPE-shaped 141 (jobs.c:2958 process_exit_status WTERMSIG convention; Windows synthesizes exit 141, unix 141<<8 wait-status for our own kill of a stuck lingerer — a real SIGPIPE death never reaches the arm). yes | head -3; echo ${PIPESTATUS[0]} now prints 141; pipefail/&&/mid-stage/compound-tail matrices byte-identical; #158 and 2c78165 canaries all held (5M pipelines full, $(seq 20000|cat) instant, yes|head clean); tests/issue382_* 6/6. Environment-bound residue filed upstream: WinuxCmd yes exits 1 on broken pipe instead of dying of SIGPIPE (unixwin/WinuxCmd#1142).

  4. added
    bug
    area:jobs
    on Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:jobsbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions