From 21ba3ff63c81b9a7bd60a3ca4e8e2891d09641ce Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Fri, 15 Dec 2017 07:08:06 +0100 Subject: [PATCH] fix lz4 deprecation warning, require lz4 >= 1.7.0 (r129) as we bundle lz4 1.8.0 now, platforms not having a recent liblz4 can now just use the bundled code. (cherry picked from commit fe48caf8533d3162a110fac317984b71d896e291) --- docs/installation.rst | 2 +- setup.py | 2 +- setup_lz4.py | 2 +- src/borg/compress.pyx | 6 +++--- src/borg/helpers.py | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/installation.rst b/docs/installation.rst index 938446215..457eec278 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -141,7 +141,7 @@ following dependencies first: optional install. * OpenSSL_ >= 1.0.0, plus development headers. * libacl_ (which depends on libattr_), both plus development headers. -* liblz4_, plus development headers. +* liblz4_ >= r129 (1.7.0), plus development headers. * some Python dependencies, pip will automatically install them for you * optionally, the llfuse_ Python package is required if you wish to mount an archive as a FUSE filesystem. See setup.py about the version requirements. diff --git a/setup.py b/setup.py index b2d785802..8c7863d29 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ import textwrap import setup_lz4 import setup_zstd -# True: use the shared liblz4 (>= TBD) from the system, False: use the bundled lz4 code +# True: use the shared liblz4 (>= 1.7.0 / r129) from the system, False: use the bundled lz4 code prefer_system_liblz4 = True # True: use the shared libzstd (>= 1.3.0) from the system, False: use the bundled zstd code diff --git a/setup_lz4.py b/setup_lz4.py index b3e122046..6e6c63f8f 100644 --- a/setup_lz4.py +++ b/setup_lz4.py @@ -25,7 +25,7 @@ def lz4_system_prefix(prefixes): filename = os.path.join(prefix, 'include', 'lz4.h') if os.path.exists(filename): with open(filename, 'r') as fd: - if 'LZ4_decompress_safe' in fd.read(): + if 'LZ4_compress_default' in fd.read(): # requires lz4 >= 1.7.0 (r129) return prefix diff --git a/src/borg/compress.pyx b/src/borg/compress.pyx index 5fc7f60dd..8fd3323ea 100644 --- a/src/borg/compress.pyx +++ b/src/borg/compress.pyx @@ -25,10 +25,10 @@ except ImportError: from .helpers import Buffer, DecompressionError -API_VERSION = '1.1_05' +API_VERSION = '1.1_06' cdef extern from "algorithms/lz4-libselect.h": - int LZ4_compress_limitedOutput(const char* source, char* dest, int inputSize, int maxOutputSize) nogil + int LZ4_compress_default(const char* source, char* dest, int inputSize, int maxOutputSize) nogil int LZ4_decompress_safe(const char* source, char* dest, int inputSize, int maxOutputSize) nogil int LZ4_compressBound(int inputSize) nogil @@ -138,7 +138,7 @@ class LZ4(CompressorBase): osize = LZ4_compressBound(isize) buf = buffer.get(osize) dest = buf - osize = LZ4_compress_limitedOutput(source, dest, isize, osize) + osize = LZ4_compress_default(source, dest, isize, osize) if not osize: raise Exception('lz4 compress failed') return super().compress(dest[:osize]) diff --git a/src/borg/helpers.py b/src/borg/helpers.py index 82fd39ff4..616a50704 100644 --- a/src/borg/helpers.py +++ b/src/borg/helpers.py @@ -135,7 +135,7 @@ def check_extension_modules(): raise ExtensionModuleError if chunker.API_VERSION != '1.1_01': raise ExtensionModuleError - if compress.API_VERSION != '1.1_05': + if compress.API_VERSION != '1.1_06': raise ExtensionModuleError if borg.crypto.low_level.API_VERSION != '1.1_02': raise ExtensionModuleError