mirror of https://github.com/borgbackup/borg.git
Merge pull request #166 from ThomasWaldmann/fix-restore-xattrs
Fix restore xattrs
This commit is contained in:
commit
acf5ddc68d
|
@ -323,14 +323,17 @@ class Archive:
|
||||||
raise Exception('Unknown archive item type %r' % item[b'mode'])
|
raise Exception('Unknown archive item type %r' % item[b'mode'])
|
||||||
|
|
||||||
def restore_attrs(self, path, item, symlink=False, fd=None):
|
def restore_attrs(self, path, item, symlink=False, fd=None):
|
||||||
xattrs = item.get(b'xattrs')
|
xattrs = item.get(b'xattrs', {})
|
||||||
if xattrs:
|
for k, v in xattrs.items():
|
||||||
for k, v in xattrs.items():
|
try:
|
||||||
try:
|
xattr.setxattr(fd or path, k, v, follow_symlinks=False)
|
||||||
xattr.setxattr(fd or path, k, v, follow_symlinks=False)
|
except OSError as e:
|
||||||
except OSError as e:
|
if e.errno not in (errno.ENOTSUP, errno.EACCES, ):
|
||||||
if e.errno != errno.ENOTSUP:
|
# only raise if the errno is not on our ignore list:
|
||||||
raise
|
# ENOTSUP == xattrs not supported here
|
||||||
|
# EACCES == permission denied to set this specific xattr
|
||||||
|
# (this may happen related to security.* keys)
|
||||||
|
raise
|
||||||
uid = gid = None
|
uid = gid = None
|
||||||
if not self.numeric_owner:
|
if not self.numeric_owner:
|
||||||
uid = user2uid(item[b'user'])
|
uid = user2uid(item[b'user'])
|
||||||
|
|
Loading…
Reference in New Issue