Skip to content

tar: show link targets and local times in -tv listings - #409

Merged
sylvestre merged 4 commits into
uutils:mainfrom
jayhemnani9910:list-verbose-links-local-time
Oct 21, 2026
Merged

sylvestre merged 4 commits into
uutils:mainfrom
jayhemnani9910:list-verbose-links-local-time

Conversation

@jayhemnani9910

Copy link
Copy Markdown
Contributor

tar -tvf prints times in UTC, lists a hard link as a regular file of size 0, and leaves out the target of symlinks and hard links. GNU tar 1.35 on the same archive (TZ=Asia/Kolkata):

GNU:   lrwxrwxrwx po/po             0 2026-10-21 03:18 d/link -> a.txt
       hrw-r----- po/po             0 2026-10-21 03:18 d/a.txt link to d/hard
main:  lrwxrwxrwx po/po        0 2026-10-20 21:48 d/link
       -rw-r----- po/po        0 2026-10-20 21:48 d/a.txt

The time is now formatted with chrono::Local (the clock feature is already on), hard links get h, and symlinks get -> target and hard links link to target, like GNU. Column widths are unchanged.

Two new tests in tests/by-util/test_tar.rs fail without the change: the links listing, and TZ=Asia/Kolkata with mtime 0 giving 1970-01-01 05:30. cargo test --workspace passes, cargo fmt --check and cargo clippy --all-targets are clean. On a GNU-made archive with a symlink, a hard link, a long name and a non-ASCII name, the output matches GNU tar apart from column padding, in Asia/Kolkata and America/New_York.

Not handled:

  • link targets are printed as-is, like names are today, so a newline, tab or invalid UTF-8 isn't escaped the way GNU does
  • with an invalid TZ (TZ=Foo/Bar) chrono falls back to the system's local time, GNU uses UTC

#277 and #384 change the same function; I'll rebase on whichever lands first.

Copilot AI balanced review requested due to automatic review settings October 21, 2026 05:34

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.

@codecov

codecov Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #409      +/-   ##
==========================================
+ Coverage   96.84%   98.09%   +1.24%     
==========================================
  Files          11       15       +4     
  Lines        1492     1891     +399     
  Branches       29       38       +9     
==========================================
+ Hits         1445     1855     +410     
+ Misses         46       35      -11     
  Partials        1        1              
Flag Coverage Δ
macos_latest 98.09% <100.00%> (+1.24%) ⬆️
ubuntu_latest 98.09% <100.00%> (+1.24%) ⬆️
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.

@codspeed

codspeed Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

⚠️ 4 benchmarks spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

✅ 7 untouched benchmarks


Comparing jayhemnani9910:list-verbose-links-local-time (c886ba4) with main (fe45640)

Open in CodSpeed

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

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/list.rs Outdated
.unwrap_or_else(Local::now);
let date_str = dt.format("%Y-%m-%d %H:%M");

let link = match entry_type {

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.

two matches on entry_type in a row, could be a single one, 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.

Done in c886ba4, one match on the type and the link name.

Comment thread tests/by-util/test_tar.rs Outdated
at.write_bytes("epoch.tar", &tar_bytes);

new_ucmd!()
.env("TZ", "Asia/Kolkata")

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.

Asia/Kolkata needs tzdata on the runner, could you please use a POSIX string like IST-5:30 instead?

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.

Done in c30dd70, the test uses IST-5:30 now.

Copilot AI balanced review requested due to automatic review settings October 21, 2026 07:36

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.

@sylvestre
sylvestre merged commit 5a2559e into uutils:main Oct 21, 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