Repository navigation
find: run -exec ... + once across all starting points - #995
sarankumar1325 wants to merge 5 commits into
Conversation
process_dir called finished() at the end of each starting point, so
'find a b -exec cmd {} +' ran cmd at least once per path. Run the
pending -exec batch once in do_find after every path is processed (or
after -quit, or when reading -files0-from fails), like GNU find.
-execdir still flushes per directory through finished_dir().
Fixes uutils#956
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
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 #995 +/- ##
=======================================
Coverage 92.44% 92.45%
=======================================
Files 38 38
Lines 8896 8907 +11
Branches 440 441 +1
=======================================
+ Hits 8224 8235 +11
Misses 532 532
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 |
The pending batch must still run before the read error is returned.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
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.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
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.
|
|
||
| // Like GNU find, -exec ... + collects arguments across all the starting | ||
| // points, so the pending batch is only run once every path is done (or | ||
| // find stops early). |
There was a problem hiding this comment.
could you please add a test for the -exec ... + -quit case too?
| } | ||
| matcher.finished(&mut matcher_io); | ||
| // This is implemented for exec +. | ||
| // This is implemented for -execdir +. |
There was a problem hiding this comment.
this comment now sits above the exit code check, could you move it above finished_dir?
…h-across-paths Signed-off-by: sarankumar1325 <120080287+sarankumar1325@users.noreply.github.com>
Signed-off-by: sarankumar1325 <120080287+sarankumar1325@users.noreply.github.com>
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
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.
Fixes #956
With several starting points,
find a b -exec cmd {} +rancmdonce per starting point, becauseprocess_dircalledfinished()at the end of each path. GNU find collects the arguments across all of them.This change:
process_dirstill callsfinished_dir()for the last directory, so-execdir ... +still runs per directory, as before.do_findcallsfinished()once, after all starting points are done. It also does this when-quitstops the loop, and when reading a-files0-fromentry fails. Batches built so far still run in that case, then the error is returned as before.Both outputs match GNU find 4.9 on my machine.
Tests:
find_exec_multi_across_starting_pointsintests/find_exec_tests.rs. It usestesting-commandlinewith two starting points and checks that there is a single invocation with all four files. On main it fails because the first invocation only has./test_data/simple/subdir/ABBBC.cargo test(all suites),cargo fmt --checkandcargo clippy --all-targets -- -D warningspass locally.I used an AI assistant (Grok Bot) to help write this change. I reviewed the diff, compared the output with GNU find and ran the tests above.