Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-11188

Add to "lfs find" the ability to check on permissions

Details

    • Improvement
    • Resolution: Fixed
    • Minor
    • Lustre 2.15.0
    • Lustre 2.12.0
    • CentOS 7.3 Lustre 2.9 and 2.10.4 clients
    • 9223372036854775807

    Description

      Adding the capability to "lfs find" to search/locate on permission of file, matching the find -perm behaviour of find(1).

      Attachments

        Issue Links

          Activity

            [LU-11188] Add to "lfs find" the ability to check on permissions
            pjones Peter Jones added a comment -

            Landed for 2.15. Congratulations courrier

            pjones Peter Jones added a comment - Landed for 2.15. Congratulations courrier

            Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/43715/
            Subject: LU-11188 lfs: add "--perm" option to "lfs find"
            Project: fs/lustre-release
            Branch: master
            Current Patch Set:
            Commit: 06588e4a22b0ff037eafa1eee5e22521b1626904

            gerrit Gerrit Updater added a comment - Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/43715/ Subject: LU-11188 lfs: add "--perm" option to "lfs find" Project: fs/lustre-release Branch: master Current Patch Set: Commit: 06588e4a22b0ff037eafa1eee5e22521b1626904

            Guillaume Courrier (guillaume.courrier@cea.fr) uploaded a new patch: https://review.whamcloud.com/43715
            Subject: LU-11188 lfs: add "--perm" option to "lfs find"
            Project: fs/lustre-release
            Branch: master
            Current Patch Set: 1
            Commit: 964b32570787f96cc615fae17049211f591bc4eb

            gerrit Gerrit Updater added a comment - Guillaume Courrier (guillaume.courrier@cea.fr) uploaded a new patch: https://review.whamcloud.com/43715 Subject: LU-11188 lfs: add "--perm" option to "lfs find" Project: fs/lustre-release Branch: master Current Patch Set: 1 Commit: 964b32570787f96cc615fae17049211f591bc4eb

            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.

            courrier Guillaume Courrier added a comment - 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.

            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 LU-7495 ticket is very similar (possibly a bit easier than this one), while LU-10378 would be somewhat more complex.

            adilger Andreas Dilger added a comment - 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 LU-7495 ticket is very similar (possibly a bit easier than this one), while LU-10378 would be somewhat more complex.

            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:

            If the mode is preceded by a dash ('-'), this primary evaluates to true if at least all of the bits in the mode are set in the file's mode bits. If the mode is preceded by a plus ('+'), this primary evaluates to true if any of the bits in the mode are set in the file's mode bits. Otherwise, this primary evaluates to true if the bits in the mode exactly match the file's mode bits.

            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.

            adilger Andreas Dilger added a comment - 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: If the mode is preceded by a dash (' - '), this primary evaluates to true if at least all of the bits in the mode are set in the file's mode bits. If the mode is preceded by a plus (' + '), this primary evaluates to true if any of the bits in the mode are set in the file's mode bits. Otherwise, this primary evaluates to true if the bits in the mode exactly match the file's mode bits. 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.

            People

              courrier Guillaume Courrier
              mlarko Megan Larko (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: