1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2025-03-19 18:36:07 +00:00

Fix bug where xattrs on symlinks were not correctly restored

This commit is contained in:
Jonas Borgström 2014-04-08 21:22:57 +02:00
parent e2452c3f83
commit 4bbde41466
3 changed files with 12 additions and 3 deletions

View file

@ -3,6 +3,14 @@ Attic Changelog
Here you can see the full list of changes between each Attic release.
Version 0.13
------------
(feature release, released on X)
- Fix bug where xattrs on symlinks were not correctly restored
Version 0.12
------------

View file

@ -285,7 +285,7 @@ class Archive:
if xattrs:
for k, v in xattrs.items():
try:
xattr.setxattr(fd or path, k, v)
xattr.setxattr(fd or path, k, v, follow_symlinks=False)
except OSError as e:
if e.errno != errno.ENOTSUP:
raise

View file

@ -128,13 +128,14 @@ class ArchiverTestCase(ArchiverTestCaseBase):
os.mknod('input/bdev', 0o600 | stat.S_IFBLK, os.makedev(10, 20))
# Char device
os.mknod('input/cdev', 0o600 | stat.S_IFCHR, os.makedev(30, 40))
if xattr.is_enabled():
xattr.setxattr(os.path.join(self.input_path, 'file1'), 'user.foo', b'bar')
# Hard link
os.link(os.path.join(self.input_path, 'file1'),
os.path.join(self.input_path, 'hardlink'))
# Symlink
os.symlink('somewhere', os.path.join(self.input_path, 'link1'))
if xattr.is_enabled():
xattr.setxattr(os.path.join(self.input_path, 'file1'), 'user.foo', b'bar')
xattr.setxattr(os.path.join(self.input_path, 'link1'), 'user.foo_symlink', b'bar_symlink', follow_symlinks=False)
# FIFO node
os.mkfifo(os.path.join(self.input_path, 'fifo1'))