Skip to content

1.2-maint: fix the testsuite#9917

Merged
ThomasWaldmann merged 8 commits into
borgbackup:1.2-maintfrom
ThomasWaldmann:1.2-fixes-rebuild
Jul 20, 2026
Merged

1.2-maint: fix the testsuite#9917
ThomasWaldmann merged 8 commits into
borgbackup:1.2-maintfrom
ThomasWaldmann:1.2-fixes-rebuild

Conversation

@ThomasWaldmann

@ThomasWaldmann ThomasWaldmann commented Jul 19, 2026

Copy link
Copy Markdown
Member

The 1.2-maint testsuite showed all sorts of issues (most were already fixed in 1.4-maint/master, but not in 1.2-maint).

Get it back into a working state.

@ThomasWaldmann ThomasWaldmann changed the title 1.2-maint: backport critical fixes (rebuild) 1.2-maint: CVE-2026-62268 and other fixes (rebuild) Jul 19, 2026
ThomasWaldmann and others added 3 commits July 19, 2026 23:27
The pip cache key used only ${{ runner.os }} ("Linux") and had an
over-broad "${{ runner.os }}-" restore-key fallback. GitHub Actions lets a
branch restore caches from the default branch (master), whose cache key is
"${{ runner.os }}-${{ runner.arch }}-pip-..." and which runs on ARM64
runners (ubuntu-24.04-arm). The bare "Linux-" fallback prefix-matches
master's "Linux-ARM64-pip-*" caches, so our x86_64 jobs were restoring an
ARM64 pip cache.

Include ${{ runner.arch }} in the key and drop the bare "${{ runner.os }}-"
restore-key so caches never cross architectures (matches how master keys it).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013bFWgq2KV6oYxmfH6Zqvp3
(cherry picked from commit 93d9571)
The Node 20 action runtimes are deprecated. Bump all actions to the current
major versions (matching what the master branch uses), which run on Node 24:

- actions/checkout v4 -> v7
- actions/setup-python v5 -> v6
- actions/cache v4 -> v6
- actions/upload-artifact v4 -> v7
- codecov/codecov-action v4 -> v7
- github/codeql-action/{init,analyze} v2 -> v4 (v2 is also fully deprecated)

msys2/setup-msys2 stays at v2 (current). Inputs used (token, env_vars,
name, path, languages) are unchanged across these bumps.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013bFWgq2KV6oYxmfH6Zqvp3
(cherry picked from commit 774983f)
…ate fails

The fifo_feeder thread blocks on os.open(fifo, O_WRONLY) until a reader
opens the FIFO. If 'borg create --read-special' exits without opening the
FIFO (e.g. it raises), the feeder stays blocked forever and t.join() hangs
the whole test worker. This turned a would-be test failure into an infinite
CI hang (observed on Linux py311-fuse2 and other jobs, but not py39-fuse2).

Drain the FIFO in the finally block so the feeder always unblocks, turning a
hang into a normal (diagnosable) test result. The OSError guard covers
FreeBSD 13 raising BlockingIOError on the non-blocking read.

Adapted from master commit 8ce3d22
("Fix test hanging reading FIFO when borg create failed", Peter Gerber)
plus the later FreeBSD BlockingIOError guard; that fix never landed on
1.4-maint or 1.2-maint.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013bFWgq2KV6oYxmfH6Zqvp3
(cherry picked from commit d03a620)
@ThomasWaldmann
ThomasWaldmann marked this pull request as draft July 19, 2026 22:17
@ThomasWaldmann ThomasWaldmann changed the title 1.2-maint: CVE-2026-62268 and other fixes (rebuild) 1.2-maint: fix the testsuite Jul 20, 2026
ThomasWaldmann and others added 4 commits July 20, 2026 14:54
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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013bFWgq2KV6oYxmfH6Zqvp3
(cherry picked from commit 196f9c8)
(cherry picked from commit 11a0a9c)
Originally, we only wanted to get rid of selinux xattrs,
but macOS also uses some xattr keys that disturb our test results,
so we filter them also.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013bFWgq2KV6oYxmfH6Zqvp3
(cherry picked from commit ac51d3e)
(cherry picked from commit 677eaaf)
The autouse test-isolation fixtures (clean_env, reset_progress_logger,
default_patches) lived only in the repo-root conftest.py. That file is not
installed with the package, and pytest does not apply a rootdir conftest's
fixtures to tests collected from a different directory tree. On CI the tests
run against the sdist-installed package via `pytest --pyargs borg.testsuite`
(tox), i.e. from site-packages/borg/testsuite/ - so the fixtures never ran
there, and tests leaked state into each other:

- BORG_NEW_PASSPHRASE leaked from test_change_passphrase, making later
  repokey `init` encrypt with the wrong passphrase -> ~330 spurious
  PassphraseWrong failures in archiver create tests.
- XDG_CONFIG_HOME was not isolated, so nonce/key tests read+wrote the real
  security dir and poisoned each other (nonce/IV assertions).
- the borg.output.progress logger handler leaked (progress test failures).

These only showed up on py>=3.10 because pytest is unpinned: py3.9 resolves
an older pytest that still applied the rootdir fixtures to --pyargs tests.

Move conftest.py into src/borg/testsuite/ (matching 1.4-maint/master) so it
is installed alongside the tests and its fixtures always apply. Adjust the
flake8 / pre-commit targets accordingly (it is now covered by `flake8 src`).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013bFWgq2KV6oYxmfH6Zqvp3
Set BORG_NEW_PASSPHRASE / BORG_PASSPHRASE via the environment_variable
context manager so they are restored after the test instead of being left
in os.environ. While the clean_env fixture (now effective, see previous
commit) already scrubs BORG_* vars between tests, not leaking them in the
first place is the correct behaviour and defends against the leak reaching
tests that bypass the fixture.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013bFWgq2KV6oYxmfH6Zqvp3
@ThomasWaldmann
ThomasWaldmann marked this pull request as ready for review July 20, 2026 13:18
@ThomasWaldmann
ThomasWaldmann merged commit e57a4c2 into borgbackup:1.2-maint Jul 20, 2026
8 of 10 checks passed
@ThomasWaldmann
ThomasWaldmann deleted the 1.2-fixes-rebuild branch July 20, 2026 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant