Skip to content

Commit

Permalink
extended stat: more fine grained exception handling
Browse files Browse the repository at this point in the history
see #6988: it was unclear where exactly the error came from (flags, xattrs or ACLs getting?).
  • Loading branch information
ThomasWaldmann committed Aug 23, 2022
1 parent 9bfe210 commit b5d4350
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/borg/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -1157,15 +1157,19 @@ def stat_simple_attrs(self, st):

def stat_ext_attrs(self, st, path, fd=None):
attrs = {}
with backup_io('extended stat'):
flags = 0 if self.noflags else get_flags(path, st, fd=fd)
xattrs = {} if self.noxattrs else xattr.get_all(fd or path, follow_symlinks=False)
if not self.noacls:
if not self.noflags:
with backup_io('extended stat (flags)'):
flags = get_flags(path, st, fd=fd)
if flags:
attrs['bsdflags'] = flags
if not self.noxattrs:
with backup_io('extended stat (xattrs)'):
xattrs = xattr.get_all(fd or path, follow_symlinks=False)
if xattrs:
attrs['xattrs'] = StableDict(xattrs)
if not self.noacls:
with backup_io('extended stat (ACLs)'):
acl_get(path, attrs, st, self.numeric_ids, fd=fd)
if xattrs:
attrs['xattrs'] = StableDict(xattrs)
if flags:
attrs['bsdflags'] = flags
return attrs

def stat_attrs(self, st, path, fd=None):
Expand Down

0 comments on commit b5d4350

Please sign in to comment.