Repository navigation
find: respect symlink following in -lname and -ilname - #941
zhangpan2001 wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #941 +/- ##
==========================================
+ Coverage 92.79% 92.81% +0.01%
==========================================
Files 37 37
Lines 8038 8042 +4
Branches 403 404 +1
==========================================
+ Hits 7459 7464 +5
+ Misses 437 436 -1
Partials 142 142 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Merging this PR will not alter performance1 warning
Comparing |
| .no_stderr(); | ||
| } | ||
|
|
||
| #[cfg(any(unix, windows))] |
There was a problem hiding this comment.
do we need this cfg? it is always true for what we build
There was a problem hiding this comment.
thanks, i got it, removed.
| } | ||
|
|
||
| let mut command = ucmd(); | ||
| command.current_dir(root).env("LC_ALL", "C"); |
There was a problem hiding this comment.
could the cases carry the args directly (before/after the predicate)? the mode == "-follow" branches are a bit hard to follow
There was a problem hiding this comment.
okay, I updated the cases to pass the arguments and expected outputs directly.
-lname and -ilname matched valid symlinks even when find followed them with -H, -L or -follow, because both matchers always read the link target. GNU makes both false for followed symlinks; with -H, only command-line starting points are followed. Check the entry's file type first so followed links no longer match. Dangling links still match. Add tests for both predicates on command-line paths and descendants, covering dangling links and -follow before and after the predicate.
1553741 to
d5658b4
Compare
-lnameand-ilnamematched valid symlinks even whenfindfollowed them with-H,-Lor-follow, because both matchers always read the link target. GNU makes both false for followed symlinks; with-H, only command-line starting points are followed. Check the entry's file type first so followed links no longer match. Dangling links still match.Add tests for both predicates on command-line paths and descendants, covering dangling links and
-followbefore and after the predicate.