Commit graph

1965 commits

Author SHA1 Message Date
TW
c710edf0df
Merge pull request #9754 from ThomasWaldmann/simplify-location-parsing
Some checks are pending
Lint / lint (push) Waiting to run
CI / lint (push) Waiting to run
CI / security (push) Waiting to run
CI / asan_ubsan (push) Blocked by required conditions
CI / native_tests (push) Blocked by required conditions
CI / vm_tests (NetBSD, false, netbsd, 10.1) (push) Blocked by required conditions
CI / vm_tests (OmniOS, false, omnios, r151056) (push) Blocked by required conditions
CI / vm_tests (OpenBSD, false, openbsd, 7.8) (push) Blocked by required conditions
CI / vm_tests (borg-freebsd-14-x86_64-gh, FreeBSD, true, freebsd, 14.3) (push) Blocked by required conditions
CI / windows_tests (push) Blocked by required conditions
CodeQL / Analyze (push) Waiting to run
Simplify location parsing, remove socket: remainders
2026-06-11 10:48:23 +02:00
Thomas Waldmann
5eab183183
remove leftover socket: protocol code
The unix-socket transport (socket:// repositories, the --socket option and
"borg serve" over a socket) was never part of a stable borg 2 release and the
old RPC protocol it relied on is gone, so the remaining code was dead:

- legacy remote: drop the unreachable proto == "socket" connection branch and
  the now-unused self.sock handling, "import socket" and get_socket_filename
  import (LegacyRemoteRepository is only built for proto == "ssh")
- helpers: remove get_socket_filename() and its export
- parseformat: drop "socket" from local_path_re - socket:// is now treated like
  any other unknown scheme (a local path) rather than being special-cased
- tests: drop test_socket and the self.sock check in the legacy reopen helper
- docs: drop the stale --socket entry from the manually maintained
  common-options.rst.inc (the auto-generated usage/man docs are left untouched
  here and will be rebuilt in a separate commit)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-10 18:51:55 +02:00
Thomas Waldmann
aa9f810453
parseformat: simplify Location parsing/validation, #9678
For sftp/http(s)/s3/b2/rclone repositories, borg only detects the scheme now
and hands the raw URL to borgstore, which parses and validates it - removing
the duplicate parsing borg used to do. Precise field extraction (user/host/
port/path) is kept only for the protocols borg itself reads: file, rest and
legacy ssh.

