Whamcloud - gitweb
LU-16605 lfs: Add -0 option to fid2path
authorArshad Hussain <arshad.hussain@aeoncomputing.com>
Tue, 18 Jul 2023 11:50:47 +0000 (17:20 +0530)
committerAndreas Dilger <adilger@whamcloud.com>
Fri, 1 Sep 2023 13:17:16 +0000 (13:17 +0000)
commitfedba2dc9773e9474ac68f9dbbc613cdcb57c231
treedb5202f4c7da5e4fd4e8b3fb09a2d4a8fbf3ca3e
parent6a7a2de5551516a759c96e91c5eb458a36efa6d7
LU-16605 lfs: Add -0 option to fid2path

Currently fid2path adds '\n' after printing
pathnames. Add '-0' option to fid2path to
add NUL('\0') at the end after printing out
pathnames instead of '\n'. This allows
pathnames that contain newlines('\n') to be
correctly interpreted by binaries like xargs.

Without -0 option:
$ lfs fid2path /mnt/lustre 0x200000401:0x1:0x0
/mnt/lustre/Test
_file
/mnt/lustre/Link_
file

With -0 option:
$ lfs fid2path -0 /mnt/lustre 0x200000401:0x1:0x0 | xargs --null
/mnt/lustre/test
_file /mnt/lustre/link_
file

Test-case sanity/226e added.

Lustre-change: https://review.whamcloud.com/51736
Lustre-commit: 8d4f9d1befb9962335d4cbc5b89cafced286b066

Test-Parameters: trivial testlist=sanity
Reported-by: Simon Westersund <simon.westersund@csc.fi>
Signed-off-by: Simon Westersund <simon.westersund@csc.fi>
Signed-off-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Change-Id: I9e3e32cde6c6abe83df48afd191ec167c74ac7e6
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Timothy Day <timday@amazon.com>
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/52213
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/doc/lfs-fid2path.1
lustre/tests/sanity.sh
lustre/utils/lfs.c