From b484c79bc26c7267d81495f65e519b6f70e7c311 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Thu, 18 May 2017 02:02:51 +0200 Subject: [PATCH] document follow_symlinks requirements, check libc, fixes #2507 --- docs/installation.rst | 15 +++++++++++++++ src/borg/archiver.py | 3 ++- src/borg/helpers.py | 10 ++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/docs/installation.rst b/docs/installation.rst index 3ae5bc8c7..8897fc117 100644 --- a/docs/installation.rst +++ b/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 diff --git a/src/borg/archiver.py b/src/borg/archiver.py index bc03a7f39..97f4425aa 100644 --- a/src/borg/archiver.py +++ b/src/borg/archiver.py @@ -54,7 +54,7 @@ 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 @@ def parse_args(self, args=None): return args def prerun_checks(self, logger): + check_python() check_extension_modules() selftest(logger) diff --git a/src/borg/helpers.py b/src/borg/helpers.py index a93ba710c..cd481dc0e 100644 --- a/src/borg/helpers.py +++ b/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':