Skip to content

Commit

Permalink
Changes to prevent raising IOError if xattr cannot read attributes (#743
Browse files Browse the repository at this point in the history
)
  • Loading branch information
joachimmetz authored May 31, 2023
1 parent 906a93c commit f887f48
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
4 changes: 2 additions & 2 deletions config/dpkg/changelog
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
dfvfs (20230527-1) unstable; urgency=low
dfvfs (20230531-1) unstable; urgency=low

* Auto-generated

-- Log2Timeline maintainers <log2timeline-maintainers@googlegroups.com> Sat, 27 May 2023 08:06:14 +0200
-- Log2Timeline maintainers <log2timeline-maintainers@googlegroups.com> Wed, 31 May 2023 18:17:37 +0200
2 changes: 1 addition & 1 deletion dfvfs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
storage media types and file formats.
"""

__version__ = '20230527'
__version__ = '20230531'
16 changes: 12 additions & 4 deletions dfvfs/vfs/os_file_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,21 @@ def _GetAttributes(self):
self._attributes = []

if xattr:
for name in xattr.listxattr(self._location):
try:
attribute_names = list(xattr.listxattr(self._location))
except IOError:
attribute_names = []

for name in attribute_names:
if isinstance(name, bytes):
name = os.fsdecode(name)

extended_attribute = os_attribute.OSExtendedAttribute(
self._location, name)
self._attributes.append(extended_attribute)
try:
extended_attribute = os_attribute.OSExtendedAttribute(
self._location, name)
self._attributes.append(extended_attribute)
except IOError:
pass

return self._attributes

Expand Down

0 comments on commit f887f48

Please sign in to comment.