Skip to content

extract: warn when leading slashes are removed from member names - #415

Merged
sylvestre merged 3 commits into
uutils:mainfrom
jayhemnani9910:extract-warn-leading-slash
Oct 25, 2026
Merged

sylvestre merged 3 commits into
uutils:mainfrom
jayhemnani9910:extract-warn-leading-slash

Conversation

@jayhemnani9910

Copy link
Copy Markdown
Contributor

An archive with absolute member names is extracted under the current directory (tar-rs unpack_in drops the leading /), but nothing says so. GNU tar warns, once for each different prefix:

$ tar -tf abs.tar
/x/abs1.txt
//x/abs2.txt
rel.txt
/x/abs3.txt
$ tar -xf abs.tar
GNU 1.35:  tar: Removing leading `/' from member names
           tar: Removing leading `//' from member names
uutils:    (nothing)

Extraction now prints the same warning, the way create already does for its input files. The files end up in the same place as before.

New test test_extract_warns_about_leading_slashes_once_per_prefix (fails on main). cargo test --workspace passes (112), cargo fmt --check and cargo clippy --all-targets -- -D warnings are clean. On the archive above, stderr and the extracted tree are identical to GNU tar 1.35. -t still lists without the warning (GNU warns there too); list.rs is being changed by #277 and #384, so I left it.

Members with absolute names were extracted under the current directory without a word. Like GNU tar, extraction now says Removing leading `/' from member names, once for each different prefix.
Copilot AI balanced review requested due to automatic review settings October 23, 2026 06:11

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@codspeed

codspeed Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

1 warning

⚠️ 4 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 7 untouched benchmarks


Comparing jayhemnani9910:extract-warn-leading-slash (fc50e46) with main (b453849)

Open in CodSpeed

@codecov

codecov Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.26%. Comparing base (791ae26) to head (fc50e46).
⚠️ Report is 100 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #415      +/-   ##
==========================================
+ Coverage   96.84%   98.26%   +1.41%     
==========================================
  Files          11       15       +4     
  Lines        1492     2013     +521     
  Branches       29       40      +11     
==========================================
+ Hits         1445     1978     +533     
+ Misses         46       34      -12     
  Partials        1        1              
Flag Coverage Δ
macos_latest 98.26% <100.00%> (+1.41%) ⬆️
ubuntu_latest 98.26% <100.00%> (+1.41%) ⬆️
windows_latest 0.00% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI balanced review requested due to automatic review settings October 23, 2026 06:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/uu/tar/src/operations/extract.rs Outdated
out.flush().map_err(TarError::Io)?;
writeln!(
io::stderr(),
"tar: Removing leading `{}' from member names",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same string as in create.rs, could be shared, no?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, done in fc50e46: warn_removed_prefix in operations/mod.rs writes the message, and create and extract both call it.

Copilot AI balanced review requested due to automatic review settings October 25, 2026 07:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@sylvestre
sylvestre merged commit 13e7b00 into uutils:main Oct 25, 2026
20 checks passed
@sylvestre

Copy link
Copy Markdown
Contributor

Thanks for your PR

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.

3 participants