Skip to content

tests: yes: Add test case with wrong pipe size - #266

Open
oech3 wants to merge 1 commit into
coreutils:masterfrom
oech3:patch-4
Open

oech3 wants to merge 1 commit into
coreutils:masterfrom
oech3:patch-4

Conversation

@oech3

@oech3 oech3 commented May 22, 2026

Copy link
Copy Markdown
Contributor

This is realistic bug. Please add this. #253 (comment)

Comment thread tests/misc/yes.sh Outdated
# If tee() implementation tried to write seed to a pipe with small size, it would hang
small_pipe() { strace -o /dev/null -e inject=fcntl:error=ENOSYS "$@"; }
if small_pipe true; then
small_pipe timeout 1 yes|head -c 1 > /dev/null || fail=1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

timeout 1 is racy. 10 would be better
strace without -f requires timeout ... strace ... not strace ... timeout ...
Also pipe exit status is tricky since it's the last command that you get the status for.
This is especially tricky with timeout(1):

$ timeout 1 sleep inf | true; echo $?
0

I'll see can I come up with a valid test

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

timeout 1 sh -c "yes|head -c 1PB"

@oech3 oech3 May 22, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No. I added splice to uutils/head -c. Replaced by head -n.

@oech3
oech3 force-pushed the patch-4 branch 3 times, most recently from 58821c4 to 6a76e08 Compare May 22, 2026 10:58
* tests/misc/yes.sh: Add test case with fcntl failure
@oech3 oech3 changed the title tests, yes: Add test case with wrong pipe size tests: yes: Add test case with wrong pipe size Jun 17, 2026
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.

2 participants