Whamcloud - gitweb
LU-16605 lfs: Add -0 option to fid2path 36/51736/8
authorArshad Hussain <arshad.hussain@aeoncomputing.com>
Tue, 18 Jul 2023 11:50:47 +0000 (17:20 +0530)
committerOleg Drokin <green@whamcloud.com>
Mon, 7 Aug 2023 03:50:22 +0000 (03:50 +0000)
commit8d4f9d1befb9962335d4cbc5b89cafced286b066
treeff45ca733a39aae39c9cfc9c0c4ef35d4fae0f6f
parent7ac399c5aec01186ad4c9a7153aea400777c897f
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.

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-on: https://review.whamcloud.com/c/fs/lustre-release/+/51736
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Timothy Day <timday@amazon.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/doc/lfs-fid2path.1
lustre/tests/sanity.sh
lustre/utils/lfs.c