Control: unmerge 1140857
Control: retitle 1140857 borgbackup: FTBFS and autopkgtest failures related to
output/logging
Control: tags 1140857 + fixed-upstream patch
On Sat, 27 Jun 2026 at 23:23:02 +0200, [email protected] wrote:
According to https://ci.debian.net data, your package borgbackup has an
autopkgtest regression with pytest.
[which also led to a FTBFS]
I found an upstream commit (not in a release yet) that seems to
successfully address these 8 build-time test failures, which are all
related to making assertions about borg's logging/progress/diagnostic
output:
FAILED borg/testsuite/archiver.py::ArchiverTestCase::test_extract_progress - ...
FAILED borg/testsuite/archiver.py::ArchiverTestCase::test_progress_on - Asser...
FAILED borg/testsuite/archiver.py::ArchiverCheckTestCase::test_check_usage - ...
FAILED borg/testsuite/archiver.py::RemoteArchiverTestCase::test_extract_progress
FAILED borg/testsuite/archiver.py::RemoteArchiverTestCase::test_progress_on
FAILED borg/testsuite/helpers.py::test_progress_percentage_sameline - Asserti...
FAILED borg/testsuite/helpers.py::test_progress_percentage_widechars - Assert...
FAILED borg/testsuite/helpers.py::test_progress_percentage_step - AssertionEr...
That leaves two more test failures, related to setxattr
security.capabilities while running under fakeroot:
FAILED borg/testsuite/archiver.py::ArchiverTestCase::test_extract_capabilities
FAILED
borg/testsuite/archiver.py::RemoteArchiverTestCase::test_extract_capabilities
which Santiago Vila had reported as #1137392, before the additional
regressions that were first reported in #1140857.
So let's unmerge #1137392 from #1140857 (they were previously merged by
Andrey Rakhmatullin) and use #1140857 to represent the 8 newer
logging-related failures, and #1137392 to represent the 2 older
test_extract_capabilities failures. Both bugs need to be resolved before
borgbackup will pass tests again.
Please see attached for what appears to be the upstream solution to
#1140857.
I also sent a workaround to #1137392 (disabling the use of fakeroot to
run unit tests). Combining that workaround with the upstream patch
attached here should hopefully be enough to get borgbackup compiling
again, although with reduced test coverage.
Thanks,
smcv
From: Thomas Waldmann <[email protected]>
Date: Thu, 18 Jun 2026 20:47:16 +0200
Subject: tests: reset borg.output.progress logger between tests to fix
flakiness
ProgressIndicatorBase installs a handler on the process-global
'borg.output.progress' logger and only removes it in __del__. In-process
(fork=False) command execution leaves this logger at level INFO /
propagate=False with lingering handlers, and that state leaks across tests.
When a later progress test runs, the "if not self.logger.handlers" guard
skips the stderr handler setup, so progress output goes to the logging
system instead of the stderr captured by capfd. Under xdist this surfaces
as order/distribution-dependent failures of the progress tests
(test_progress_percentage_*, test_extract_progress, test_progress_on,
test_check_usage, ...).
Add an autouse fixture that removes handlers and resets level/propagate on
the progress logger after each test. This also makes the intra-test
workaround in test_check_usage unnecessary (the progress logger level is
set per command run by _setup_implied_logging), so remove it.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Origin: upstream, 1.4.5, commit:8efc67baeee79b836747ebb54dd82c6830eb5fc3
Bug-Debian: https://bugs.debian.org/1140857
---
src/borg/testsuite/archiver.py | 2 --
src/borg/testsuite/conftest.py | 18 ++++++++++++++++++
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/borg/testsuite/archiver.py b/src/borg/testsuite/archiver.py
index acbb7f3..47d7cb1 100644
--- a/src/borg/testsuite/archiver.py
+++ b/src/borg/testsuite/archiver.py
@@ -4205,8 +4205,6 @@ class ArchiverCheckTestCase(ArchiverTestCaseBase):
self.assert_in('Starting repository check', output)
self.assert_in('Starting archive consistency check', output)
self.assert_in('Checking segments', output)
- # reset logging to new process default to avoid need for fork=True on next check
- logging.getLogger('borg.output.progress').setLevel(logging.NOTSET)
output = self.cmd('check', '-v', '--repository-only', self.repository_location, exit_code=0)
self.assert_in('Starting repository check', output)
self.assert_not_in('Starting archive consistency check', output)
diff --git a/src/borg/testsuite/conftest.py b/src/borg/testsuite/conftest.py
index bc40f33..1207096 100644
--- a/src/borg/testsuite/conftest.py
+++ b/src/borg/testsuite/conftest.py
@@ -1,3 +1,4 @@
+import logging
import os
import pytest
@@ -26,6 +27,23 @@ from borg.testsuite import are_symlinks_supported, are_hardlinks_supported, is_u
from borg.testsuite.platform import fakeroot_detected # noqa: E402
[email protected](autouse=True)
+def reset_progress_logger():
+ # ProgressIndicatorBase installs a handler on the process-global
+ # 'borg.output.progress' logger and only removes it in __del__, and in-process
+ # (fork=False) command execution leaves this logger at level INFO / propagate=False.
+ # This state leaks across tests and makes the progress tests flaky (the progress
+ # output ends up in the logging system instead of on the stderr captured by capfd).
+ # Reset it after each test to keep tests isolated.
+ yield
+ logger = logging.getLogger('borg.output.progress')
+ for handler in logger.handlers[:]:
+ logger.removeHandler(handler)
+ handler.close()
+ logger.setLevel(logging.NOTSET)
+ logger.propagate = True
+
+
@pytest.fixture(autouse=True)
def clean_env(tmpdir_factory, monkeypatch):
# avoid that we access / modify the user's normal .config / .cache directory: