Skip to content

find: write octal printf escapes as raw bytes - #912

Merged
sylvestre merged 1 commit into
uutils:mainfrom
zhangpan2001:fix/911-printf-octal-escapes
Oct 21, 2026
Merged

sylvestre merged 1 commit into
uutils:mainfrom
zhangpan2001:fix/911-printf-octal-escapes

Conversation

@zhangpan2001

Copy link
Copy Markdown
Contributor

The parser converted octal escapes to Unicode characters, so \377
printed c3 bf instead of ff. Store the escape as a byte and write it
directly in -printf and -fprintf. Truncate values above 0xff to match
GNU find.

Test all 512 three-digit escapes with Unicode text and %f, and check
write error handling for escaped bytes.

Fixes #911

The parser converted octal escapes to Unicode characters, so \377
printed c3 bf instead of ff. Store the escape as a byte and write it
directly in -printf and -fprintf. Truncate values above 0xff to match
GNU find.

Test all 512 three-digit escapes with Unicode text and %f, and check
write error handling for escaped bytes.

Fixes uutils#911
@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 92.57%. Comparing base (70aad4d) to head (b977848).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #912      +/-   ##
==========================================
+ Coverage   92.56%   92.57%   +0.01%     
==========================================
  Files          37       37              
  Lines        7747     7746       -1     
  Branches      393      393              
==========================================
  Hits         7171     7171              
+ Misses        436      435       -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.

@codspeed

codspeed Bot commented Oct 21, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

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

✅ 20 untouched benchmarks


Comparing zhangpan2001:fix/911-printf-octal-escapes (b977848) with main (70aad4d)

Open in CodSpeed

@sylvestre
sylvestre merged commit f967bc1 into uutils:main Oct 21, 2026
34 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.

find: -printf octal escapes emit UTF-8 instead of raw bytes

2 participants