Commit graph

7889 commits

Author SHA1 Message Date
Thomas Waldmann
c19f84da2d
Skip refcount-inspecting retry tests in remote variant
test_create_changed_file_retry_rolls_back_chunks and
test_create_erroneous_file_read_retry_rolls_back_chunks open a local
Cache/Repository to inspect chunk refcounts. In RemoteArchiverTestCase the
repo was created via a remote (__testsuite__:) location, so opening it
locally triggers the "repository was previously located at ssh://..."
relocation prompt, which reads stdin and fails under pytest.

These checks are inherently local (they poke at cache internals), so skip
them in the remote variant, like test_debug_put_get_delete_obj already does.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 11:40:30 +02:00
Thomas Waldmann
0b55c8bc29
Roll back chunks also on read errors (avoid bad refcounts)
The changed-file retry path already rolls back the chunks it added before
re-reading. Do the same when a read error (BackupOSError) interrupts reading
a file: the chunks added since the last checkpoint (item.chunks[from_chunk:])
are not referenced by any committed part item, so without rolling them back
they leak as an inflated chunk refcount (or, if content also shifted, an
orphan chunk).

The rollback lives in process_file_chunks, where from_chunk is known: chunks
before from_chunk are referenced by part files we already wrote and must be
kept; only the uncommitted tail is decref'd.

