From 5d71ae2f66e04f1bb53d2bd92517bd66942b28af Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Sat, 4 Nov 2017 15:18:55 +0100 Subject: [PATCH] set bsdflags last (include immutable flag), fixes #3263 (cherry picked from commit 2c6f9634bc970eefd46fdc66642b8998f3c3fa1b) --- src/borg/archive.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/borg/archive.py b/src/borg/archive.py index 577fa8e64..b00c5be1d 100644 --- a/src/borg/archive.py +++ b/src/borg/archive.py @@ -692,11 +692,6 @@ Utilization of max. archive size: {csize_max:.0%} # some systems don't support calling utime on a symlink pass acl_set(path, item, self.numeric_owner) - if not self.nobsdflags and 'bsdflags' in item: - try: - set_flags(path, item.bsdflags, fd=fd) - 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('xattrs', {}) @@ -719,6 +714,12 @@ Utilization of max. archive size: {csize_max:.0%} set_ec(EXIT_WARNING) else: raise + # bsdflags include the immutable flag and need to be set last: + if not self.nobsdflags and 'bsdflags' in item: + try: + set_flags(path, item.bsdflags, fd=fd) + except OSError: + pass def set_meta(self, key, value): metadata = self._load_meta(self.id)