-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix(yes): handle trapped SIGPIPE correctly #9560
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
base: main
Are you sure you want to change the base?
Conversation
|
GNU testsuite comparison: |
ee21361 to
9b6ca30
Compare
|
GNU testsuite comparison: |
|
While it looks correct in the case you list, it doesn't fix the handling of See the following example: |
9b6ca30 to
4c03f54
Compare
|
6a77438 to
7ada39a
Compare
CodSpeed Performance ReportMerging #9560 will not alter performanceComparing Summary
Footnotes
|
7ada39a to
407b819
Compare
|
GNU testsuite comparison: |
|
This looks incorrect. POSIX states [1]:
If See the following example: So, I don't think this issue is fixable unless Rust has a way to remove the [1] https://pubs.opengroup.org/onlinepubs/9799919799/functions/exec.html |
|
the rust problem Rust sets SIGPIPE = SIG_IGN by default at startup, making it impossible to distinguish:
|
407b819 to
01ba47a
Compare
|
GNU testsuite comparison: |
01ba47a to
87c41c7
Compare
87c41c7 to
1ffaedd
Compare
|
GNU testsuite comparison: |
|
I still don't think this is correct. The error should not be printed in this case, and the exit status of Here is the correct behavior: This is an unfortunate limitation of Rust, that requires a feature to be stabilized [1]. It also appears that unless you use [1] https://dev-doc.rust-lang.org/beta/unstable-book/language-features/unix-sigpipe.html#unix_sigpipe--sig_ign |
|
don't worry, i tested it on Rust nightly, and it's working. Hope for the next version |
|
This can be fixed with the approach in #9657 |
When SIGPIPE is trapped (
trap '' PIPE), write fails with EPIPE instead of signal. Print diagnostic message to stderr like GNU coreutils, instead of silently exiting.Test with trapped SIGPIPE (the issue scenario)
Compare with GNU yes
Refs: POSIX Signal specs, GNU Signal handling
Fixes #7252