set bsdflags last (include immutable flag), fixes #3263

(this was discovered in borg 1.1 for Linux, but applies to OSX/BSD as well)
This commit is contained in:
Thomas Waldmann 2017-12-09 02:47:43 +01:00
parent 4823c54452
commit dab45ced20

View file

@ -490,12 +490,6 @@ Number of files: {0.stats.nfiles}'''.format(
else:
os.utime(path, None, ns=(atime, mtime), follow_symlinks=False)
acl_set(path, item, self.numeric_owner)
# Only available on OS X and FreeBSD
if has_lchflags and b'bsdflags' in item:
try:
os.lchflags(path, item[b'bsdflags'])
except OSError:
pass
# 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.
xattrs = item.get(b'xattrs', {})
@ -518,6 +512,12 @@ Number of files: {0.stats.nfiles}'''.format(
set_ec(EXIT_WARNING)
else:
raise
# Only available on OS X and FreeBSD
if has_lchflags and b'bsdflags' in item:
try:
os.lchflags(path, item[b'bsdflags'])
except OSError:
pass
def rename(self, name):
if name in self.manifest.archives: