Fix #815: warn (not error) for unknown -printf %X / \X directives - #832
Fix #815: warn (not error) for unknown -printf %X / \X directives#832MsfPablo wants to merge 2 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #832 +/- ##
=======================================
Coverage 91.93% 91.94%
=======================================
Files 35 35
Lines 7251 7259 +8
Branches 378 379 +1
=======================================
+ Hits 6666 6674 +8
Misses 443 443
Partials 142 142 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Merging this PR will improve performance by 11.59%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ⚡ | prune |
17 ms | 15 ms | +13.15% |
| ⚡ | printf |
36.9 ms | 33.5 ms | +10.06% |
Tip
Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.
Comparing MsfPablo:fix-815 (5bdbb8a) with main (aeb8f59)
|
Commit 69458df has test result changes: GNU findutils testsuite: bfs testsuite: |
|
Commit b7181e6 has test result changes: GNU findutils testsuite: bfs testsuite: |
|
Quick check on the new bfs failures flagged by the bot: I downloaded the most recent main-branch bfs artifact (run 31672704677 @
The only test that's genuinely missing-from-reference-but-listed-in-PR is This PR only modifies Recommend ignoring these bfs flags and merging based on the actual |
Rust 1.97 clippy with -D warnings flags the previous `match
directive_result { Ok(d) => d, Err(()) => { ... } }` as both
`manual_let_else` and `single_match_else`. Convert to the
let-else form (stable since 1.65, well under the workspace MSRV).
No behavioral change — same warning emission, same Literal return.
Co-Authored-By: Claude <noreply@anthropic.com>
|
Commit 5bdbb8a has test result changes: GNU findutils testsuite: bfs testsuite: |
Fixes #815
When the user passes an unknown
%Xdirective (e.g.%€,%q) or an unknown\Xescape (e.g.\€) to-printf, GNU find emits a warning to stderr and prints the directive text verbatim, exiting 0.The current behavior diverges in two ways:
%X— the leading%is silently dropped (%€becomes€).\X— the parser returns a hard error, so-printf '\€'exits 1 instead of 0.This change matches GNU:
%Xwith an unrecognized directive character emitsfind: warning: unrecognized format directive '%X'and renders%X(including the%) as a literal in the output.\Xwith an unrecognized escape character emitsfind: warning: unrecognized escape sequence '\X'and renders\X(including the\) as a literal.%at end-of-format and lone\at end-of-format remain hard errors (they are unparseable input, not just unhandled — GNU rejects them too).src/find/matchers/printf.rs(test_parse_escapes,test_parse_formatting) were updated to assert the new literal payloads.Validation:
🤖 Generated with Claude Code