uucore: move SIGPIPE setup to real main and drop RUST_SIGPIPE workaround#11245
Open
mattsu2020 wants to merge 2 commits intouutils:mainfrom
Open
uucore: move SIGPIPE setup to real main and drop RUST_SIGPIPE workaround#11245mattsu2020 wants to merge 2 commits intouutils:mainfrom
mattsu2020 wants to merge 2 commits intouutils:mainfrom
Conversation
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
1e18d31 to
36a08c3
Compare
|
GNU testsuite comparison: |
Merging this PR will not alter performance
Comparing Footnotes
|
Unable to generate the performance reportThere was an internal error while processing the run's data. We're working on fixing the issue. Feel free to contact us on Discord or at support@codspeed.io if the issue persists. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Move SIGPIPE startup handling out of the
uucore::mainproc macro and into the real binary entrypoints.This keeps the startup-state capture at process entry, simplifies the proc macro, and removes the
RUST_SIGPIPEworkaround that was used to communicate default SIGPIPE behavior to Rust child processes.Related: #11208
What Changed
mainentrypointsuucore::bin!coreutilsbinarymainpath instead of the proc-macro-generateduumainuucore::mainso it only handles:UResultinto exit codespreserve_inherited_sigpipe()RUST_SIGPIPE=defaultpropagation inenv#[cfg(unix)]so Windows builds do not try to resolve Unix-only signal machineryWhy
Handling SIGPIPE from the actual process entrypoint is a better fit than doing it inside the proc macro wrapper around utility logic.
This reduces SIGPIPE-specific coupling in
uucore::main, keeps the behavior centralized at the binary boundary, and removes the extra environment-variable-based workaround for Rust child processes.Verification
cargo fmt --allcargo test --test tests test_env::test_env_default_signal_pipe -- --exactcargo test --test tests test_env::test_ignore_signal_pipe_broken_pipe_regression -- --exactcargo test --test tests test_seq::test_sigpipe_ignored_reports_write_error -- --exactcargo test --test tests test_yes::test_simple -- --exactcargo test --test tests test_sort::test_sigpipe_panic -- --exactNotes
I also checked the Windows-specific failure mode reported in CI and fixed the immediate issue by ensuring the startup capture macro is only invoked on Unix.