From c66ef017ef58bdc47686b390c3aa969124fd6ca0 Mon Sep 17 00:00:00 2001 From: dparmar18 Date: Wed, 6 Apr 2022 20:11:06 +0530 Subject: [PATCH] cephfs-shell: get command should never create a directory on its own Descrption: When using the get command on a single file, it would append the remote path to source path and create directories that shouldn't be created. For instance, file 'foo.txt' resides at `/dir1/dir2/` and `get` command is used to copy it to /tmp/foo then it would do `/tmp/dir1/dir2/foo.txt` which is not the expected behavior. Therefore this PR intends to correct this behavior. Fixes: https://tracker.ceph.com/issues/55112 Signed-off-by: Dhairya Parmar (cherry picked from commit 64df8c2cdf352ff93404a895f2ce3a395341a6ed) --- src/tools/cephfs/cephfs-shell | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/tools/cephfs/cephfs-shell b/src/tools/cephfs/cephfs-shell index 6e4acdc2650a..4186c80dd749 100755 --- a/src/tools/cephfs/cephfs-shell +++ b/src/tools/cephfs/cephfs-shell @@ -737,8 +737,7 @@ class CephFSShell(Cmd): return copy_to_local(root_src_dir, b'-') elif is_file_exists(args.remote_path): - copy_to_local(root_src_dir, - root_dst_dir + b'/' + root_src_dir) + copy_to_local(root_src_dir, root_dst_dir) elif b'/' in root_src_dir and is_file_exists(fname[1], fname[0]): copy_to_local(root_src_dir, root_dst_dir) else: -- 2.47.3