1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2025-01-01 12:45:34 +00:00

create/extract: ignore OSError if ACLs are not supported (ENOTSUP)

but do not silence other OSErrors.
This commit is contained in:
Thomas Waldmann 2024-02-25 03:06:32 +01:00
parent bafea3b5de
commit 1269c852bf
No known key found for this signature in database
GPG key ID: 243ACFA951F78E01

View file

@ -964,7 +964,11 @@ def restore_attrs(self, path, item, symlink=False, fd=None):
if not symlink:
os.chmod(path, item.mode)
if not self.noacls:
acl_set(path, item, self.numeric_ids, fd=fd)
try:
acl_set(path, item, self.numeric_ids, fd=fd)
except OSError as e:
if e.errno not in (errno.ENOTSUP,):
raise
if not self.noxattrs and "xattrs" in item:
# chown removes Linux capabilities, so set the extended attributes at the end, after chown,
# since they include the Linux capabilities in the "security.capability" attribute.
@ -1210,7 +1214,11 @@ def stat_ext_attrs(self, st, path, fd=None):
attrs["xattrs"] = StableDict(xattrs)
if not self.noacls:
with backup_io("extended stat (ACLs)"):
acl_get(path, attrs, st, self.numeric_ids, fd=fd)
try:
acl_get(path, attrs, st, self.numeric_ids, fd=fd)
except OSError as e:
if e.errno not in (errno.ENOTSUP,):
raise
return attrs
def stat_attrs(self, st, path, fd=None):