uutils / findutils

Rust implementation of findutils
MIT License
280 stars 35 forks source link

find: Implement `-[no]user` and `-[no]group` predicates. #368

Closed hanbings closed 1 week ago

hanbings commented 1 month ago

implement: https://github.com/uutils/findutils/issues/7

This PR implements -user and -group, and also adds -nouser and -nogroup predicates to filter out files outside a specific user or group. and add -nouser and -nogroup to filter the files of deleted users or deleted groups.

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 80.00000% with 26 lines in your changes missing coverage. Please review.

Project coverage is 60.08%. Comparing base (d35aebf) to head (31e2809).

Files Patch % Lines
src/find/matchers/group.rs 67.74% 6 Missing and 4 partials :warning:
src/find/matchers/user.rs 67.74% 6 Missing and 4 partials :warning:
src/find/matchers/mod.rs 76.92% 2 Missing and 4 partials :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #368 +/- ## ========================================== + Coverage 59.59% 60.08% +0.48% ========================================== Files 30 32 +2 Lines 3891 4021 +130 Branches 862 889 +27 ========================================== + Hits 2319 2416 +97 - Misses 1240 1254 +14 - Partials 332 351 +19 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

hanbings commented 1 month ago

Reimplemented -nouser and -nogroup.

Used to retrieve files for which user and group attributes do not exist (but uid or gid may exist). For example:

Regarding integration testing: Because running tests for these codes on the target system requires the creation of a new user, which may cause insecurity, the relevant test code is not included.

sylvestre commented 1 month ago

The CI fails, could you please have a look? Thanks

hanbings commented 1 month ago

The CI fails, could you please have a look? Thanks

Sorry for the late reply, I have submitted the fix related to the current PR. There is also another issue with file paths in Windows tests, but it is not part of this. I will open a new PR to fix it later.

hanbings commented 1 week ago

Hi, I have completed the content of https://github.com/uutils/findutils/issues/371 (-uid and -gid) on my branch, I think these features have the same characteristics as -user and -group to form a complete function and the amount of code is not very large (30 lines of functional code, the rest is test code).

I would like to merge them into the branch of the current PR. How about it?

sylvestre commented 1 week ago

With the GNU testsuite: Warning: Changes from main: PASS +0 / FAIL +0 / ERROR +0 / SKIP +0 BFS: Warning: Changes from main: PASS +4 / SKIP +0 / FAIL -4

Nice :) would be nice to finish https://github.com/uutils/findutils/pull/400