diff --git a/setup.py b/setup.py index aa95aad02..a9f93e780 100644 --- a/setup.py +++ b/setup.py @@ -49,8 +49,10 @@ install_requires = [ # if you can't satisfy the above requirement, these are versions that might # also work ok, IF you make sure to use the COMPILED version of msgpack-python, # NOT the PURE PYTHON fallback implementation: ==0.5.1, ==0.5.4 - # using any other version is not supported by borg development, feel free to - # do it on your own risk (and after own testing). + # + # Please note: + # using any other version is not supported by borg development and + # any feedback related to issues caused by this will be ignored. ] # note for package maintainers: if you package borgbackup for distribution, diff --git a/src/borg/archiver.py b/src/borg/archiver.py index 0595ea475..b50aeb6ba 100644 --- a/src/borg/archiver.py +++ b/src/borg/archiver.py @@ -55,7 +55,7 @@ from .helpers import Manifest, AI_HUMAN_SORT_KEYS from .helpers import hardlinkable from .helpers import StableDict from .helpers import check_python, check_extension_modules -from .helpers import dir_is_tagged, is_slow_msgpack, yes, sysinfo +from .helpers import dir_is_tagged, is_slow_msgpack, is_supported_msgpack, yes, sysinfo from .helpers import log_multi from .helpers import signal_handler, raising_signal_handler, SigHup, SigTerm from .helpers import ErrorIgnoringTextIOWrapper @@ -4187,6 +4187,11 @@ class Archiver: if args.show_version: logging.getLogger('borg.output.show-version').info('borgbackup version %s' % __version__) self.prerun_checks(logger) + if not is_supported_msgpack(): + logger.error("You do not have a supported version of the msgpack python package installed. Terminating.") + logger.error("This should never happen as specific, supported versions are required by our setup.py.") + logger.error("Do not contact borgbackup support about this.") + return set_ec(EXIT_ERROR) if is_slow_msgpack(): logger.warning("Using a pure-python msgpack! This will result in lower performance.") if args.debug_profile: diff --git a/src/borg/helpers/__init__.py b/src/borg/helpers/__init__.py index 5fbe62836..d2c217875 100644 --- a/src/borg/helpers/__init__.py +++ b/src/borg/helpers/__init__.py @@ -18,7 +18,7 @@ from .progress import * # NOQA from .time import * # NOQA from .yes import * # NOQA -from .msgpack import is_slow_msgpack, int_to_bigint, bigint_to_int, get_limited_unpacker +from .msgpack import is_slow_msgpack, is_supported_msgpack, int_to_bigint, bigint_to_int, get_limited_unpacker from . import msgpack """ diff --git a/src/borg/helpers/msgpack.py b/src/borg/helpers/msgpack.py index 90470c86a..70ed940cd 100644 --- a/src/borg/helpers/msgpack.py +++ b/src/borg/helpers/msgpack.py @@ -169,6 +169,13 @@ def is_slow_msgpack(): return msgpack.Packer is msgpack.fallback.Packer +def is_supported_msgpack(): + # DO NOT CHANGE OR REMOVE! See also requirements and comments in setup.py. + import msgpack + return (0, 5, 6) <= msgpack.version <= (0, 6, 0) and \ + msgpack.version not in [(0, 5, 7), (0, 5, 8), (0, 5, 9)] + + def get_limited_unpacker(kind): """return a limited Unpacker because we should not trust msgpack data received from remote""" args = dict(use_list=False, # return tuples, not lists