Repository navigation
tar: print the tar: prefix once in error messages - #414
jayhemnani9910 wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
Merging this PR will not alter performance1 warning
Comparing |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #414 +/- ##
==========================================
+ Coverage 96.84% 98.17% +1.32%
==========================================
Files 11 15 +4
Lines 1492 1971 +479
Branches 29 39 +10
==========================================
+ Hits 1445 1935 +490
+ Misses 46 35 -11
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:
|
| /// tells these errors apart from fatal ones. | ||
| pub fn finish_after_previous_errors() -> UResult<()> { | ||
| writeln!(io::stderr(), "{}", TarError::PreviousErrors).map_err(TarError::Io)?; | ||
| writeln!( |
There was a problem hiding this comment.
could be report_recoverable(&TarError::PreviousErrors)?; no?
| } | ||
|
|
||
| #[test] | ||
| fn test_error_message_has_one_prefix() { |
There was a problem hiding this comment.
could you please do that in test_extract_nonexistent_archive instead?
something like .stderr_contains(": nonexistent.tar: Cannot open") plus stderr_does_not_contain("tar: tar:"), no unwrap needed
There was a problem hiding this comment.
Moved into test_extract_nonexistent_archive in 5586a94. I check stderr_does_not_contain(": tar: ") rather than "tar: tar:": the test binary is tarapp, so main prints tarapp: tar: nonexistent.tar: ... and "tar: tar:" passes there. With ": tar: " the test fails on main and passes here.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
Every fatal error is printed with the prefix twice:
GNU tar 1.35 prints
tar: nonexistent.tar: Cannot open: No such file or directory. The same happens with thelatest-commitrelease binary.The
TarErrormessages carried their owntar:, and uucore adds the utility name again whenuumainreturns the error. The messages no longer include it.report_recoverableandfinish_after_previous_errorsprint the error themselves, so they now adduucore::util_name(), which keeps the recoverable messages (tar: ../x: Member name contains '..') as they were when the binary is calledtar.Tests: a new
test_error_message_has_one_prefixfails on main. Three tests insrc/uu/tar/tests/test_errors.rschecked theDisplaytext with thetar:included; they now check it without.cargo test --workspacepasses (112),cargo fmt --checkandcargo clippy --all-targets -- -D warningsare clean.Not changed: the
Removing leading ... from member nameswarning increate.rsstill writestar:itself.