diff --git a/borg/helpers.py b/borg/helpers.py index 8643166f6..6d2b81736 100644 --- a/borg/helpers.py +++ b/borg/helpers.py @@ -277,12 +277,12 @@ def timestamp(s): def ChunkerParams(s): - window_size, chunk_mask, chunk_min, chunk_max = s.split(',') + chunk_min, chunk_max, chunk_mask, window_size = s.split(',') if int(chunk_max) > 23: # do not go beyond 2**23 (8MB) chunk size now, # COMPR_BUFFER can only cope with up to this size - raise ValueError - return int(window_size), int(chunk_mask), int(chunk_min), int(chunk_max) + raise ValueError('max. chunk size exponent must not be more than 23 (2^23 = 8MiB max. chunk size)') + return int(chunk_min), int(chunk_max), int(chunk_mask), int(window_size) def CompressionSpec(s): diff --git a/borg/testsuite/helpers.py b/borg/testsuite/helpers.py index 76bafb5b7..b61a8268f 100644 --- a/borg/testsuite/helpers.py +++ b/borg/testsuite/helpers.py @@ -7,7 +7,7 @@ import msgpack from ..helpers import adjust_patterns, exclude_path, Location, format_timedelta, ExcludePattern, make_path_safe, \ prune_within, prune_split, \ - StableDict, int_to_bigint, bigint_to_int, parse_timestamp, CompressionSpec + StableDict, int_to_bigint, bigint_to_int, parse_timestamp, CompressionSpec, ChunkerParams from . import BaseTestCase @@ -129,6 +129,13 @@ def test_compression_specs(): CompressionSpec('invalid') +def test_chunkerparams(): + assert ChunkerParams('19,23,21,4095') == (19, 23, 21, 4095) + assert ChunkerParams('10,23,16,4095') == (10, 23, 16, 4095) + with pytest.raises(ValueError): + ChunkerParams('19,24,21,4095') + + class MakePathSafeTestCase(BaseTestCase): def test(self):