From 85e79f96a134c93e14873de8248021eeb5551ce4 Mon Sep 17 00:00:00 2001 From: Marian Beermann Date: Tue, 3 Jan 2017 12:47:42 +0100 Subject: [PATCH] xattr: ignore empty names returned by llistxattr(2) et al --- borg/xattr.py | 6 +++--- docs/changes.rst | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/borg/xattr.py b/borg/xattr.py index 50d1b0b81..c408268a4 100644 --- a/borg/xattr.py +++ b/borg/xattr.py @@ -205,7 +205,7 @@ if sys.platform.startswith('linux'): # pragma: linux only n, buf = _listxattr_inner(func, path) return [os.fsdecode(name) for name in split_string0(buf[:n]) - if not name.startswith(b'system.posix_acl_')] + if name and not name.startswith(b'system.posix_acl_')] def getxattr(path, name, *, follow_symlinks=True): def func(path, name, buf, size): @@ -261,7 +261,7 @@ elif sys.platform == 'darwin': # pragma: darwin only return libc.listxattr(path, buf, size, XATTR_NOFOLLOW) n, buf = _listxattr_inner(func, path) - return [os.fsdecode(name) for name in split_string0(buf[:n])] + return [os.fsdecode(name) for name in split_string0(buf[:n]) if name] def getxattr(path, name, *, follow_symlinks=True): def func(path, name, buf, size): @@ -320,7 +320,7 @@ elif sys.platform.startswith('freebsd'): # pragma: freebsd only return libc.extattr_list_link(path, ns, buf, size) n, buf = _listxattr_inner(func, path) - return [os.fsdecode(name) for name in split_lstring(buf[:n])] + return [os.fsdecode(name) for name in split_lstring(buf[:n]) if name] def getxattr(path, name, *, follow_symlinks=True): def func(path, name, buf, size): diff --git a/docs/changes.rst b/docs/changes.rst index 209893bb2..2a860f075 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -126,6 +126,13 @@ The best check that everything is ok is to run a dry-run extraction:: Changelog ========= +Version 1.0.10rc1 (not released yet) +------------------------------------ + +Bug fixes: + +- Avoid triggering an ObjectiveFS bug in xattr retrieval, #1992 + Version 1.0.9 (2016-12-20) --------------------------