From: Varsha Rao Date: Thu, 11 Apr 2019 07:07:46 +0000 (+0530) Subject: cephfs-shell: Change type of d_name to bytes array X-Git-Tag: v14.2.1~20^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e1dcdd0be4a7d35e41945ad2cb0829d0a6442354;p=ceph.git cephfs-shell: Change type of d_name to bytes array By reverting commit 5106582 'd_name' is always a bytes array. This produces type error wherever 'd_name' is used with 'str' type. In such cases decode it. Fixes: https://tracker.ceph.com/issues/39060 Signed-off-by: Varsha Rao (cherry picked from commit d0db22a6a51d34433fa4a2d3a423373a5684f75d) --- diff --git a/src/tools/cephfs/cephfs-shell b/src/tools/cephfs/cephfs-shell index 88e45f1aacf..15501474ed1 100644 --- a/src/tools/cephfs/cephfs-shell +++ b/src/tools/cephfs/cephfs-shell @@ -568,7 +568,7 @@ exists.') items = sorted(list_items(dir_name), key=lambda item: item.d_name) if not args.all and len(items) >= 2: - items = [i for i in items if not i.d_name.startswith('.')] + items = [i for i in items if not i.d_name.decode('utf-8').startswith('.')] flag = 0 if args.S: items = sorted(items, key=lambda item: cephfs.stat( @@ -578,7 +578,7 @@ exists.') for item in items: path = item if not isinstance(item, str): - path = item.d_name + path = item.d_name.decode('utf-8') if item.is_dir(): is_dir = True else: