10000 tee: remove output buffering by Maximkaaa · Pull Request #8218 · uutils/coreutils · GitHub
[go: up one dir, main page]

Skip to content

tee: remove output buffering #8218

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 19, 2025
Merged

Conversation

Maximkaaa
Copy link
Contributor

To comply with POSIX standard tee implementation must not buffer its output, so we replace std::io::copy implementation that does buffering with the custom one.

Fixes #8198

Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/misc/stdbuf (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/misc/tee (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)

@Maximkaaa
Copy link
Contributor Author

The CI failure doesn't seem related to the PR.

Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/misc/tee (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)

@Maximkaaa Maximkaaa force-pushed the tee_buffering branch 2 times, most recently from ceae35e to 01b6d24 Compare June 19, 2025 00:12
@Maximkaaa
Copy link
Contributor Author

@RenjiSann You comment made me think. The test I wrote would hang indefinitely in case of buffered output. This might be fine since it should never fail. But in unlikely event of it still failing, the reason for hanging will be hard to understand.

So I rewrote the test a little, so that it is stopped by timeout instead of hanging. This makes the test code a little bit more complicated, but I think the result is much better.

I also added a few comments to explain what the test is doing.

To comply with POSIX standard `tee` implementation must not buffer
its output, so we replace std::io::copy implementation that does
buffering with the custom one.
Copy link
Collaborator 8000
@RenjiSann RenjiSann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks for adding details!

Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)

@RenjiSann RenjiSann merged commit 86f0c61 into uutils:main Jun 19, 2025
75 checks passed
@Maximkaaa Maximkaaa deleted the tee_buffering branch June 19, 2025 06:54
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 is line-buffered
2 participants
0