From: Rob Browning Date: Thu, 11 Sep 2014 18:52:04 +0000 (-0500) Subject: Ignore lchmod() ENOSYS (i.e. function not implemented) X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=6e2080a451a070bf34bd6b86071f6014ba584d15;p=packages%2Fb%2Fbup.git Ignore lchmod() ENOSYS (i.e. function not implemented) 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 Tested-by: Rob Browning --- diff --git a/lib/bup/metadata.py b/lib/bup/metadata.py index 390c5ac..bef8066 100644 --- a/lib/bup/metadata.py +++ b/lib/bup/metadata.py @@ -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))