Skip to content

uucore: move SIGPIPE setup to real main and drop RUST_SIGPIPE workaround#11245

Open
mattsu2020 wants to merge 2 commits intouutils:mainfrom
mattsu2020:rust_refactoring
Open

uucore: move SIGPIPE setup to real main and drop RUST_SIGPIPE workaround#11245
mattsu2020 wants to merge 2 commits intouutils:mainfrom
mattsu2020:rust_refactoring

Conversation

@mattsu2020
Copy link
Contributor

Summary

Move SIGPIPE startup handling out of the uucore::main proc macro and into the real binary entrypoints.

This keeps the startup-state capture at process entry, simplifies the proc macro, and removes the RUST_SIGPIPE workaround that was used to communicate default SIGPIPE behavior to Rust child processes.

Related: #11208

What Changed

  • moved Unix startup-state capture to the real main entrypoints
    • uucore::bin!
    • the multicall coreutils binary
  • restored default SIGPIPE handling from the real main path instead of the proc-macro-generated uumain
  • simplified uucore::main so it only handles:
    • disabling Rust signal handlers when needed
    • converting UResult into exit codes
  • removed preserve_inherited_sigpipe()
  • removed the RUST_SIGPIPE=default propagation in env
  • gated the startup capture invocation with #[cfg(unix)] so Windows builds do not try to resolve Unix-only signal machinery

Why

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 --all
  • cargo test --test tests test_env::test_env_default_signal_pipe -- --exact
  • cargo test --test tests test_env::test_ignore_signal_pipe_broken_pipe_regression -- --exact
  • cargo test --test tests test_seq::test_sigpipe_ignored_reports_write_error -- --exact
  • cargo test --test tests test_yes::test_simple -- --exact
  • cargo test --test tests test_sort::test_sigpipe_panic -- --exact

Notes

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.

@github-actions
Copy link

github-actions bot commented Mar 9, 2026

GNU testsuite comparison:

Note: The gnu test tests/basenc/bounded-memory is now being skipped but was previously passing.
Congrats! The gnu test tests/rm/many-dir-entries-vs-OOM is now passing!
Congrats! The gnu test tests/tail/pipe-f is now passing!

@github-actions
Copy link

github-actions bot commented Mar 9, 2026

GNU testsuite comparison:

GNU test failed: tests/misc/io-errors. tests/misc/io-errors is passing on 'main'. Maybe you have to rebase?
Skipping an intermittent issue tests/date/date-locale-hour (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/pr/bounded-memory (passes in this run but fails in the 'main' branch)
Note: The gnu test tests/tail/pipe-f is now being skipped but was previously passing.
Congrats! The gnu test tests/csplit/csplit-heap is now passing!
Congrats! The gnu test tests/rm/many-dir-entries-vs-OOM is now passing!

@github-actions
Copy link

github-actions bot commented Mar 9, 2026

GNU testsuite comparison:

GNU test failed: tests/seq/seq-epipe. tests/seq/seq-epipe is passing on 'main'. Maybe you have to rebase?
Skipping an intermittent issue tests/date/date-locale-hour (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tty/tty-eof (passes in this run but fails in the 'main' branch)
Note: The gnu test tests/unexpand/bounded-memory is now being skipped but was previously passing.
Congrats! The gnu test tests/csplit/csplit-heap is now passing!
Congrats! The gnu test tests/rm/many-dir-entries-vs-OOM is now passing!

@codspeed-hq
Copy link

codspeed-hq bot commented Mar 9, 2026

Merging this PR will not alter performance

✅ 298 untouched benchmarks
⏩ 48 skipped benchmarks1


Comparing mattsu2020:rust_refactoring (36a08c3) with main (bf955a9)

Open in CodSpeed

Footnotes

  1. 48 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@codspeed-hq
Copy link

codspeed-hq bot commented Mar 9, 2026

Unable to generate the performance report

There 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.

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.

1 participant