Skip to content

find: show allocated blocks and symlink targets in -ls - #916

Merged
sylvestre merged 1 commit into
uutils:mainfrom
jayhemnani9910:find-ls-blocks-and-link-target
Oct 24, 2026
Merged

sylvestre merged 1 commit into
uutils:mainfrom
jayhemnani9910:find-ls-blocks-and-link-target

Conversation

@jayhemnani9910

Copy link
Copy Markdown
Contributor

Two columns of -ls differ from GNU find 4.10.0:

$ truncate -s 10M sparse; printf x > one; ln -s one ln
$ find sparse one ln -ls
GNU:     ...       0 -rw-rw-r-- ... 10485760 ... sparse
         ...       4 -rw-rw-r-- ...        1 ... one
         ...       0 lrwxrwxrwx ...        3 ... ln -> one
uutils:  ...   10240 -rw-rw-r-- ... 10485760 ... sparse
         ...       4 -rw-rw-r-- ...        1 ... one
         ...       4 lrwxrwxrwx ...        3 ... ln

The blocks column was the size rounded up to 4 KiB, so a sparse file showed its full size and every small file or directory showed 4 (GNU shows 0 for both on tmpfs). It now uses st_blocks in 1 KiB units. A symlink is now followed by -> and its target.

New test find_ls_shows_allocated_blocks_and_link_target (fails on main) compares the blocks column with st_blocks and checks the target. cargo test passes (431), clippy is clean. On ext4, -ls of a directory with a sparse file, a one-byte file, a subdirectory and a symlink gives the same inode-less columns as GNU (blocks, mode, links, owner, group, size, name); the date column is left to #904.

The blocks column was the size rounded up to 4 KiB, so a sparse file showed its full size and a directory always 4; it now comes from st_blocks like GNU find. A symlink is followed by -> and its target.
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

Merging this PR will not alter performance

1 warning

⚠️ 15 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

✅ 20 untouched benchmarks


Comparing jayhemnani9910:find-ls-blocks-and-link-target (c3a6e97) with main (cc32b4f)

Open in CodSpeed

@codecov

codecov Bot commented Oct 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 92.60%. Comparing base (cc32b4f) to head (c3a6e97).

Files with missing lines Patch % Lines
src/find/matchers/ls.rs 87.50% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #916      +/-   ##
==========================================
+ Coverage   92.59%   92.60%   +0.01%     
==========================================
  Files          37       37              
  Lines        7766     7764       -2     
  Branches      394      394              
==========================================
- Hits         7191     7190       -1     
+ Misses        435      434       -1     
  Partials      140      140              

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

@sylvestre
sylvestre merged commit d75d0b0 into uutils:main Oct 24, 2026
33 of 34 checks passed
@sylvestre

Copy link
Copy Markdown
Contributor

Thanks for your PR

@jayhemnani9910
jayhemnani9910 deleted the find-ls-blocks-and-link-target branch November 13, 2026 14:32
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