فهرست منبع

document follow_symlinks requirements, check libc, fixes #2507

Thomas Waldmann 8 سال پیش
والد
کامیت
b484c79bc2
3فایلهای تغییر یافته به همراه27 افزوده شده و 1 حذف شده
  1. 15 0
      docs/installation.rst
  2. 2 1
      src/borg/archiver.py
  3. 10 0
      src/borg/helpers.py

+ 15 - 0
docs/installation.rst

@@ -54,6 +54,21 @@ manages data.
 
 .. _locking: https://en.wikipedia.org/wiki/File_locking#Lock_files
 
+(G)LIBC requirements
+--------------------
+
+Borg uses some filesytem functions from Python's `os` standard library module
+with `follow_symlinks=False`. These are implemented since quite a while with
+the non-symlink-following (g)libc functions like e.g. `lstat` or `lutimes`
+(not: `stat` or `utimes`).
+
+Some stoneage systems (like RHEL/CentOS 5) and also Python interpreter binaries
+compiled to be able to run on such systems (like Python installed via Anaconda)
+might miss these functions and Borg won't be able to work correctly.
+This issue will be detected early and Borg will abort with a fatal error.
+
+For the Borg binaries, there are additional (g)libc requirements, see below.
+
 .. _distribution-package:
 
 Distribution Package

+ 2 - 1
src/borg/archiver.py

@@ -54,7 +54,7 @@ from .helpers import get_cache_dir
 from .helpers import Manifest
 from .helpers import hardlinkable
 from .helpers import StableDict
-from .helpers import check_extension_modules
+from .helpers import check_python, check_extension_modules
 from .helpers import dir_is_tagged, is_slow_msgpack, yes, sysinfo
 from .helpers import log_multi
 from .helpers import signal_handler, raising_signal_handler, SigHup, SigTerm
@@ -3829,6 +3829,7 @@ class Archiver:
         return args
 
     def prerun_checks(self, logger):
+        check_python()
         check_extension_modules()
         selftest(logger)
 

+ 10 - 0
src/borg/helpers.py

@@ -114,6 +114,16 @@ class InvalidPlaceholder(PlaceholderError):
     """Invalid placeholder "{}" in string: {}"""
 
 
+class PythonLibcTooOld(Error):
+    """FATAL: this Python was compiled for a too old (g)libc and misses required functionality."""
+
+
+def check_python():
+    required_funcs = {os.stat, os.utime}
+    if not os.supports_follow_symlinks.issuperset(required_funcs):
+        raise PythonLibcTooOld
+
+
 def check_extension_modules():
     from . import platform, compress, item
     if hashindex.API_VERSION != '1.1_01':