Skip to content

yes: handled stdout being closed (EBADF)#11122

Open
jstarkman wants to merge 1 commit intouutils:mainfrom
jstarkman:yes-handle-bad-fd
Open

yes: handled stdout being closed (EBADF)#11122
jstarkman wants to merge 1 commit intouutils:mainfrom
jstarkman:yes-handle-bad-fd

Conversation

@jstarkman
Copy link

Now, both exit 1:

$ yes >&-
yes: standard output: Bad file descriptor

$ ./target/debug/yes >&-
yes: standard output: Bad file descriptor (os error 9)

closes #11090 (infinitely writing its buffer to /dev/null on FD 1)

@github-actions
Copy link

GNU testsuite comparison:

Note: The gnu test tests/rm/many-dir-entries-vs-OOM is now being skipped but was previously passing.
Congrats! The gnu test tests/csplit/csplit-heap is now passing!
Congrats! The gnu test tests/printf/printf-surprise is now passing!
Congrats! The gnu test tests/tail/tail-n0f is now passing!

@xtqqczze
Copy link
Contributor

Do we need to set exit code?

@jstarkman
Copy link
Author

jstarkman commented Feb 28, 2026

Do we need to set exit code?

Handled by the caller:

        Err(err) => Err(USimpleError::new(
            1, // code

This matches GNU's exit code:

$ yes >&- ; echo $?
yes: standard output: Bad file descriptor
1

$ ./target/debug/coreutils yes >&- ; echo $?
yes: standard output: Bad file descriptor (os error 9)
1

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.

yes >&- does not stop

2 participants