Skip to content

tee: fix input with sleep#11686

Merged
sylvestre merged 1 commit intouutils:mainfrom
oech3:tee-rev
Apr 12, 2026
Merged

tee: fix input with sleep#11686
sylvestre merged 1 commit intouutils:mainfrom
oech3:tee-rev

Conversation

@oech3
Copy link
Copy Markdown
Contributor

@oech3 oech3 commented Apr 6, 2026

(I just want to use large buf size only for simplicity since current overhead with small input is mostly coming from clap...)

[Edit] Closes #11755

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 6, 2026

GNU testsuite comparison:

GNU test failed: tests/tail/retry. tests/tail/retry is passing on 'main'. Maybe you have to rebase?
Skip an intermittent issue tests/date/date-locale-hour (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/tty/tty-eof (fails in this run but passes in the 'main' branch)
Congrats! The gnu test tests/cp/link-heap is now passing!

@oech3 oech3 marked this pull request as ready for review April 6, 2026 21:00
@aidanharris
Copy link
Copy Markdown

This fixes the issue I was having 👍️

gentoo-reproducer.bats
+ bats --verbose-run --trace --formatter tap /gentoo-reproducer.bats
1..3
$ [gentoo-reproducer.bats, line 19]
$ echo "Restoring GNU tee"
$ cp -afv /usr/bin/gnu-tee /usr/bin/tee
ok 1 uucore: add missing fs feature to rustix 60d448be4825e5e1a4ebbb2cbb74f562a9c899ea
$ [gentoo-reproducer.bats, line 19]
$ echo "Restoring GNU tee"
$ cp -afv /usr/bin/gnu-tee /usr/bin/tee
ok 2 tee: increase buf size for large input should fail 13fb3bede8185bfe12d0579027dfd6ab13793185
$ [gentoo-reproducer.bats, line 19]
$ echo "Restoring GNU tee"
$ cp -afv /usr/bin/gnu-tee /usr/bin/tee
ok 3 tee: fix input with sleep should pass

Ran with:

docker run -it --rm --name gentoo-reproducer --pull always -v $PWD/gentoo-reproducer.bats:/gentoo-reproducer.bats gentoo/stage3 bash -x -c 'cat /gentoo-reproducer.bats && emerge-webrsync && emerge -q1 dev-util/bats && bats --verbose-run --trace --formatter tap /gentoo-reproducer.bats'
#!/usr/bin/env bats

good_commit="60d448be4825e5e1a4ebbb2cbb74f562a9c899ea"
bad_commit="13fb3bede8185bfe12d0579027dfd6ab13793185"
patchdir="/etc/portage/patches/sys-apps/uutils-coreutils"

setup() {
        rm -rf "$patchdir"
        mkdir -p "$patchdir"
        [ -d /var/db/repos/gentoo/dev-lang/rust-bin ] || emerge-webrsync
        command -v rustc || emerge -q1 dev-lang/rust-bin
        command -v git || emerge -q1 dev-vcs/git
        keyword_file="/etc/portage/package.accept_keywords/uutils"
        [ -e "$keyword_file" ] || printf "%s **\n" sys-apps/uutils-coreutils > "$keyword_file"
        [ -e /usr/bin/gnu-tee ] || cp -afv /usr/bin/tee /usr/bin/gnu-tee
}

teardown() {
        echo "Restoring GNU tee"
        cp -afv /usr/bin/gnu-tee /usr/bin/tee
}

@test "uucore: add missing fs feature to rustix $good_commit" {
        env EGIT_OVERRIDE_COMMIT_UUTILS_COREUTILS="$good_commit" emerge -q1 uutils-coreutils
        cp -afv /usr/bin/uu-tee /usr/bin/tee
        emerge -v1 sys-apps/portage
}

@test "tee: increase buf size for large input should fail $bad_commit" {
        env EGIT_OVERRIDE_COMMIT_UUTILS_COREUTILS="$bad_commit" emerge -q1 uutils-coreutils
        cp -afv /usr/bin/uu-tee /usr/bin/tee
        ! emerge -v1 sys-apps/portage
}

@test "tee: fix input with sleep should pass" {
	cd "$patchdir" || return 1
	wget https://github.com/uutils/coreutils/pull/11686.diff
	emerge -q1 uutils-coreutils
	cp -afv /usr/bin/uu-tee /usr/bin/tee
	emerge -v1 sys-apps/portage
}

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2026

GNU testsuite comparison:

Skipping an intermittent issue tests/date/date-locale-hour (passes in this run but fails in the 'main' branch)
Note: The gnu test tests/tail/pipe-f is now being skipped but was previously passing.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 9, 2026

GNU testsuite comparison:

Skip an intermittent issue tests/date/date-locale-hour (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/tail/inotify-dir-recreate (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/tty/tty-eof (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/pr/bounded-memory (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/cp/link-heap is now passing!
Congrats! The gnu test tests/dd/no-allocate is now passing!
Congrats! The gnu test tests/seq/seq-epipe is now passing!

@oech3
Copy link
Copy Markdown
Contributor Author

oech3 commented Apr 11, 2026

@cakebaker Would you merge this? It seems this is important for some people.

@SpeedyTurtle599
Copy link
Copy Markdown

Just in case it's a useful data point, I can replicate the underlying issue (and the working fix) on my machine. Arch Linux x64, uutils 0.8.0, trying to compile PETSc with gmake 4.4.1.

@oech3
Copy link
Copy Markdown
Contributor Author

oech3 commented Apr 11, 2026

I can backport this to AUR/uutils-coreutils-git if @SpeedyTurtle599 hopes.

@SpeedyTurtle599
Copy link
Copy Markdown

That's very generous of you! Yes, that would be fabulous. Cheers @oech3

@oech3
Copy link
Copy Markdown
Contributor Author

oech3 commented Apr 11, 2026

done (also added yes patch)

@sylvestre sylvestre merged commit 9f50c8b into uutils:main Apr 12, 2026
171 checks passed
@oech3 oech3 deleted the tee-rev branch April 12, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tee: early return on short first read breaks pipes (regression in 0.8.0)

4 participants