From e1dcdd0be4a7d35e41945ad2cb0829d0a6442354 Mon Sep 17 00:00:00 2001 From: Varsha Rao Date: Thu, 11 Apr 2019 12:37:46 +0530 Subject: [PATCH] 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) --- src/tools/cephfs/cephfs-shell | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/cephfs/cephfs-shell b/src/tools/cephfs/cephfs-shell index 88e45f1aacfda..15501474ed1e7 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: -- 2.39.5