Browse Source

BORG_MSGPACK_VERSION_CHECK=no to disable the version check, fixes #9109

(cherry picked from commit 2d63dc9a4f90283f92bf1269f17fb55a06ee25db)
Thomas Waldmann 1 week ago
parent
commit
7e6dea9408
3 changed files with 16 additions and 0 deletions
  1. 3 0
      docs/changes.rst
  2. 5 0
      docs/usage/general/environment.rst.inc
  3. 8 0
      src/borg/helpers/msgpack.py

+ 3 - 0
docs/changes.rst

@@ -163,6 +163,8 @@ New features:
 - export-tar/import-tar: support for POSIX ACLs (PAX format)
 - export-tar/import-tar: support for POSIX ACLs (PAX format)
 - list --format: add "inode" placeholder
 - list --format: add "inode" placeholder
 - improved tty-less progress reporting (--progress), #9055
 - improved tty-less progress reporting (--progress), #9055
+- BORG_MSGPACK_VERSION_CHECK=no to optionally disable the msgpack version
+  check; default is "yes", use at your own risk, #9109.
 
 
 Fixes:
 Fixes:
 
 
@@ -888,6 +890,7 @@ New features:
 
 
       borg serve --socket  # server side (not started automatically!)
       borg serve --socket  # server side (not started automatically!)
       borg -r socket:///path/to/repo ...  # client side
       borg -r socket:///path/to/repo ...  # client side
+
 - add get_runtime_dir / BORG_RUNTIME_DIR (contains e.g. .sock and .pid file)
 - add get_runtime_dir / BORG_RUNTIME_DIR (contains e.g. .sock and .pid file)
 - support shell-style alternatives, like: sh:image.{png,jpg}, #7602
 - support shell-style alternatives, like: sh:image.{png,jpg}, #7602
 
 

+ 5 - 0
docs/usage/general/environment.rst.inc

@@ -78,6 +78,11 @@ General:
         When set to no (default: yes), system information (like OS, Python version, ...) in
         When set to no (default: yes), system information (like OS, Python version, ...) in
         exceptions is not shown.
         exceptions is not shown.
         Please only use for good reasons as it makes issues harder to analyze.
         Please only use for good reasons as it makes issues harder to analyze.
+    BORG_MSGPACK_VERSION_CHECK
+        Controls whether Borg checks the ``msgpack`` version.
+        The default is ``yes`` (strict check). Set to ``no`` to disable the version check and
+        allow any installed ``msgpack`` version. Use this at your own risk; malfunctioning or
+        incompatible ``msgpack`` versions may cause subtle bugs or repository data corruption.
     BORG_FUSE_IMPL
     BORG_FUSE_IMPL
         Choose the low-level FUSE implementation borg shall use for ``borg mount``.
         Choose the low-level FUSE implementation borg shall use for ``borg mount``.
         This is a comma-separated list of implementation names, they are tried in the
         This is a comma-separated list of implementation names, they are tried in the

+ 8 - 0
src/borg/helpers/msgpack.py

@@ -46,6 +46,8 @@ Current behavior in msgpack terms
 - unpacks bin to bytes and raw to str (thus we need to convert to desired type if we want bytes from "raw")
 - unpacks bin to bytes and raw to str (thus we need to convert to desired type if we want bytes from "raw")
 """
 """
 
 
+import os
+
 from .datastruct import StableDict
 from .datastruct import StableDict
 from ..constants import *  # NOQA
 from ..constants import *  # NOQA
 
 
@@ -206,8 +208,14 @@ def is_slow_msgpack():
 
 
 def is_supported_msgpack():
 def is_supported_msgpack():
     # DO NOT CHANGE OR REMOVE! See also requirements and comments in pyproject.toml.
     # DO NOT CHANGE OR REMOVE! See also requirements and comments in pyproject.toml.
+    # This function now also respects the env var BORG_MSGPACK_VERSION_CHECK.
+    # Set BORG_MSGPACK_VERSION_CHECK=no to disable the version check at your own risk.
     import msgpack
     import msgpack
 
 
+    version_check = os.environ.get("BORG_MSGPACK_VERSION_CHECK", "yes").strip().lower()
+    if version_check == "no":
+        return True
+
     if msgpack.version in []:  # < add bad releases here to deny list
     if msgpack.version in []:  # < add bad releases here to deny list
         return False
         return False
     return (1, 0, 3) <= msgpack.version[:3] <= (1, 1, 2)
     return (1, 0, 3) <= msgpack.version[:3] <= (1, 1, 2)