+
Skip to content

Conversation

hanbings
Copy link
Collaborator

@hanbings hanbings commented May 7, 2024

implement: #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.

  • Added dependency nix = { version = "0.28", features = ["user"] } for parsing users and groups to correctly convert to uid and gid.
  • Not implemented for Windows platforms because uid and gid or equivalent metadata are not provided in std::os::windows::fs::MetadataExt.

Copy link

codecov bot commented May 7, 2024

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 ⚠️
src/find/matchers/user.rs 67.74% 6 Missing and 4 partials ⚠️
src/find/matchers/mod.rs 76.92% 2 Missing and 4 partials ⚠️
Additional details and impacted files
@@            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     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hanbings hanbings marked this pull request as draft May 8, 2024 01:02
@hanbings hanbings changed the title find: Implement [no]user and [no]group predicates. find: Implement -[no]user and -[no]group predicates. May 8, 2024
@hanbings
Copy link
Collaborator Author

hanbings commented May 8, 2024

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:

  • Copy the files from Windows to a USB drive, then plug in the Linux device and retrieve the files.
  • Create a user on Linux, create files using the new user created, then delete the new user and retrieve the created files.

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.

@hanbings hanbings marked this pull request as ready for review May 8, 2024 09:42
@cakebaker cakebaker linked an issue May 13, 2024 that may be closed by this pull request
@sylvestre
Copy link
Contributor

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

@hanbings
Copy link
Collaborator Author

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
Copy link
Collaborator Author

Hi, I have completed the content of #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
Copy link
Contributor

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
#400

@sylvestre sylvestre merged commit a2e350c into uutils:main Jun 23, 2024
@hanbings hanbings deleted the implement-7 branch June 23, 2024 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FeatureComplete: implement [no]user and [no]group predicates

2 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载