From 5348292bf0fd79035b5817915922133cee8eb785 Mon Sep 17 00:00:00 2001 From: srijan-sivakumar Date: Wed, 16 Sep 2020 08:55:22 +0530 Subject: quota_fsck.py fails with UnicodeDecodeError Issue: While decoding the byte characters the quota_fsck script stumbled across a corner case wherein the file names given by the getfattr dump will cause the decoding to UTF-8 to fail with UnicodeDecodeError. Code Change: On looking through the quota_fsck.py script, it seems like the file path is actually not needed when decoding for the xattr parsing, hence the code change reflects that. Also, removed a comparison which previously existed to skip the file names as that won't be required now. Fixes: #1487 Change-Id: I8a13ab07be6c9cfafae996f17764fbb4a285bd8c Signed-off-by: srijan-sivakumar --- extras/quota/quota_fsck.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/extras/quota/quota_fsck.py b/extras/quota/quota_fsck.py index ea8d638112b..e62f7fc52a3 100755 --- a/extras/quota/quota_fsck.py +++ b/extras/quota/quota_fsck.py @@ -156,13 +156,10 @@ def get_quota_xattr_brick(dpath): xattr_dict = {} xattr_dict['parents'] = {} - for xattr in pairs: + for xattr in pairs[1:]: xattr = xattr.decode("utf-8") xattr_key = xattr.split("=")[0] - if re.search("# file:", xattr_key): - # skip the file comment - continue - elif xattr_key is "": + if xattr_key == "": # skip any empty lines continue elif not re.search("quota", xattr_key): -- cgit