Repository navigation
find: stop the -printf format at \c - #910
Conversation
There was a problem hiding this comment.
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 Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #910 +/- ##
=======================================
Coverage 92.57% 92.58%
=======================================
Files 37 37
Lines 7746 7754 +8
Branches 393 393
=======================================
+ Hits 7171 7179 +8
Misses 435 435
Partials 140 140 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Merging this PR will not alter performance1 warning
Comparing |
|
Commit ccabaef has test result changes: GNU findutils testsuite: bfs testsuite: |
\c flushed the output but went on with the rest of the format, so -printf "%f\c%s\n" printed the size and newline too. GNU find stops printing from that format there: "Stop printing from this format immediately and flush the output."
ccabaef to
caea6a0
Compare
There was a problem hiding this comment.
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.
|
Commit caea6a0 has test result changes: GNU findutils testsuite: bfs testsuite: |
|
|
||
| let matcher = Printf::new("%f\\c%s\n", None).unwrap(); | ||
| assert!(matcher.matches(&file_info, &mut deps.new_matcher_io())); | ||
| assert_eq!("abbbc", deps.get_output_as_string()); |
There was a problem hiding this comment.
in a new PR, could you please also add a test with a second -printf after the \c, to show the next action still runs?
GNU find's manual says
\cin a-printfformat means "Stop printing from this format immediately and flush the output." Here it only flushes, and the rest of the format is still printed:The output loop now breaks after the flush. Later actions still run, as in GNU (the
Zabove), and-fprintfgoes through the same code.Tests:
test_printf_backslash_c_stops_the_formatchecks that%f\c%s\nprints only the name. It fails on main.cargo test: 429 passed (428 on main), clippy and rustfmt clean. ComparedA\cB\n,%p\c%s\n,\c,x\n\cy,[%f]\cand%p\n, each followed by another-printf, with GNU find 4.10.0: all the same.