Browse Source

Merge pull request #4404 from bket/wip

1.2.0a2: Fix some issues found by the testsuite
TW 6 years ago
parent
commit
aed5213c78
2 changed files with 13 additions and 5 deletions
  1. 2 2
      src/borg/platform/base.py
  2. 11 3
      src/borg/xattr.py

+ 2 - 2
src/borg/platform/base.py

@@ -61,7 +61,7 @@ def setxattr(path, name, value, *, follow_symlinks=False):
     """
     """
 
 
 
 
-def acl_get(path, item, st, numeric_owner=False):
+def acl_get(path, item, st, numeric_owner=False, fd=None):
     """
     """
     Saves ACL Entries
     Saves ACL Entries
 
 
@@ -69,7 +69,7 @@ def acl_get(path, item, st, numeric_owner=False):
     """
     """
 
 
 
 
-def acl_set(path, item, numeric_owner=False):
+def acl_set(path, item, numeric_owner=False, fd=None):
     """
     """
     Restore ACL Entries
     Restore ACL Entries
 
 

+ 11 - 3
src/borg/xattr.py

@@ -42,12 +42,20 @@ if sys.platform.startswith('linux'):
 def is_enabled(path=None):
 def is_enabled(path=None):
     """Determine if xattr is enabled on the filesystem
     """Determine if xattr is enabled on the filesystem
     """
     """
-    with tempfile.NamedTemporaryFile(dir=path, prefix='borg-tmp') as fd:
+    with tempfile.NamedTemporaryFile(dir=path, prefix='borg-tmp') as f:
+        fd = f.fileno()
+        name, value = b'user.name', b'value'
         try:
         try:
-            setxattr(fd.fileno(), b'user.name', b'value')
+            setxattr(fd, name, value)
         except OSError:
         except OSError:
             return False
             return False
-        return getxattr(fd.fileno(), b'user.name') == b'value'
+        try:
+            names = listxattr(fd)
+        except OSError:
+            return False
+        if name not in names:
+            return False
+        return getxattr(fd, name) == value
 
 
 
 
 def get_all(path, follow_symlinks=False):
 def get_all(path, follow_symlinks=False):