eas_acls.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:rdiff-backup 作者: sol1 项目源码 文件源码
def read_from_rp(self, rp):
        """Set the extended attributes from an rpath"""
        try:
            attr_list = rp.conn.xattr.listxattr(encode(rp.path),
                                                rp.issym())
        except IOError, exc:
            if exc[0] in (errno.EOPNOTSUPP, errno.EPERM, errno.ETXTBSY):
                return # if not supported, consider empty
            if exc[0] in (errno.EACCES, errno.ENOENT, errno.ELOOP):
                log.Log("Warning: listattr(%s): %s" % (repr(rp.path), exc), 4)
                return
            raise
        for attr in attr_list:
            if attr.startswith('system.'):
                # Do not preserve system extended attributes
                continue
            if not rp.isdir() and attr == 'com.apple.ResourceFork':
                # Resource Fork handled elsewhere, except for directories
                continue
            try:
                self.attr_dict[attr] = \
                    rp.conn.xattr.getxattr(encode(rp.path),
                                            attr, rp.issym())
            except IOError, exc:
                # File probably modified while reading, just continue
                if exc[0] == errno.ENODATA: continue
                elif exc[0] == errno.ENOENT: break
                # Handle bug in pyxattr < 0.2.2
                elif exc[0] == errno.ERANGE: continue
                else: raise
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号