瀏覽代碼

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

(this was discovered in borg 1.1 for Linux, but applies to OSX/BSD as well)
Thomas Waldmann 7 年之前
父節點
當前提交
dab45ced20
共有 1 個文件被更改,包括 6 次插入6 次删除
  1. 6 6
      borg/archive.py

+ 6 - 6
borg/archive.py

@@ -490,12 +490,6 @@ Number of files: {0.stats.nfiles}'''.format(
         else:
         else:
             os.utime(path, None, ns=(atime, mtime), follow_symlinks=False)
             os.utime(path, None, ns=(atime, mtime), follow_symlinks=False)
         acl_set(path, item, self.numeric_owner)
         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
         # 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.
         # the Linux capabilities in the "security.capability" attribute.
         xattrs = item.get(b'xattrs', {})
         xattrs = item.get(b'xattrs', {})
@@ -518,6 +512,12 @@ Number of files: {0.stats.nfiles}'''.format(
                     set_ec(EXIT_WARNING)
                     set_ec(EXIT_WARNING)
                 else:
                 else:
                     raise
                     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):
     def rename(self, name):
         if name in self.manifest.archives:
         if name in self.manifest.archives: