Browse Source

require and use chown with follow_symlinks=False

should be equivalent to using os.lchown() before.

(cherry picked from commit 094376a8ad23c218defcc69d601be0b014965243)
Thomas Waldmann 8 years ago
parent
commit
2b3932cac6
2 changed files with 2 additions and 2 deletions
  1. 1 1
      borg/archive.py
  2. 1 1
      borg/helpers.py

+ 1 - 1
borg/archive.py

@@ -472,7 +472,7 @@ Number of files: {0.stats.nfiles}'''.format(
             if fd:
                 os.fchown(fd, uid, gid)
             else:
-                os.lchown(path, uid, gid)
+                os.chown(path, uid, gid, follow_symlinks=False)
         except OSError:
             pass
         if fd:

+ 1 - 1
borg/helpers.py

@@ -120,7 +120,7 @@ class PythonLibcTooOld(Error):
 
 
 def check_python():
-    required_funcs = {os.stat, os.utime}
+    required_funcs = {os.stat, os.utime, os.chown}
     if not os.supports_follow_symlinks.issuperset(required_funcs):
         raise PythonLibcTooOld