- drop http_re, s3_re, rclone_re and the sftp arm of the old ssh_or_sftp_re
- add a single scheme-detection pass-through against BORGSTORE_SCHEMES; reject
  unknown schemes (e.g. socket://) as before
- canonical_path() returns the processed URL for the delegated protocols, with
  embedded credentials stripped so secrets never reach the security state file
  or logs
- source local_path_re's scheme exclusions from BORGSTORE_SCHEMES
- create: use proto == "file" instead of "not location.host" for the local
  repo-dir inode skip

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-10 18:17:40 +02:00
Thomas Waldmann
0b103291b8
compact: invalidate cached chunk indexes before deleting objects, #9748
If `borg compact` was interrupted after deleting repository objects but
before writing the updated chunk index, the still-existing cache/chunks.*
kept claiming the deleted objects were present. A later `borg create` would
trust that stale index, skip re-uploading the affected chunks and silently
create an archive with dangling object references that extracts to zero bytes.

Invalidate all cached chunk indexes via delete_chunkindex_cache() before the
first object is deleted, so an interruption is conservative: the next client
rebuilds the index from actual repository contents and re-uploads any deleted
data. The post-deletion save_chunk_index() still writes a fresh, valid index.

Add a regression test covering both compact paths (default and --stats) that
interrupts compaction right before save_chunk_index() and verifies no cached
chunk index survives and a later create+extract reproduces the original bytes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-10 15:45:57 +02:00
TW
8509b3b7fa
Merge pull request #9751 from ThomasWaldmann/fix-9749
Some checks are pending
Lint / lint (push) Waiting to run
CI / lint (push) Waiting to run
CI / security (push) Waiting to run
CI / asan_ubsan (push) Blocked by required conditions
CI / native_tests (push) Blocked by required conditions
CI / vm_tests (NetBSD, false, netbsd, 10.1) (push) Blocked by required conditions
CI / vm_tests (OmniOS, false, omnios, r151056) (push) Blocked by required conditions
CI / vm_tests (OpenBSD, false, openbsd, 7.8) (push) Blocked by required conditions
CI / vm_tests (borg-freebsd-14-x86_64-gh, FreeBSD, true, freebsd, 14.3) (push) Blocked by required conditions
CI / windows_tests (push) Blocked by required conditions
CodeQL / Analyze (push) Waiting to run
files cache: don't empty cache on a no-change backup, #9749
2026-06-10 14:48:05 +02:00
Thomas Waldmann
c08c2ca461
files cache: don't empty cache on a no-change backup, #9749
FilesCacheMixin initialized _newest_cmtime to 0, but _write_files_cache()
only treats None as "no file was chunked this run" (falling back to a
max_time_ns cutoff that keeps all current entries).

When a backup reuses all files from the cache without chunking anything,
_newest_cmtime stayed at 0, so the race-protection cutoff became the unix
epoch and every current (age == 0) entry was discarded. The next backup
then had to re-read, chunk and hash all files again.

Initialize _newest_cmtime to None to match the documented contract in
_write_files_cache(), and make the comparisons in _build_files_cache()
None-safe.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-10 12:39:36 +02:00
Thomas Waldmann
31202ea4f1
remove xxhash / xxh64 requirement, mentions 2026-06-10 00:38:18 +02:00
TW
9b8fc60430
Merge pull request #9734 from ThomasWaldmann/borg-serve-rest
borg serve --rest: serve rest:// repositories with borg
2026-06-09 11:13:11 +02:00
Thomas Waldmann
a5ef482ca8
docs: offer a PDF download and link offline formats in the sidebar, fixes #9731
Enable the pdf output format on Read the Docs (the LaTeX build config
already existed in docs/conf.py) and add a "Downloads" line to the left
sidebar that links the offline formats (PDF, HTML zip, ePub). 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. The line is left-aligned with the boxes above and the
table of contents below, with separators above and below it.

Also drop the stale 'resources' entry from latex_appendices (the page was
removed in #2088); it broke the now-enabled PDF build with a doctree
KeyError.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-09 02:08:14 +02:00
Thomas Waldmann
83b0dd66c7
improve docs / comments 2026-06-09 00:49:50 +02:00
Thomas Waldmann
5415062564 borg serve --rest: serve rest:// repositories with borg
Make `borg serve` able to be the server-side component of a rest:// repository,
selected with a new --rest option. Plain `borg serve` (no option) keeps serving
legacy borg-1.x repos and stays command-line compatible with borg 1.x.

- serve_cmd.py: add --rest and --backend. With --rest, serve the given
  --backend FILE:<path> on stdio via borgstore.server.rest.serve(); honor
  --restrict-to-path/--restrict-to-repository (validated against the FILE path)
  and --permissions (mapped via borg_permissions). Without --rest, run the legacy
  RepositoryServer as before.
- repository.py: for rest:// locations, build the borgstore REST backend with a
  command that runs `borg serve --rest --backend FILE:<path>` (locally via
  sys.executable, or over ssh reusing borgstore's ssh_cmd / BORG_REMOTE_PATH),
  instead of borgstore's hardcoded `borgstore-server-rest`. So a remote only needs
  borg installed. Extracted the permissions string->dict mapping into the reusable
  borg_permissions().
- tests: unit tests for the rest serve command builder. The existing
  remote_archiver (rest:///) suite now runs against `borg serve --rest`.
- docs: changelog + quickstart updated.

Legacy serve and the legacy ssh client are unchanged (client still spawns plain
`borg serve`).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-08 14:52:41 +02:00
Thomas Waldmann
cac7237d3f remove ssh:// and socket:// remote repository for current repos
The modern client/server transport (RemoteRepository served by `borg serve`
over an msgpack RPC protocol) is now redundant for current (borg 2) repos:
its functionality is replaced by rest:// (which can tunnel over ssh to a
remote borgstore REST server).

Remove the modern RemoteRepository (both ssh:// and socket://) entirely.
Legacy v1 (borg 1.x) repos remain reachable over ssh:// via the separate
LegacyRemoteRepository client, and `borg serve` / RepositoryServer is kept,
trimmed to the legacy-only path, so a remote borg2 can still serve a v1 repo
for `borg transfer --from-borg1`.

Details:
- remote.py: delete RemoteRepository, SleepingBandwidthLimiter and the `api`
  decorator; trim RepositoryServer to legacy-only (drop modern _rpc_methods,
  socket serving, non-legacy open() branch); keep cache_if_remote /
  RepositoryCache / RepositoryNoCache (used by all repos).
- get_repository(): non-legacy ssh:// now raises a clear "use rest://" error;
  socket:// route and the global --socket option removed.
- parseformat: drop the socket:// scheme (now an invalid location).
- borg serve: keep the command (serves legacy v1 ssh only); update epilog.
- borg version: drop modern remote query; keep legacy ssh path.
- update isinstance/import sites (cache, archive, fuse/hlfuse, analyze/compact,
  archiver __init__ -> LegacyRemoteRepository.RPCError).
- tests/docs updated; obsolete socket serve test removed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-08 08:04:59 +02:00
Thomas Waldmann
ff6d0e8775
fix typos / grammar in transfer docs 2026-06-06 19:34:46 +02:00
Thomas Waldmann
5d8b761a6c
crypto: integrate blake3, blake2b is legacy, fixes #8867
BLAKE3 is generally faster and provides a more modern construction for
keyed hashing (using its internal keyed mode instead of the construction
used for BLAKE2b).

Key types changed:
- authenticated-blake2 -> authenticated-blake3
- {keyfile,repokey}-blake2-aes-ocb -> {keyfile,repokey}-blake3-aes-ocb
- {keyfile,repokey}-blake2-chacha20-poly1305 -> {keyfile,repokey}-blake3-chacha20-poly1305

This also fixes the slightly unusual way how we used blake2b,
it is only supported for importing borg 1.x repos.

New repos either use HMAC-SHA256 or BLAKE3.
2026-06-06 19:34:45 +02:00
Thomas Waldmann
dd4ba13066
remove python 3.10 support (master branch), fixes #9707 2026-06-06 15:34:05 +02:00
Thomas Waldmann
d6eb910c21
update CHANGES 2026-06-02 11:34:42 +02:00
Thomas Waldmann
39ac734b9c
support "rest:" repository URLs, fixes #9593
That is borgstore's REST http over stdio (over ssh, if a host is given).
2026-06-01 21:11:55 +02:00
Thomas Waldmann
05994d2e4e
docs: update to 'borg key change-passphrase' in env help, fixes #9697 2026-06-01 20:55:56 +02:00
Thomas Waldmann
f13dd4ddc9
repokey: use same format as with external keyfile
- always have a starting line with FILE_ID repoid
- store repkeys content-addressed, name is sha256(content)
- search by repo id on load
- add keyfile_format / keyfile_parse / is_keyfile helpers
2026-05-31 22:50:25 +02:00
Thomas Waldmann
ee4613f3fc
update year in LICENSE and docs/conf.py
fixes #9679

Co-authored-by: Junie <junie@jetbrains.com>
2026-05-30 14:49:31 +02:00
Mrityunjay Raj
4d19b91a6b docs: rename BORGOBJ->BORG_OBJ, introduce OBJ_MAGIC constant, refs #8572
Use BORG_OBJ (8 bytes) as the blob magic and refer to it as OBJ_MAGIC
throughout so the literal and its length appear in one place. Update
the inline blob diagram to the pipe-separated notation Thomas suggested.
2026-05-29 16:40:27 +05:30
Mrityunjay Raj
91003d0ca5 docs: address round-2 review on pack file internals, refs #8572
Rename PackIndex->ChunkIndex, fix pack path to use pack_id, drop
levels_config detail, fix "keyed MAC"->"ID hash" in Pack ID section,
document chunk_id duplication across unencrypted header and encrypted_meta.
2026-05-29 03:22:37 +05:30
Mrityunjay Raj
6bba477ae2 docs: revise pack file internals based on PR #9669 review, refs #8572
remove forward-looking N>1 references, hardcoded offsets, and stale "currently";
use borgstore vocabulary, medium-sized index files, and simplified recovery prose
2026-05-29 00:45:12 +05:30
Mrityunjay Raj
5d6cafe4b8 docs: add pack file format design and internals documentation, refs #8572 2026-05-27 13:26:18 +05:30
Thomas Waldmann
6cfb90dae9
repo-compress: remove this command for now
for packs, this needs to get implemented differently to perform well.
processing needs to be pack-after-pack and the index needs to be
updated correctly and carefully, e.g. considering interruptions
of repo-compress.
2026-05-22 13:00:13 +02:00
TW
620e2534b8
Apply suggested fix to docs/deployment/pull-backup.rst from Copilot Autofix
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2026-05-14 00:18:42 +02:00
TW
b404c36ae0
Apply suggested fix to docs/deployment/pull-backup.rst from Copilot Autofix
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2026-05-14 00:18:41 +02:00
TW
4fcc2cc1d2
Apply suggested fix to docs/deployment/pull-backup.rst from Copilot Autofix
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2026-05-14 00:18:41 +02:00
Thomas Waldmann
4a75a84bf3 docs: fix rst syntax error 2026-05-13 23:34:45 +02:00
TW
fbf6c766ca
Merge pull request #9632 from ThomasWaldmann/port-9629-to-master
Port PR #9629 to master: add a FAQ entry about scalability
2026-05-13 22:37:03 +02:00
Thomas Waldmann
abdd068db3 add a FAQ entry about scalability, fixes #4742
(cherry picked from commit 2dec0d32de)
2026-05-13 22:36:28 +02:00
Thomas Waldmann
f40878e1e7 docs: sshfs + chroot does support different CPU architectures, fixes #6878
(cherry picked from commit 49365617c4)
2026-05-13 20:19:46 +00:00
TW
316d774bbd
Merge pull request #9623 from ThomasWaldmann/port-9616-to-master
Some checks are pending
Lint / lint (push) Waiting to run
CI / lint (push) Waiting to run
CI / security (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 (OmniOS, false, omnios, r151056) (push) Blocked by required conditions
CI / vm_tests (OpenBSD, false, openbsd, 7.8) (push) Blocked by required conditions
CI / vm_tests (borg-freebsd-14-x86_64-gh, FreeBSD, true, freebsd, 14.3) (push) Blocked by required conditions
CI / windows_tests (push) Blocked by required conditions
CodeQL / Analyze (push) Waiting to run
docs: forward port DoS warning for none mode (fixes #6715)
2026-05-13 13:06:36 +02:00
TW
7227fbbde6
docs: forward port FAQ entry for full repository filesystem, fixes #9573 2026-05-13 10:30:12 +02:00
TW
274708de9c
docs: forward port FAQ entry for SSH connection timeouts, fixes #5629 2026-05-13 10:27:19 +02:00
Thomas Waldmann
f02a47d022 docs: forward port FAQ entry for bad backups and deduplication (fixes #4744) 2026-05-13 10:16:43 +02:00
Thomas Waldmann
d0167d8cdf docs: forward port DoS warning for none mode (fixes #6715) 2026-05-13 10:14:36 +02:00
Thomas Waldmann
4dc21d7ed1 docs: improve macOS Keychain instructions (fixes #5156)
(cherry picked from commit fb8bab1c2d)
2026-05-13 07:56:52 +00:00
Hugo Wallenburg
c8f8defc0f
Fixes tests/docs assuming XDG_* vars not used on macOS
The move to platformdirs and its current usage _does_ honor XDG_*
variables on macOS if they are set. Tests were set up to assume this to
be untrue and the docs matched that.

This commit adds tests asserting that XDG_* variables are used when they
are present on macOS, with default locations still in ~/Library.
2026-04-03 11:34:10 +02:00
TW
be640e982f
Merge pull request #9348 from trxvorr/fix-9339-msys2-paths
Some checks failed
Lint / lint (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / security (push) Has been cancelled
CodeQL / Analyze (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 (OmniOS, false, omnios, r151056) (push) Has been cancelled
CI / vm_tests (OpenBSD, false, openbsd, 7.8) (push) Has been cancelled
CI / vm_tests (borg-freebsd-14-x86_64-gh, FreeBSD, true, freebsd, 14.3) (push) Has been cancelled
CI / windows_tests (push) Has been cancelled
archiver: warn about MSYS2 path translation, fixes #9339
2026-03-17 15:37:13 +01:00
Thomas Waldmann
2d6d900231
update CHANGES 2026-03-15 17:03:12 +01:00
trxvorr
d7bbcfb98b archiver: warn about MSYS2 path translation, fixes #9339
This adds a runtime warning when running under MSYS2/Git Bash without the necessary environment variables to disable automatic path translation. The documentation is also updated to explain this behavior and how to mitigate it.
2026-03-15 20:54:59 +05:30
Thomas Waldmann
f12f67a76d
build_usage build_man 2026-03-15 14:37:50 +01:00
Thomas Waldmann
d0c5a04a2a
update CHANGES 2026-03-13 15:29:33 +01:00
Thomas Waldmann
0f1e3f90fe
CI: use locked requirements, add canary job, fixes #9361 2026-03-12 15:01:00 +01:00
Thomas Waldmann
4f2f2255c3
create --paths-from-shell-command, fixes #5968
This adds the `--paths-from-shell-command` option to the `create` command, enabling the use of shell-specific features like pipes and redirection when specifying input paths. Includes related test coverage.
2026-03-10 20:16:26 +01:00
Thomas Waldmann
f2bdb689c5
improve configuration precedence docs 2026-03-10 18:36:34 +01:00
Thomas Waldmann
678df16bad
add support for auto-generated environment variables (jsonargparse) 2026-03-10 18:36:31 +01:00
Thomas Waldmann
63a45c6c21
add support for yaml config files, default config 2026-03-10 18:36:30 +01:00
Suryansh Pal
ba6706395a
use xxhash from PyPI, fixes #6535
Some checks failed
Lint / lint (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / security (push) Has been cancelled
CodeQL / Analyze (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 (OmniOS, false, omnios, r151056) (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
CI / windows_tests (push) Has been cancelled
2026-03-08 13:06:01 +01:00