From 013edcd55869cb93db04ac41211daca3bb04df68 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Sat, 14 Feb 2026 20:25:56 +0100 Subject: [PATCH] cleanup: remove check_python() compatibility shim The check_python() function verified that the Python runtime supported 'follow_symlinks' for os.stat, os.utime, and os.chown. This check is no longer necessary because: 1. Borg now requires Python >= 3.10. 2. On POSIX systems (Linux, macOS, *BSD, Haiku, OmniOS), support for these operations relies on the *at syscalls (fstatat, etc.), which have been implemented in standard libc for well over a decade (e.g., FreeBSD 8.0+, NetBSD 6.0+, Solaris 11+). 3. On Windows (MSYS2/MinGW), Python has supported follow_symlinks for os.stat since Python 3.2. The removed check specifically inspected only os.stat on Windows, avoiding the problematic os.utime/os.chown checks. Any platform capable of running Python 3.10 will inherently support these standard file operations. --- src/borg/archiver/__init__.py | 6 ++---- src/borg/helpers/__init__.py | 2 +- src/borg/helpers/checks.py | 12 ------------ 3 files changed, 3 insertions(+), 17 deletions(-) diff --git a/src/borg/archiver/__init__.py b/src/borg/archiver/__init__.py index cce868634..7f7610fae 100644 --- a/src/borg/archiver/__init__.py +++ b/src/borg/archiver/__init__.py @@ -40,7 +40,7 @@ try: from ..helpers import format_file_size from ..helpers import remove_surrogates, text_to_json from ..helpers import DatetimeWrapper, replace_placeholders - from ..helpers import check_python, check_extension_modules + from ..helpers import check_extension_modules from ..helpers import is_slow_msgpack, is_supported_msgpack, sysinfo from ..helpers import signal_handler, raising_signal_handler, SigHup, SigTerm from ..helpers import ErrorIgnoringTextIOWrapper @@ -455,9 +455,7 @@ class Archiver( return args def prerun_checks(self, logger, is_serve): - if not is_serve: - # this is the borg *client*, we need to check the python: - check_python() + check_extension_modules() selftest(logger) diff --git a/src/borg/helpers/__init__.py b/src/borg/helpers/__init__.py index 86648ab7f..74800d6a3 100644 --- a/src/borg/helpers/__init__.py +++ b/src/borg/helpers/__init__.py @@ -10,7 +10,7 @@ import logging from collections import namedtuple from ..constants import * # NOQA -from .checks import check_extension_modules, check_python +from .checks import check_extension_modules from .datastruct import StableDict, Buffer, EfficientCollectionQueue from .errors import Error, ErrorWithTraceback, IntegrityError, DecompressionError, CancelledByUser, CommandError from .errors import RTError, modern_ec diff --git a/src/borg/helpers/checks.py b/src/borg/helpers/checks.py index b11f2230c..8c935bee7 100644 --- a/src/borg/helpers/checks.py +++ b/src/borg/helpers/checks.py @@ -1,16 +1,4 @@ -import os - from .errors import RTError -from ..platformflags import is_win32 - - -def check_python(): - if is_win32: - required_funcs = {os.stat} - else: - required_funcs = {os.stat, os.utime, os.chown} - if not os.supports_follow_symlinks.issuperset(required_funcs): - raise RTError("""FATAL: This Python was compiled for a too old (g)libc and lacks required functionality.""") def check_extension_modules():