Commit graph

7838 commits

Author SHA1 Message Date
TW
91c616cece
Merge pull request #9645 from ThomasWaldmann/related-repos-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
Minimal implementation of "related repositories" for Borg 1.4.x.
2026-05-15 14:25:48 +02:00
Thomas Waldmann
5035710042
Minimal implementation of "related repositories" for Borg 1.4.x.
This feature allows multiple repositories to share deduplication-relevant secrets (id_key and chunk_seed) while maintaining secure, independent encryption keys.

`borg key export-related-secrets <REPO> <SPATH>` to export the secrets to a JSON file.

`borg init --import-related-secrets <SPATH> <REPO>` to initialize a new repository using the secrets from the JSON file.

Both repositories must use the same chunk id algorithm (both HMAC-SHA256 or both BLAKE2b).

If you create related repositories with borg 1.4.x, you can later transfer their archives
to one or multiple related new borg2 repositories without breaking deduplication.

But please note that we might remove BLAKE2b support for new borg2 repos, see #8867,
so this might only work for HMAC-SHA256 in the end.
2026-05-15 13:21:00 +02:00
TW
789c5060d6
Merge pull request #9640 from ThomasWaldmann/backport-9633-to-1.4-maint
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
tests: make FakeInput usage less suspicious for code checkers
2026-05-14 09:44:39 +02:00
TW
0c6b2e8a90
Merge pull request #9641 from ThomasWaldmann/fix-test_key_export_repokey-1.4
fix test_key_export_repokey typo
2026-05-14 09:43:06 +02:00
TW
4f0098a954
Merge pull request #9642 from ThomasWaldmann/backport-9638-to-1.4-maint
docs: pull-backup.rst minor fixes (1.4-maint)
2026-05-14 09:42:30 +02:00
Thomas Waldmann
e8f61d80f3 docs: backport #9638 (minor fixes) to 1.4-maint 2026-05-14 00:51:29 +02:00
Thomas Waldmann
9060e8afb9 fix test_key_export_repokey typo 2026-05-14 00:47:10 +02:00
Thomas Waldmann
79ffb3fcde tests: make FakeInput usage less suspicious for code checkers 2026-05-14 00:41:34 +02:00
TW
2a9429d9d7
Merge pull request #9630 from ThomasWaldmann/pull-backup-different-arch-1.4
Some checks are pending
CodeQL / Analyze (push) Waiting to run
Windows CI / msys2-ucrt64 (push) Waiting to run
docs: sshfs + chroot does support different CPU architectures, fixes #6878
2026-05-13 22:19:22 +02:00
TW
e9a1906821
Merge pull request #9629 from ThomasWaldmann/scalability-1.4
add a FAQ entry about scalability, fixes #4742
2026-05-13 22:18:34 +02:00
Thomas Waldmann
49365617c4 docs: sshfs + chroot does support different CPU architectures, fixes #6878 2026-05-13 22:08:46 +02:00
Thomas Waldmann
2dec0d32de add a FAQ entry about scalability, fixes #4742 2026-05-13 22:01:46 +02:00
TW
1f6c026032
docs: document max_segment_size adjustment, fixes #7858
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-05-13 10:08:53 +02:00
TW
5b8184be25
docs: add section about rolling back a transaction, fixes #9270 2026-05-13 10:02:56 +02:00
TW
0d93298fd3
Merge pull request #9615 from ThomasWaldmann/docs-storage-quota-3948
docs: clarify storage quota run-time settings (fixes #3948)
2026-05-13 10:00:58 +02:00
TW
f3a6898073
Merge pull request #9617 from ThomasWaldmann/docs-enospc-faq-9573
docs: add FAQ entry for full repository filesystem (fixes #9573)
2026-05-13 09:59:59 +02:00
TW
3f745f38d4
docs: add FAQ entry for bad backups and deduplication, fixes #4744 2026-05-13 09:58:58 +02:00
TW
a5bfda12e6
docs: add FAQ entry for SSH connection timeouts, fixes #5629 2026-05-13 09:57:42 +02:00
TW
62fcfea53a
Merge pull request #9614 from ThomasWaldmann/docs-macos-keychain-5156
docs: improve macOS Keychain instructions (fixes #5156)
2026-05-13 09:56:42 +02:00
TW
d84eeea84d
docs: add DoS warning for none encryption mode, fixes #6715 2026-05-13 09:55:36 +02:00
Thomas Waldmann
4cbaab5d29 docs: add FAQ entry for full repository filesystem, fixes #9573 2026-05-13 09:53:41 +02:00
TW
0e94055d27
docs: document error handling in borg create, fixes #4912 2026-05-13 09:48:34 +02:00
Thomas Waldmann
7f4ebba21a
docs: clarify storage quota run-time settings (fixes #3948) 2026-05-13 01:22:03 +02:00
Thomas Waldmann
fb8bab1c2d
docs: improve macOS Keychain instructions (fixes #5156) 2026-05-13 01:14:24 +02:00
TW
1d420a9a61
Merge pull request #9610 from ThomasWaldmann/slashdot-root-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
Fix slashdot hack excluding source directory metadata, fixes #9534
2026-05-12 23:27:25 +02:00
Thomas Waldmann
452075db28
Fix slashdot hack excluding source directory metadata, fixes #9534
When using the slashdot hack (e.g. `borg create ARCHIVE rootfs/./`),
the source directory's metadata was being excluded instead of archived as
the archive root. This happened because `create_helper` treated the
slashdot target directory the same as its parent directories (which should
be stripped), rather than recognizing it as the root of the archive.

Added a new condition in `create_helper` to detect when the current path
matches the strip prefix target exactly (`path + "/" == strip_prefix`) and
archive it as `"."` (the archive root) instead of excluding it.
2026-05-12 22:52:53 +02:00
TW
bc7814a677
Merge pull request #9601 from ThomasWaldmann/prune-stats-enhancement-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
prune: show total vs matching archives in output, fixes #9262
2026-05-12 14:08:33 +02:00
Thomas Waldmann
35abd99965 prune: show total vs matching archives in output (fixes #9262) 2026-05-11 18:58:36 +02:00
TW
1e9eddecb3
Merge pull request #9599 from ThomasWaldmann/update-changes-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
update CHANGES
2026-05-10 18:05:33 +02:00
Thomas Waldmann
08855f2f94
update CHANGES 2026-05-10 10:13:59 +02:00
TW
4e92f819d5
Merge pull request #9592 from mr-raj12/backport-9385-to-1.4-maint
platform: use F_FULLFSYNC on macOS for SyncFile data durability, fixes #9383
2026-05-08 11:35:15 +02:00
Mrityunjay Raj
a6fce7d9b8 platform: use F_FULLFSYNC on macOS for SyncFile data durability, fixes #9383
On macOS, os.fsync() is an OS-level flush (kernel page cache -> drive
write buffer). It does not issue a HW-level flush, so a power loss can
still discard data the drive has buffered. F_FULLFSYNC additionally
flushes the drive's own write buffer to persistent storage, giving true
durability guarantees.

Add fdatasync() and sync_dir() to darwin.pyx using F_FULLFSYNC with
an os.fsync() fallback for network filesystems that do not support it.
Import them in platform/__init__.py so they override the base
implementations on macOS.

Backport of #9385 to 1.4-maint.

Signed-off-by: Mrityunjay Raj <mr.raj.earth@gmail.com>
2026-05-08 00:30:48 +05:30
TW
1cf9149045
Merge pull request #9582 from ThomasWaldmann/issue-9579-quick-stats
quick stats
2026-05-05 14:27:22 +02:00
TW
9935804819
Merge pull request #9590 from ThomasWaldmann/mount-missing-user-group-1.4
mount: improve error msg when uid/gid cannot be resolved, fixes #9574
2026-05-04 23:30:36 +02:00
Thomas Waldmann
0eaa76f252
mount: improve error msg when uid/gid cannot be resolved, fixes #9574 2026-05-04 22:47:37 +02:00
TW
fc39330afe
Merge pull request #9588 from ThomasWaldmann/fix-remoterepo-1.4
remote repo fixes 1.4
2026-05-04 21:59:23 +02:00
TW
bb7bc62fe8
Merge pull request #9586 from ThomasWaldmann/fix-chunker-1.4
chunker fixes 1.4
2026-05-04 21:57:34 +02:00
TW
8cbf2596a4
Merge pull request #9575 from ThomasWaldmann/hashindex-fixes-1.4
hashindex fixes 1.4
2026-05-04 21:53:15 +02:00
TW
164e9d0cb1
Merge pull request #9587 from ThomasWaldmann/fix-lrucache-1.4
LRUCache fixes 1.4
2026-05-04 21:32:08 +02:00
TW
22049f8e8b
Merge pull request #9585 from ThomasWaldmann/fix-crypto-ll-1.4
crypto module fixes 1.4
2026-05-04 21:30:13 +02:00
Thomas Waldmann
37f66f11ab
_chunker.c: fix some bugs
- better check return value of fd.read(n) and reject if it returns more bytes than requested.
- avoid giving len<=0 to posix_fadvise(), which could drop the rest of the file from cache.
- buzhash: check for len == 0 edge case
- correctly Py_DECREF in cases of errors
- check for malloc/calloc failures
2026-05-04 21:05:05 +02:00
Thomas Waldmann
2d7d5f2482
crypto low_level: fix freeing of memory
The previous code performed allocations and buffer acquisitions before the
`try` block. If a later allocation or buffer acquisition failed, execution did
not enter the `finally` block, so resources acquired earlier in the setup path
could leak.

Move allocation and buffer acquisition into the guarded block, initialize raw
output pointers to `NULL`, and only call `PyMem_Free` or `PyBuffer_Release`
for resources that were actually acquired.
2026-05-04 20:57:00 +02:00
Thomas Waldmann
cd2f5a0648
_hashindex.c: more fixes
- avoid buckets_length integer overflow on 32bit systems via huge num_buckets
- always initialize index-> min_empty and num_empty
- correctly free memory when header validation fails.
  this is a minor issue, because borg will terminate in that case anyway.
- make it possible to lookup in compacted hashtables
- deal safely with empty index: we must use num_buckets = 1 to avoid division
  by zero and sanity check in hashindex_read.
- reinitialize upper/lower limit and min_empty after compact
- fix size_idx / fit_size / grow_size / shrink_size (mind array bounds)
- deal with growing when already at max capacity
- hashindex_resize: replace num_entries assertion, rather return error
- BaseIndex.clear: always stay in valid state
  Do not free the old index before we successfully have allocated a new one.
  This is a minor issue as the Exception raised would terminate borg anyway.
2026-05-04 20:32:13 +02:00
Thomas Waldmann
3a130ee591
extract: resolve memory leak on abandoned async requests in RemoteRepository
When a generator for get_many() or call_many() is destroyed early (for example, if a BackupError occurs during extraction and aborts fetching preloaded chunks), a GeneratorExit is raised inside call_many().

Previously, call_many() lacked a try/finally block, so it failed to mark the abandoned msgids in self.ignore_responses. When the remote server eventually sent the data, it was indefinitely cached in self.responses and self.chunkid_to_msgids, causing a memory leak.

This fix wraps the request loop in try/finally to guarantee that all pending waiting_for message IDs, as well as any unrequested preloaded chunk IDs in calls, are properly added to ignore_responses.

For example, this memory leak could be triggered when extracting files:
- by permission errors or other OSErrors with the extracted file
- if the archived file had all-zero replacement chunks or inconsistent size
2026-05-04 20:08:43 +02:00
Thomas Waldmann
32cfddc34c
LRUCache fixes
fix: resolve KeyError and memory leaks in LRUCache

- __setitem__: assign value before popping from _lru to avoid KeyError when exceeding capacity.
- clear(): clear the _lru list also to prevent stale keys causing KeyErrors during future evictions.
2026-05-04 20:08:12 +02:00
Thomas Waldmann
2c030e005b
Add quick stats for archive creation, fixes #9579
Add `--quick-stats` to `borg create` and `borg import-tar`.

This is a lightweight alternative to `--stats`: it prints the existing
per-archive statistics, but skips repository-wide cache statistics such as
"All archives" and the chunk index summary. Those repository-wide stats can be
slow because they may require walking archive metadata.

Keep existing `--stats` and `--json` behavior unchanged.
With `--json --quick-stats`, emit archive stats but omit the top-level `cache`
object so JSON output does not trigger cache stats calculation.

Reject `--stats --quick-stats` as ambiguous. Ignore `--quick-stats` with
`--dry-run`, matching the existing `--stats` dry-run behavior.
2026-05-04 19:40:46 +02:00
TW
b055b713af
Merge pull request #9583 from ThomasWaldmann/cpa10-1.4
use cross-platform-actions/action@v1.0.0, fixes #9565
2026-05-04 19:38:33 +02:00
Thomas Waldmann
86e6dd4207
use cross-platform-actions/action@v1.0.0, fixes #9565 2026-05-04 19:00:17 +02:00
TW
477f987372
Merge pull request #9522 from ThomasWaldmann/hashindex-fix-for-bigendian-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
hashindex: fix new checks for big endian archs, fixes #9521
2026-03-19 16:03:00 +01:00
Thomas Waldmann
7fd6df2514
hashindex: fix new checks for big endian archs, fixes #9521 2026-03-19 15:14:57 +01:00