[LU-11188] Add to "lfs find" the ability to check on permissions Created: 27/Jul/18 Updated: 30/Jun/21 Resolved: 02/Jun/21 |
|
| Status: | Resolved |
| Project: | Lustre |
| Component/s: | None |
| Affects Version/s: | Lustre 2.12.0 |
| Fix Version/s: | Lustre 2.15.0 |
| Type: | Improvement | Priority: | Minor |
| Reporter: | Megan Larko | Assignee: | Guillaume Courrier |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | easy, lfs | ||
| Environment: |
CentOS 7.3 Lustre 2.9 and 2.10.4 clients |
||
| Issue Links: |
|
||||||||||||||||||||
| Rank (Obsolete): | 9223372036854775807 | ||||||||||||||||||||
| Description |
|
Adding the capability to "lfs find" to search/locate on permission of file, matching the find -perm behaviour of find(1). |
| Comments |
| Comment by Andreas Dilger [ 27/Jul/18 ] |
|
This should just be a matter of copying the code that handles "-type" or similar (with new params.fp_mode and params.fp_mode_sign fields), and then modifying it to compare the mode. The tricky part is getting the semantics correct with +/-mode, and converting symbolic modes to octal (the find(1) man page goes into depth on this issue). Starting with only "[+-]octal" may be enough for initial usefulness. The OSX find(1) man page summarizes the desired semantics nicely:
This appears to equate to st_mode & fp_mode == fp_mode and st_mode & fp_mode != 0 for '-' and '+' respectively. Newer versions of find also accept the '/' modifier as equivalent to the '+' modifier, since it avoids ambiguity with symbolic mode parsing. |
| Comment by Andreas Dilger [ 26/Apr/21 ] |
|
Hi courrier, thanks for taking on this work. Please let me know if you have any questions. For a change like this it should typically include a new sanity test as well as an update to the lustre/doc/lfs-find.1 man page. The |
| Comment by Guillaume Courrier [ 27/Apr/21 ] |
|
Hi, thanks for your help. As I'm new on this project, I'll be discovering the code as I'm working on this patch. I'll come back to you if I have questions. |
| Comment by Gerrit Updater [ 17/May/21 ] |
|
Guillaume Courrier (guillaume.courrier@cea.fr) uploaded a new patch: https://review.whamcloud.com/43715 |
| Comment by Gerrit Updater [ 02/Jun/21 ] |
|
Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/43715/ |
| Comment by Peter Jones [ 02/Jun/21 ] |
|
Landed for 2.15. Congratulations courrier |