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

lfs fid2path should allow null byte separated output

Details

    • Bug
    • Resolution: Fixed
    • Minor
    • Lustre 2.16.0
    • Upstream
    • 3
    • 9223372036854775807

    Description

      When using 'lfs fid2path' to find all hardlinks of a FID, the links are printed out with newline characters separating them. This is unsafe, since file paths are allowed to contain newline characters as well, which makes fid2path unreliable for non-interactive use (i.e. as part of other tools, without human supervision).

      This issue is present in the master branch, so I assume it might affect all current versions.

      To mitigate this problem and not break backwards compatibility, perhaps one could add a new command line argument that changes the path separator from '\n' to '\0'? Similar to "find . -print0", for example.

      # Suggested usage:
      lfs fid2path -0 <FID>

       

      Attachments

        Activity

          [LU-16605] lfs fid2path should allow null byte separated output
          pjones Peter Jones added a comment -

          Landed for 2.16

          pjones Peter Jones added a comment - Landed for 2.16

          "Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/51626/
          Subject: LU-16605 lfs: Add -n option to fid2path
          Project: fs/lustre-release
          Branch: master
          Current Patch Set:
          Commit: a1bc7a84ce5b3b649fd590a80645f299205024c2

          gerrit Gerrit Updater added a comment - "Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/51626/ Subject: LU-16605 lfs: Add -n option to fid2path Project: fs/lustre-release Branch: master Current Patch Set: Commit: a1bc7a84ce5b3b649fd590a80645f299205024c2

          "Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/51736/
          Subject: LU-16605 lfs: Add -0 option to fid2path
          Project: fs/lustre-release
          Branch: master
          Current Patch Set:
          Commit: 8d4f9d1befb9962335d4cbc5b89cafced286b066

          gerrit Gerrit Updater added a comment - "Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/51736/ Subject: LU-16605 lfs: Add -0 option to fid2path Project: fs/lustre-release Branch: master Current Patch Set: Commit: 8d4f9d1befb9962335d4cbc5b89cafced286b066

          "Arshad Hussain <arshad.hussain@aeoncomputing.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/51736
          Subject: LU-16605 lfs: Add -0 option to fid2path
          Project: fs/lustre-release
          Branch: master
          Current Patch Set: 1
          Commit: dd442430705836fece9a51b5833cad8e21ce10ac

          gerrit Gerrit Updater added a comment - "Arshad Hussain <arshad.hussain@aeoncomputing.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/51736 Subject: LU-16605 lfs: Add -0 option to fid2path Project: fs/lustre-release Branch: master Current Patch Set: 1 Commit: dd442430705836fece9a51b5833cad8e21ce10ac

          "Arshad Hussain <arshad.hussain@aeoncomputing.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/51626
          Subject: LU-16605 lfs: Add -n option to fid2path
          Project: fs/lustre-release
          Branch: master
          Current Patch Set: 1
          Commit: 16272732f122b903d7f2896182fb626aad216d40

          gerrit Gerrit Updater added a comment - "Arshad Hussain <arshad.hussain@aeoncomputing.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/51626 Subject: LU-16605 lfs: Add -n option to fid2path Project: fs/lustre-release Branch: master Current Patch Set: 1 Commit: 16272732f122b903d7f2896182fb626aad216d40

          I think it is prett reasonable to have a "-0" option for this.

          One related improvement that I've wanted for a while is to allow printing only the filename(s) of the file instead of the whole pathname. That can be useful for debugging if the pathname is broken for some reason. There is already "-f" to print the FID, so something like "-n" to print the name(s) only. Both "-f" and "-n" could be used together.

          adilger Andreas Dilger added a comment - I think it is prett reasonable to have a " -0 " option for this. One related improvement that I've wanted for a while is to allow printing only the filename(s) of the file instead of the whole pathname. That can be useful for debugging if the pathname is broken for some reason. There is already " -f " to print the FID, so something like " -n " to print the name(s) only. Both " -f " and " -n " could be used together.

          I'll attach a patch suggestion based on our current 2.12.8_ddn18 (DDN Exascaler 5.2.6) version: lfs-fid2path.patch

          It should be fairly easy to adapt this to the master branch.

          westersund Simon Westersund added a comment - I'll attach a patch suggestion based on our current 2.12.8_ddn18 (DDN Exascaler 5.2.6) version: lfs-fid2path.patch It should be fairly easy to adapt this to the master branch.

          People

            arshad512 Arshad Hussain
            westersund Simon Westersund
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: