Skip to content

sort: piping stdout to head -n 0 gives 'Broken pipe' #10260

@BAMF0

Description

@BAMF0

(Forwarded from Launchpad Bug #2133156)

Summary

When sort's output is passed to a pipe that is closed mid-write (as head -n 0 does), the error write failed: 'standard output': Broken pipe is generated.

Reproduce

  1. Pipe the output of a sort invocation to head -n 0.
echo 1 | sort | head -n 0

Output:

sort: write failed: 'standard output': Broken pipe

  1. Verify with gnusort.
echo 1 | gnusort | head -n 0

Output:

# Empty, success

System

  • OS release: Ubuntu 26.04 (Development branch)
  • uutils coreutils version: 0.5.0 (built from main commit: 1d6bd99)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions