[LU-16605] lfs fid2path should allow null byte separated output Created: 01/Mar/23 Updated: 08/Sep/23 Resolved: 31/Aug/23 |
|
| Status: | Resolved |
| Project: | Lustre |
| Component/s: | None |
| Affects Version/s: | Upstream |
| Fix Version/s: | Lustre 2.16.0 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Simon Westersund | Assignee: | Arshad Hussain |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | easy, lug23dd | ||
| Attachments: |
|
||||
| Issue Links: |
|
||||
| Severity: | 3 | ||||
| Rank (Obsolete): | 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:
|
| Comments |
| Comment by Simon Westersund [ 01/Mar/23 ] |
|
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. |
| Comment by Andreas Dilger [ 01/Mar/23 ] |
|
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. |
| Comment by Gerrit Updater [ 11/Jul/23 ] |
|
"Arshad Hussain <arshad.hussain@aeoncomputing.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/51626 |
| Comment by Gerrit Updater [ 21/Jul/23 ] |
|
"Arshad Hussain <arshad.hussain@aeoncomputing.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/51736 |
| Comment by Gerrit Updater [ 07/Aug/23 ] |
|
"Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/51736/ |
| Comment by Gerrit Updater [ 31/Aug/23 ] |
|
"Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/51626/ |
| Comment by Peter Jones [ 31/Aug/23 ] |
|
Landed for 2.16 |