| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
walkdir's min_depth()/max_depth() setters clamp min_depth down to max_depth, so an impossible range such as `-mindepth 3 -maxdepth 1` silently became `-mindepth 1 -maxdepth 1` and printed entries at depth 1. GNU find matches nothing for such a range. Detect the impossible range up front, walk the starting point only so errors for it are still reported, and discard every entry the walk yields. Fixes uutils#778
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #854 +/- ##
==========================================
+ Coverage 92.31% 92.32% +0.01%
==========================================
Files 35 35
Lines 7466 7482 +16
Branches 388 391 +3
==========================================
+ Hits 6892 6908 +16
Misses 433 433
Partials 141 141 ☔ View full report in Codecov by Harness.
|
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Fixes #778.
Problem
An empty depth range should match nothing, but uutils printed entries at depth 1.
Cause
walkdir's min_depth() and max_depth() setters both clamp min_depth down to max_depth, so -mindepth 3 -maxdepth 1 was silently turned into -mindepth 1 -maxdepth 1. Swapping the call order does not help — either setter clamps.
Fix
Detect the impossible range before building the walker. In that case walk the starting point only (max_depth(0)), so errors for a bad starting point are still reported, and discard every entry the walk yields.
Verification
Every combination below now agrees with GNU find on output and exit code, with and without -depth:
Added find_mindepth_greater_than_maxdepth, covering both traversal orders. cargo test, cargo clippy --all-targets -- -D warnings and cargo fmt --check are all clean.
No GNU source was consulted; the fix is derived from walkdir's documented clamping behaviour.