This patch fixes segfault when calling path2fid
under interactive mode.
Before Patch
============
lfs > path2fid /mnt/lustre/a
[0x200000401:0x1:0x0]
Segmentation fault
After Patch
============
$ lfs
lfs > path2fid /mnt/lustre/a
[0x200000401:0x1:0x0]
lfs > path2fid --parent /mnt/lustre/a
[0x200000007:0x1:0x0]/a
lfs >
Testcase sanity/154h added.
Test-Parameters: trivial testlist=sanity
Signed-off-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Change-Id: I4693e0d476e9e7f570f45fd7a31d275d549245aa
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50557
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Timothy Day <timday@amazon.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
}
run_test 154g "various llapi FID tests"
+test_154h()
+{
+ (( $CLIENT_VERSION >= $(version_code 2.15.55.1) )) ||
+ skip "Need client at least version 2.15.55.1"
+
+ # Create an empty file
+ touch $DIR/$tfile
+
+ # Get FID (interactive mode) and save under $TMP/$tfile.log
+ $LFS 2>&1 <<-EOF | tee $TMP/$tfile.log
+ path2fid $DIR/$tfile
+ EOF
+
+ fid=$(cat $TMP/$tfile.log)
+ # $fid should not be empty
+ [[ ! -z $fid ]] || error "FID is empty"
+ $LFS rmfid $DIR "$fid" || error "rmfid failed for $fid"
+}
+run_test 154h "Verify interactive path2fid"
+
test_155_small_load() {
local temp=$TMP/$tfile
local file=$DIR/$tfile
}
rc = 0;
- for (path = argv + optind; *path != NULL; path++) {
+ for (path = argv + optind; optind < argc; path++, optind++) {
int err = 0;
if (!show_parents) {