Adds test_create_erroneous_file_read_retry_rolls_back_chunks: the re-read
chunks dedup to the same ids, so the leak shows up as a too-high refcount
(not an orphan id) - the test checks refcounts directly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 11:40:29 +02:00
Thomas Waldmann
1719a68d60
Document retry source path assumption
Co-authored-by: Junie <junie@jetbrains.com>
2026-07-07 11:40:27 +02:00
Thomas Waldmann
99427e2ecd
Fix retry rollback for changed files
Co-authored-by: Junie <junie@jetbrains.com>
2026-07-07 11:40:26 +02:00
Thomas Waldmann
482ab17985
create: implement retries for individual fs files (backport of #7351)
Backport of #7351 to 1.4-maint. Retry reading a backup source file when
it raises a BackupError / BackupOSError (e.g. transient I/O error, or the
file changed while we read it):
- retry the same file after some sleep time (1ms, growing exponentially up to 10s, 10 tries)
- BackupOSError: if retries do not help, skip the file, log it with "E" status
- BackupError (changed while reading): last try backs it up, logged with "C" status

Works for borg create's builtin fs recursion, --paths-from-command and --paths-from-stdin.

1.4-specific: do NOT retry a file once checkpoint part files (.borg_part_N)
have been written for it. Re-reading it from the start would create duplicate /
inconsistent part files (concatenating all part files would then no longer yield
the complete file). ChunksProcessor.last_part_number tracks this; such a file is
kept as-is ("C") or skipped ("E") instead of being retried.

Permission errors (EPERM/EACCES) are not retried (they won't get better),
so we don't waste ~15s of backoff on every unreadable file.

Adds a ChunkerFailing test chunker (chunker-params=fail,block_size,map) to drive
the error handling, and tests:
- test_create_erroneous_file: file is read on a later retry
- test_create_no_permission_file: permission error is not retried, file skipped
- test_create_erroneous_file_with_part_files: file with part files is not retried

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 11:40:20 +02:00
TW
2f8012f838
Merge pull request #9873 from ThomasWaldmann/skip-exclude-dataless-binary-1.4
Some checks failed
CI / lint (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
Windows CI / msys2-ucrt64 (push) Has been cancelled
CI / asan_ubsan (push) Has been cancelled
CI / native_tests (push) Has been cancelled
CI / vm_tests (Haiku, false, haiku, r1beta5) (push) Has been cancelled
CI / vm_tests (NetBSD, false, netbsd, 10.1) (push) Has been cancelled
CI / vm_tests (OpenBSD, false, openbsd, 7.7) (push) Has been cancelled
CI / vm_tests (borg-freebsd-14-x86_64-gh, FreeBSD, true, freebsd, 14.3) (push) Has been cancelled
skip test_create_exclude_dataless for binary archiver (1.4-maint)
2026-07-07 06:21:41 +02:00
Thomas Waldmann
e4e22295ce skip test_create_exclude_dataless for binary archiver
Cannot patch objects in the borg.exe binary subprocess.

Co-authored-by: Junie <junie@jetbrains.com>
2026-07-07 05:41:17 +02:00
TW
a7aeef657d
Merge pull request #9867 from ThomasWaldmann/fix-testsuite-logger-leak-1.4
Some checks are pending
CI / lint (push) Waiting to run
CI / asan_ubsan (push) Blocked by required conditions
CI / native_tests (push) Blocked by required conditions
CI / vm_tests (Haiku, false, haiku, r1beta5) (push) Blocked by required conditions
CI / vm_tests (NetBSD, false, netbsd, 10.1) (push) Blocked by required conditions
CI / vm_tests (OpenBSD, false, openbsd, 7.7) (push) Blocked by required conditions
CI / vm_tests (borg-freebsd-14-x86_64-gh, FreeBSD, true, freebsd, 14.3) (push) Blocked by required conditions
CodeQL / Analyze (push) Waiting to run
Windows CI / msys2-ucrt64 (push) Waiting to run
testsuite: fix logger state leak in RemoteLoggerTestCase
2026-07-06 19:36:01 +02:00
Thomas Waldmann
17ce7b56c4
testsuite: fix logger state leak in RemoteLoggerTestCase 2026-07-06 08:49:54 +02:00
Charmi Kadi
0ee07f0cda
json: support BORG_JSON_INDENT env var for JSON output formatting
Some checks are pending
CI / lint (push) Waiting to run
CI / asan_ubsan (push) Blocked by required conditions
CI / native_tests (push) Blocked by required conditions
CI / vm_tests (Haiku, false, haiku, r1beta5) (push) Blocked by required conditions
CI / vm_tests (NetBSD, false, netbsd, 10.1) (push) Blocked by required conditions
CI / vm_tests (OpenBSD, false, openbsd, 7.7) (push) Blocked by required conditions
CI / vm_tests (borg-freebsd-14-x86_64-gh, FreeBSD, true, freebsd, 14.3) (push) Blocked by required conditions
CodeQL / Analyze (push) Waiting to run
Windows CI / msys2-ucrt64 (push) Waiting to run
2026-07-06 07:53:05 +02:00
TW
8d715e030b
Merge pull request #9810 from ThomasWaldmann/env-hostname-username-1.4
Some checks are pending
CI / lint (push) Waiting to run
CI / asan_ubsan (push) Blocked by required conditions
CI / native_tests (push) Blocked by required conditions
CI / vm_tests (Haiku, false, haiku, r1beta5) (push) Blocked by required conditions
CI / vm_tests (NetBSD, false, netbsd, 10.1) (push) Blocked by required conditions
CI / vm_tests (OpenBSD, false, openbsd, 7.7) (push) Blocked by required conditions
CI / vm_tests (borg-freebsd-14-x86_64-gh, FreeBSD, true, freebsd, 14.3) (push) Blocked by required conditions
CodeQL / Analyze (push) Waiting to run
Windows CI / msys2-ucrt64 (push) Waiting to run
Support BORG_HOSTNAME and BORG_USERNAME env vars, fixes #9651
2026-07-05 14:56:09 +02:00
TW
c908d2485e
Merge pull request #9859 from PhrozenByte/drop-symlink-mount-warning
Some checks are pending
CI / lint (push) Waiting to run
CI / asan_ubsan (push) Blocked by required conditions
CI / native_tests (push) Blocked by required conditions
CI / vm_tests (Haiku, false, haiku, r1beta5) (push) Blocked by required conditions
CI / vm_tests (NetBSD, false, netbsd, 10.1) (push) Blocked by required conditions
CI / vm_tests (OpenBSD, false, openbsd, 7.7) (push) Blocked by required conditions
CI / vm_tests (borg-freebsd-14-x86_64-gh, FreeBSD, true, freebsd, 14.3) (push) Blocked by required conditions
CodeQL / Analyze (push) Waiting to run
Windows CI / msys2-ucrt64 (push) Waiting to run
Drop borgfs runtime warning about symlinks and improve corresponding docs
2026-07-05 00:28:05 +02:00
Daniel Rudolf
e3f7eb7757
Improve docs note about symlink behaviour 2026-07-04 16:15:32 +02:00
Daniel Rudolf
46ed8bd6d9
Drop non-actionable borgfs warning about symlinks 2026-07-04 16:01:24 +02:00
TW
88fcfb9100
Merge pull request #9854 from ThomasWaldmann/fix-create-backup-io-repo-write-1.4
Some checks failed
CI / lint (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
Windows CI / msys2-ucrt64 (push) Has been cancelled
CI / asan_ubsan (push) Has been cancelled
CI / native_tests (push) Has been cancelled
CI / vm_tests (Haiku, false, haiku, r1beta5) (push) Has been cancelled
CI / vm_tests (NetBSD, false, netbsd, 10.1) (push) Has been cancelled
CI / vm_tests (OpenBSD, false, openbsd, 7.7) (push) Has been cancelled
CI / vm_tests (borg-freebsd-14-x86_64-gh, FreeBSD, true, freebsd, 14.3) (push) Has been cancelled
create: do not wrap repository writes in backup_io("read")
2026-07-03 20:53:06 +02:00
Thomas Waldmann
0c6e8e1e1a
create: don't wrap repository writes in backup_io('read')
process_file() ran process_file_chunks() inside `with backup_io('read')`.
That block is meant to guard reading the *source* file, but the source reads
are already guarded individually by backup_io_iter(). The outer wrapper also
caught add_chunk()'s (and maybe_checkpoint()'s) *repository* writes, so a
repository IO failure -- e.g. the repo running out of space -- was wrapped
into a per-file BackupOSError tagged "read". Borg then emitted misleading
"<path>: read: [Errno 28] No space left on device" warnings, pointlessly
retried the file, and only treated a critical repository error as a
non-critical per-file one, contrary to the BackupOSError docstring ("Any
unwrapped IO error is critical and aborts execution (for example repository
IO failure)").

In 1.4 the transactional repository still rolls the partial transaction back
on the eventual failure, so this is not data loss here (unlike borg2, where
it silently commits a corrupt archive). But the misclassification -- wrong
warning text and needless read-retries of a repository-full condition -- is
wrong regardless.

Drop the outer backup_io('read') wrapper. Source reads stay per-file
warnings (backup_io_iter is unchanged); repository OSErrors are now left
unwrapped and critical, aborting promptly with the correct error.

Verified on a space-limited macOS ramdisk: before, create emitted many
"read: [Errno 28]" retry warnings then rolled back; after, it aborts
immediately ("No space left on device, cleaning up partial transaction"),
commits no archive, and the repo stays consistent. Normal backups and
unreadable-source-file handling (per-file warning) are unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 20:14:26 +02:00
Thomas Waldmann
62e301320e
support BORG_HOSTNAME and BORG_USERNAME env vars, fixes #9651
When set, these override the hostname/username that is stored in newly
created archives and that is used for the {hostname}/{user} placeholders
(e.g. in archive names, prune --glob-archives, check). Useful to run borg
on host A but impersonate host B.

fqdn/hostid and the auto-detection are intentionally left untouched.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 20:47:29 +02:00
TW
94de5ae3d5
Merge pull request #9807 from ThomasWaldmann/update-changes-1.4
Some checks failed
CodeQL / Analyze (push) Has been cancelled
Windows CI / msys2-ucrt64 (push) Has been cancelled
Update changes (1.4-maint)
2026-06-25 19:27:30 +02:00
Thomas Waldmann
038b130202
update CHANGES 2026-06-25 18:49:23 +02:00
Thomas Waldmann
2a916de5f6
build_usage build_man 2026-06-25 18:44:56 +02:00
TW
5bfbfacf16
Merge pull request #9790 from ThomasWaldmann/support-msgpack121-1.4
Some checks failed
CI / lint (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
Windows CI / msys2-ucrt64 (push) Has been cancelled
CI / asan_ubsan (push) Has been cancelled
CI / native_tests (push) Has been cancelled
CI / vm_tests (Haiku, false, haiku, r1beta5) (push) Has been cancelled
CI / vm_tests (NetBSD, false, netbsd, 10.1) (push) Has been cancelled
CI / vm_tests (OpenBSD, false, openbsd, 7.7) (push) Has been cancelled
CI / vm_tests (borg-freebsd-14-x86_64-gh, FreeBSD, true, freebsd, 14.3) (push) Has been cancelled
support msgpack 1.2.1
2026-06-18 23:02:54 +02:00
Thomas Waldmann
b09bbed3de
Archive.delete: don't reuse msgpack Unpacker after an unpacking failure
msgpack does not support reusing an Unpacker instance after an unpacking
failure - a new instance must be created instead.

In the forced-delete path, item metadata was unpacked via "for item in
unpacker" with an "except (TypeError, ValueError)" handler. msgpack's
FormatError/StackError are ValueError subclasses, so a real unpacking
failure was caught there and the (now broken) unpacker kept being reused
for the following chunks, making them all fail too - leaking their chunk
references.

Restructure the loop to use next(unpacker) so each failure mode gets a
tight handler:
- StopIteration: buffer drained, feed next chunk
- msgpack.UnpackException: corruption; in forced mode replace the unpacker
  with a fresh instance and skip the rest of the chunk
- TypeError/ValueError: only wraps Item processing (bad types yielded)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-18 21:49:59 +02:00
Thomas Waldmann
8abdd3b8bf
support msgpack 1.2.1 2026-06-18 21:49:57 +02:00
TW
382f27cd66
Merge pull request #9792 from ThomasWaldmann/fix-logger-between-tests-1.4
tests: reset borg.output.progress logger between tests to fix flakiness
2026-06-18 21:48:23 +02:00
Thomas Waldmann
8efc67baee
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 <noreply@anthropic.com>
2026-06-18 21:18:28 +02:00
TW
bdfb50f0c6
Merge pull request #9761 from ThomasWaldmann/delete-quick-stats
Some checks failed
CI / lint (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
Windows CI / msys2-ucrt64 (push) Has been cancelled
CI / asan_ubsan (push) Has been cancelled
CI / native_tests (push) Has been cancelled
CI / vm_tests (Haiku, false, haiku, r1beta5) (push) Has been cancelled
CI / vm_tests (NetBSD, false, netbsd, 10.1) (push) Has been cancelled
CI / vm_tests (OpenBSD, false, openbsd, 7.7) (push) Has been cancelled
CI / vm_tests (borg-freebsd-14-x86_64-gh, FreeBSD, true, freebsd, 14.3) (push) Has been cancelled
delete: add --quick-stats option, fixes #9757
2026-06-11 14:45:03 +02:00
Thomas Waldmann
bf702605e7
delete: add --quick-stats option, fixes #9757
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-11 11:09:39 +02:00
TW
3768ff5bc8
Merge pull request #9760 from ThomasWaldmann/prune-quick-stats
prune: add --quick-stats option
2026-06-11 09:38:03 +02:00
TW
364438f58c
Merge pull request #9759 from ThomasWaldmann/msgpack-1.2.0
msgpack: support 1.2.0
2026-06-11 09:36:53 +02:00
Thomas Waldmann
4af701074c
prune: add --quick-stats option, fixes #9757
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-11 08:54:10 +02:00
Thomas Waldmann
2b93c83c17
msgpack: support 1.2.0, update requirements and version check
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-11 08:41:46 +02:00
TW
34ef23f354
Merge pull request #9755 from ThomasWaldmann/exclude-dataless-1.4
Some checks are pending
CI / lint (push) Waiting to run
CI / asan_ubsan (push) Blocked by required conditions
CI / native_tests (push) Blocked by required conditions
CI / vm_tests (Haiku, false, haiku, r1beta5) (push) Blocked by required conditions
CI / vm_tests (NetBSD, false, netbsd, 10.1) (push) Blocked by required conditions
CI / vm_tests (OpenBSD, false, openbsd, 7.7) (push) Blocked by required conditions
CI / vm_tests (borg-freebsd-14-x86_64-gh, FreeBSD, true, freebsd, 14.3) (push) Blocked by required conditions
CodeQL / Analyze (push) Waiting to run
Windows CI / msys2-ucrt64 (push) Waiting to run
create: add --exclude-dataless to skip cloud files not materialized locally (1.4-maint)
2026-06-10 23:21:26 +02:00
Thomas Waldmann
64ee2aaa10
create: add --exclude-dataless to skip cloud files not materialized locally, fixes #9746
macOS flags files whose content is stored in cloud storage (e.g. iCloud
Drive) and not present locally with SF_DATALESS. Reading such a file
triggers downloading its content.

With --exclude-dataless, borg create checks the flags (cheap, after
stat, before open) and skips such files/dirs, so backups do not force
a download of all cloud-stored data.

stat.SF_DATALESS is only available from Python 3.13 on, so we fall
back to the value from macOS' sys/stat.h on older Pythons.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-10 22:15:05 +02:00
TW
ba799bdab7
Merge pull request #9738 from ThomasWaldmann/pdf-docs4-1.4
Some checks failed
CodeQL / Analyze (push) Has been cancelled
Windows CI / msys2-ucrt64 (push) Has been cancelled
docs: left-align the sidebar downloads line and add separators
2026-06-09 01:54:41 +02:00
Thomas Waldmann
e182c982cc
docs: left-align the downloads line with separators above and below
Style the sidebar downloads line to align with the boxes above and the
table of contents below (padding 22px), with a horizontal separator both
between the search box and the downloads line and between the downloads
line and the table of contents.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-09 01:53:13 +02:00
TW
1fb3a0ab4d
Merge pull request #9737 from ThomasWaldmann/pdf-docs3-1.4
docs: render downloads as a single inline line below the search box
2026-06-09 01:30:37 +02:00
Thomas Waldmann
42217765a4
docs: render downloads as a single inline line below the search box
Replace the multi-line "Download docs" block with a compact single line
"Downloads: PDF | HTML | ePub" placed right below the search box.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-09 01:29:49 +02:00
TW
6b60292bde
Merge pull request #9736 from ThomasWaldmann/pdf-docs2-1.4
docs: drop stale 'resources' from latex_appendices
2026-06-09 01:17:41 +02:00
Thomas Waldmann
c7939669d0
docs: drop stale 'resources' from latex_appendices
The resources doc page was removed long ago (#2088), but it was still
referenced in latex_appendices. This went unnoticed because PDF builds
were not enabled; enabling pdf surfaced it as a doctree KeyError.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-09 01:16:53 +02:00
TW
2527cd2947
Merge pull request #9735 from ThomasWaldmann/pdf-docs-1.4
docs: offer a PDF download and link offline formats in the sidebar
2026-06-09 01:10:45 +02:00
Thomas Waldmann
1bf806b2f2
docs: offer PDF download and link offline formats in sidebar, fixes #9731
Enable the pdf format on Read the Docs (the LaTeX build config already
existed in conf.py) and add a "Download docs" section to the sidebar that
links the offline formats (PDF, HTML zip, ...). The links are populated
from the Read the Docs addons data, reusing the same mechanism as the
version selector, so they are version-correct and hidden when unavailable.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-09 01:05:46 +02:00
TW
9f987ca8a2
Merge pull request #9699 from ThomasWaldmann/fix-9697
Some checks failed
CodeQL / Analyze (push) Has been cancelled
Windows CI / msys2-ucrt64 (push) Has been cancelled
docs: fix change 'borg key change-passphrase' docs, fixes #9697
2026-06-01 20:35:53 +02:00
Thomas Waldmann
3e1f4b388e
docs: fix change 'borg key change-passphrase' docs, fixes #9697
- update to 'borg key change-passphrase' in env help
- remove outdated borg-change-passphrase man page from 2017
- remove outdated change-passphrase.rst.inc
2026-06-01 20:25:00 +02:00
TW
1379d4c6c7
Merge pull request #9682 from ThomasWaldmann/backport-year-2026-1.4-maint
update year in LICENSE and docs/conf.py (1.4-maint)
2026-05-30 15:06:19 +02:00
Thomas Waldmann
7c4952fde1
update year in LICENSE and docs/conf.py (1.4-maint)
backport of #9681

Co-authored-by: Junie <junie@jetbrains.com>
2026-05-30 14:58:40 +02:00
TW
1f356d8a87
Merge pull request #9608 from ThomasWaldmann/versioning-1.4
Some checks failed
CI / lint (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
Windows CI / msys2-ucrt64 (push) Has been cancelled
CI / asan_ubsan (push) Has been cancelled
CI / native_tests (push) Has been cancelled
CI / vm_tests (Haiku, false, haiku, r1beta5) (push) Has been cancelled
CI / vm_tests (NetBSD, false, netbsd, 10.1) (push) Has been cancelled
CI / vm_tests (OpenBSD, false, openbsd, 7.7) (push) Has been cancelled
CI / vm_tests (borg-freebsd-14-x86_64-gh, FreeBSD, true, freebsd, 14.3) (push) Has been cancelled
properly handle invalid and dev versions in version parser, fixes #9014
2026-05-17 21:12:19 +02:00
TW
32e81f6db6
Merge pull request #9649 from ThomasWaldmann/update-changes-1.4
Some checks failed
CI / lint (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
Windows CI / msys2-ucrt64 (push) Has been cancelled
CI / asan_ubsan (push) Has been cancelled
CI / native_tests (push) Has been cancelled
CI / vm_tests (Haiku, false, haiku, r1beta5) (push) Has been cancelled
CI / vm_tests (NetBSD, false, netbsd, 10.1) (push) Has been cancelled
CI / vm_tests (OpenBSD, false, openbsd, 7.7) (push) Has been cancelled
CI / vm_tests (borg-freebsd-14-x86_64-gh, FreeBSD, true, freebsd, 14.3) (push) Has been cancelled
update CHANGES
2026-05-15 22:04:09 +02:00
Thomas Waldmann
074c0c0e18
update CHANGES 2026-05-15 21:41:46 +02:00
TW
ec366d5b5f
Merge pull request #9647 from PhrozenByte/docs-slashdot-and-pattern
Document the impact of the slashdot hack to pattern matching
2026-05-15 20:46:51 +02:00
Daniel Rudolf
ae1440ed7e
Document the impact of the slashdot hack to pattern matching
... or rather that the slashdot hack doesn't impact pattern matching at all. Add a note to `borg help patterns`.
2026-05-15 14:47:44 +02:00