From 3e04fa972ad499f621474c4a980f9ccf1b66fe3c Mon Sep 17 00:00:00 2001 From: Marian Beermann Date: Tue, 3 Jan 2017 14:25:55 +0100 Subject: [PATCH] xattr: only skip file on BufferTooSmallError redefine __str__ to get a proper error message, not '' --- borg/xattr.py | 9 ++++++--- docs/changes.rst | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/borg/xattr.py b/borg/xattr.py index c408268a4..0c1e9f0eb 100644 --- a/borg/xattr.py +++ b/borg/xattr.py @@ -10,7 +10,7 @@ from ctypes import CDLL, create_string_buffer, c_ssize_t, c_size_t, c_char_p, c_ from ctypes.util import find_library from distutils.version import LooseVersion -from .helpers import Buffer +from .helpers import Buffer, Error try: @@ -113,8 +113,11 @@ def split_lstring(buf): return result -class BufferTooSmallError(Exception): - """the buffer given to an xattr function was too small for the result""" +class BufferTooSmallError(OSError): + """insufficient buffer memory for completing a xattr operation.""" + + def __str__(self): + return self.__doc__ def _check(rv, path=None, detect_buffer_too_small=False): diff --git a/docs/changes.rst b/docs/changes.rst index 2a860f075..7e3c876fd 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -132,6 +132,7 @@ Version 1.0.10rc1 (not released yet) Bug fixes: - Avoid triggering an ObjectiveFS bug in xattr retrieval, #1992 +- When running out of buffer memory when reading xattrs, only skip the current file, #1993 Version 1.0.9 (2016-12-20) --------------------------