]> arthur.barton.de Git - bup.git/commitdiff
Ignore lchmod() ENOSYS (i.e. function not implemented) 0.27-rc5
authorRob Browning <rlb@defaultvalue.org>
Thu, 11 Sep 2014 18:52:04 +0000 (13:52 -0500)
committerRob Browning <rlb@defaultvalue.org>
Sat, 11 Apr 2015 18:00:33 +0000 (13:00 -0500)
When restoring symlink permissions, assume that ENOSYS means that it's
not possible to lchmod().

For comparison, it looks like tar doesn't handle lchmod() at all yet.
From the Debian tar 1.27.1 TODO:

  * Add support for restoring the attributes of symbolic links, for
    OSes like FreeBSD that have the lutimes and lchmod functions.

Thanks to Xiao LIU for reporting the problem.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
lib/bup/metadata.py

index 390c5acd0b3fea214d8ffa5e55374440ebff679e..bef806677220a899b7d5328fc44a2555f9d51767 100644 (file)
@@ -423,7 +423,10 @@ class Metadata:
                     raise
 
         if _have_lchmod:
-            os.lchmod(path, stat.S_IMODE(self.mode))
+            try:
+                os.lchmod(path, stat.S_IMODE(self.mode))
+            except errno.ENOSYS:  # Function not implemented
+                pass
         elif not stat.S_ISLNK(self.mode):
             os.chmod(path, stat.S_IMODE(self.mode))