Conversation
Rust's runtime ignores SIGPIPE by default, so listing an archive through a closed reader (e.g. `tar tf foo.tar | head -1`) surfaced a noisy TarError::Io with exit code 2 instead of dying silently via SIGPIPE. Restore the default SIGPIPE disposition at startup on Unix so every output path (list, extract, create) matches GNU tar's exit status 141. Fixes uutils#263 Assisted-by: Claude <noreply@anthropic.com>
Contributor
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #360 +/- ##
==========================================
+ Coverage 96.84% 97.80% +0.95%
==========================================
Files 11 15 +4
Lines 1492 1779 +287
Branches 29 34 +5
==========================================
+ Hits 1445 1740 +295
+ Misses 46 38 -8
Partials 1 1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Fixes #263.
Problem
Rust's runtime ignores SIGPIPE by default, so when the reader of tar's stdout goes away (
tar tf foo.tar | head -1), the resultingBrokenPipeerror surfaced as a noisyTarError::Ioon stderr with exit code 2. GNU tar dies silently via SIGPIPE with exit status 141.Fix
Restore the default SIGPIPE disposition at startup (Unix only) so tar dies via SIGPIPE — exit status 141, no error output — matching GNU tar on all output paths (list, extract, create).
Testing
cargo test: 62 passed (incl. newtest_list_broken_pipe_exits_via_sigpipe, which lists an archive larger than a pipe through a closed reader and asserts death by SIGPIPE)tar -tf big.tar | head -1now yieldsecho ${PIPESTATUS[0]}= 141 (was 2)Assisted-by: Claude noreply@anthropic.com