Skip to content

find: avoid panic on -printf width above u16::MAX#746

Open
SAY-5 wants to merge 2 commits into
uutils:mainfrom
SAY-5:fix-printf-large-width
Open

find: avoid panic on -printf width above u16::MAX#746
SAY-5 wants to merge 2 commits into
uutils:mainfrom
SAY-5:fix-printf-large-width

Conversation

@SAY-5

@SAY-5 SAY-5 commented Jun 20, 2026

Copy link
Copy Markdown

find -printf "%111111c" (or any directive with a width above 65535) panics with Formatting argument out of range, as reported in #693. The width is passed straight into {content:>width$}, but the formatting machinery caps a runtime width at u16::MAX and panics for anything larger.

This pads the field by hand with str::repeat instead, so the output matches the requested width for any value and large widths no longer crash. Added a regression test that exercises a width of 100000.

Closes #693

Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
@codecov

codecov Bot commented Jun 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.88%. Comparing base (1ac5fe4) to head (584786c).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #746   +/-   ##
=======================================
  Coverage   91.87%   91.88%           
=======================================
  Files          35       35           
  Lines        7152     7159    +7     
  Branches      376      376           
=======================================
+ Hits         6571     6578    +7     
  Misses        437      437           
  Partials      144      144           

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

codspeed-hq Bot commented Jun 20, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 20 untouched benchmarks


Comparing SAY-5:fix-printf-large-width (584786c) with main (1ac5fe4)

Open in CodSpeed

@github-actions

Copy link
Copy Markdown

Commit 0eb072b has test result changes:

bfs testsuite:

Test results comparison:
  Current:   TOTAL: 314 / PASSED: 267 / FAILED: 41 / SKIPPED: 6
  Reference: TOTAL: 313 / PASSED: 267 / FAILED: 40 / SKIPPED: 6

Changes from main branch:
  TOTAL: +1
  PASSED: +0
  FAILED: +1

New test failures (1):
  - gnu/okdir_path_empty

Signed-off-by: say <say.apm35@gmail.com>
@github-actions

Copy link
Copy Markdown

Commit 584786c has test result changes:

bfs testsuite:

Test results comparison:
  Current:   TOTAL: 314 / PASSED: 267 / FAILED: 41 / SKIPPED: 6
  Reference: TOTAL: 313 / PASSED: 267 / FAILED: 40 / SKIPPED: 6

Changes from main branch:
  TOTAL: +1
  PASSED: +0
  FAILED: +1

New test failures (1):
  - gnu/files0_from_ok

@HackingRepo

Copy link
Copy Markdown

that issue already fixed, @SAY-5

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.

bug: find -printf panics issues

2 participants