Skip to content

tee: panics when an output fails part-way #15119

Closed

Description

@abendrothj

On Linux, when one of tee's outputs stops part-way (EFBIG under a file size limit, or ENOSPC), tee panics and the other outputs stop too:

$ seq 1 500000 | head -c 3145728 > in
$ prlimit --fsize=102400 env --ignore-signal=XFSZ tee capped /dev/null capped2 < in | wc -c
tee: capped: File too large

thread 'main' panicked at src/uu/tee/src/tee.rs:188:21:
assertion `left == right` failed: 2nd pipe should have enough spare
  left: Ok(102400)
 right: Ok(1048576)
1048576

The bytes the failed output didn't take are left in tee's pipe, so the assertion fails, and anything still being copied would get them. Here stdout stops after 1 MiB and capped2 stays empty. GNU 9.12 prints File too large for both capped files, writes 102400 bytes to each, and copies all 3145728 bytes to stdout.

Activity

  1. oech3 commented on Oct 6, 2026

    @oech3
    Contributor

    This is unrelated with issue, but we can probably use prlimit binary at our Rust test directly since it is part of util-linux.
    It is probably reasonable dependency more than strace.

  2. abendrothj commented on Oct 6, 2026

    @abendrothj
    ContributorAuthor

    Since limit() already applies the limit in the child, I don't think prlimit is needed here. It would also add a util-linux dependency, which macOS and the BSDs don't have.

  3. oech3 commented on Oct 6, 2026

    @oech3
    Contributor

    Ah OK. The test is logically platforn independant.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions