Skip to content

Handle UTF-8 decoding errors gracefully #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion btrfs-snapshots-diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def _tlv_get_string(self, attr_type, index):
(ret,) = unpack(
f'<{l_attr}s', self.stream[index + self.l_tlv : index + self.l_tlv + l_attr]
)
return index + self.l_tlv + l_attr, ret.decode('utf8')
return index + self.l_tlv + l_attr, ret.decode('utf8', errors='replace')

def _tlv_get_u64(self, attr_type, index):
attr, l_attr = unpack('<HH', self.stream[index : index + self.l_tlv])
Expand Down
1 change: 1 addition & 0 deletions create-example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ btrfs filesystem sync $old

cd $test_sub
touch file
touch weird-file-name-$'\342'%99$'\245'.txt
mkdir dir
mkfifo fifo
ln file hardlink
Expand Down