Commit graph

389 commits

Author SHA1 Message Date
TW
fc8c8e0fe9
Merge pull request #9811 from ThomasWaldmann/env-hostname-username-master
Replace create --hostname/--username with BORG_HOSTNAME/BORG_USERNAME env vars, fixes #9651
2026-07-05 14:56:52 +02:00
Thomas Waldmann
0e3876d5e4
buzhash64: add FastCDC-style normalized chunking
Normalized chunking switches between a stricter and a looser cut mask
around the target chunk size. This greatly tightens the chunk-size
distribution (coefficient of variation ~0.9 -> ~0.3 in tests) and removes
the dedup-hostile max-size-clamped chunks, with unchanged deduplication.

chunker-params for buzhash64 gains a required 6th field, nc_level:

  buzhash64,chunk_min,chunk_max,chunk_mask,window_size,nc_level

Use nc_level=2 for the new default, nc_level=0 to disable (then behavior
is byte-identical to the previous single-mask chunker).

buzhash (32bit) is untouched and stays bit-compatible with borg 1.x.

The mask transition point (normal_size) defaults to a principled formula
(target minus the expected loose-phase tail) so the mean stays near the
target; it can be tuned via the normal_size constructor arg.

scripts/chunker_bench.py: evidence harness used to measure chunk-size
distribution, dedup ratio, throughput and shift-resilience.

Measurements (before = nc_level 0, after = nc_level 2; both at the default
params buzhash64,19,23,21,4095; measured with scripts/chunker_bench.py):

5 GiB of incompressible data (~2000-2700 chunks, statistically stable):

  before:  CV 0.739,  49 max-size-clamped (8 MiB) chunks,   953 MB/s
  after:   CV 0.311,   0 max-size-clamped chunks,          1024 MB/s

Re-backup of a 2.5 GiB file after a few scattered single-byte edits
(deduplication ratio; 0.5 = v2 fully deduplicated against v1, lower is
better):

   64 edits:  before 0.5424  ->  after 0.5235
  320 edits:  before 0.6791  ->  after 0.6142

Normalized chunking deduplicates better after edits: removing the
max-size-clamped chunks means a single-byte change invalidates much less
data (about 36% less dedup overhead at 320 edits). Throughput was also
consistently higher with nc_level=2 at this scale.

Also: fix bug when computing the mask, one needs to use 1ULL instead of
1, so the shifting computation is done in a uint64, not in a 32bit int.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-28 12:00:09 +02:00
Thomas Waldmann
5e27122735
replace create --hostname/--username with BORG_HOSTNAME/BORG_USERNAME env vars, fixes #9651
The --hostname/--username options on borg create (added in 2.0.0b21, #9402)
are removed in favor of the BORG_HOSTNAME / BORG_USERNAME environment variables.

When set, these override the hostname/username stored in newly created archives
and used by the {hostname}/{user} placeholders (so they also apply to archive
names, prune --glob-archives, check, etc.). Useful to run borg on host A but
impersonate host B.

The env vars are read at the point of use; fqdn/hostid (see BORG_HOST_ID) and
the auto-detection are intentionally left untouched.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 21:07:31 +02:00
Hugo Wallenburg
c0a69611a8
Renames --since to --from 2026-06-20 18:36:59 +02:00
Daniel Rudolf
1073da9eb1
Refactor the interval-based pruning example
Co-Authored-By: Hugo Wallenburg <hugo@hugow.no>
2026-06-20 18:09:39 +02:00
Hugo Wallenburg
304a2fa5b9
Removes --keep-last and --keep-within, superseded by --keep 2026-06-20 18:09:38 +02:00
Hugo Wallenburg
d9f9f1dd45
Updates prune parser epilog to match new int/interval behavior
Along with reordering and improvements.
2026-06-20 18:09:38 +02:00
Hugo Wallenburg
4382b3a8f2
Updates usage docs for prune and new int/interval handling 2026-06-20 18:09:38 +02:00
Thomas Waldmann
48308f1969
misc docs updates 2026-06-16 15:21:57 +02:00
Thomas Waldmann
a7990c3702
update general docs 2026-06-16 14:46:57 +02:00
Thomas Waldmann
ce19629b34
docs: update repo-create examples for split --encryption/--id-hash
The repo-create.rst examples were not updated after --encryption was
split into --encryption + --id-hash. Use the real mode name (aes256-ocb)
and show --id-hash as an orthogonal option.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-16 14:28:03 +02:00
Thomas Waldmann
c4347a9dce
build usage / man 2026-06-16 14:17:43 +02:00
Thomas Waldmann
2eef6c8035
crypto: drop the NAME attribute; repo-info builds the suite string from ENC_NAME/IDHASH_NAME
NAME was only read by "borg repo-info" to show the crypto suite. Remove it from
all (current and legacy) key classes and let repo-info assemble the display from
the two real dimensions instead: "<mode>, <ENC_NAME>, <IDHASH_NAME>", e.g.
"Encrypted: Yes (repokey, aes256-ocb, sha256)" or
"Encrypted: No (repokey, authenticated, blake3)".

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 19:38:32 +02:00
Thomas Waldmann
29a760e2b3
repo-create: split --encryption into --encryption + --id-hash, #9168
The combined --encryption value packed two orthogonal dimensions (cipher / AE
algorithm and id hash function) into a single string, causing a combinatorial
explosion of mode names. Key location was already split out into --key-location.

Now:
- --encryption selects only the cipher / AE algorithm:
  none, authenticated, aes256-ocb, chacha20-poly1305
- --id-hash selects the id hash function: sha256 (default) or blake3
- --key-location (unchanged) selects key storage: repokey (default) or keyfile

The old combined names were removed (clean break): select a BLAKE3 suite via
--encryption ... --id-hash blake3 instead of blake3-*. aes-ocb was renamed to
aes256-ocb (key NAME shown by repo-info and ARG_NAME in JSON updated to match).
"none" has no key, so it only supports the sha256 id hash.

No on-disk format, key-type byte, or crypto behavior changes: the existing key
classes form a clean cross-product of {cipher} x {id-hash}, selected via the new
ENC_NAME / IDHASH_NAME class attributes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 17:44:38 +02:00
TW
5e2da157be
Merge pull request #9769 from ThomasWaldmann/docs-key-subcommands
docs: add docs for "key add", "key list" and "key remove"
2026-06-13 23:47:58 +02:00
Thomas Waldmann
d5cd72b179 docs: add docs for "key add", "key list" and "key remove"
The multi-key feature (#9743) added the "borg key add", "borg key list"
and "borg key remove" subcommands but never wired up their docs:

- scripts/make.py: map key_add/key_list/key_remove to the "key" usage
  group, so build_man can locate their examples (it previously aborted
  with FileNotFoundError: docs/usage/key_add.rst).
- docs/usage/key.rst: include the three new generated snippets so they
  show up on the HTML key page.
- regenerate the affected docs: new key_{add,list,remove}.rst.inc usage
  snippets, new borg-key-{add,list,remove}.1 man pages, and borg-key.1
  (SYNOPSIS + SEE ALSO now reference the new subcommands).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-13 21:37:21 +02:00
Thomas Waldmann
8f4231d21b key: allow --key-location for authenticated* modes
The authenticated and authenticated-blake3 modes do not encrypt data, but
they still have a real key (id/auth key material) stored as a key blob.
That blob can live as a keyfile or as a repokey just like the encrypted
modes, so make it configurable instead of always forcing repokey storage.

- AuthenticatedKeyBase: set LOCATION_CONFIGURABLE = True so --key-location
  (at repo-create) and "borg key change-location" apply.
- key change-location: only copy sessionid/cipher when present (those are
  AEAD-only; authenticated keys do not have them).
- repo-info: report the key storage location for authenticated keys too,
  and handle the authenticated-blake3 variant (was only "authenticated").
- repo-create help: stop claiming authenticated* has no keyfile/repokey
  storage; only "none" truly has no key.
- add change-location round-trip tests for authenticated mode.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-13 20:57:26 +02:00
Thomas Waldmann
d2bc45f56d
key: unify keyfile/repokey classes, locate key independent of type byte (#9743)
Borg used to read the manifest's key-type byte and then look for the key in
exactly one place (keyfile or repokey) depending on the key class that byte
selected. As a result every crypto suite was duplicated into a keyfile class
and a repokey class that differed only in TYPE, NAME, ARG_NAME and STORAGE.

Now key *location* is independent of the type byte: detection tries keyfiles
first and repokeys afterwards until a passphrase unlocks a key. The type byte
still selects the crypto suite (id hash, MAC, cipher) to instantiate. Where a
key is stored (keyfile vs repokey) is therefore a per-key property
(self.storage), not a separate class, so a repository may even hold a mix of
keyfile- and repo-stored borg keys.

With storage decoupled from class identity, the keyfile/repokey class pairs
collapse into one class per crypto suite:
- modern AEAD: AESOCBKey, CHPOKey, Blake3AESOCBKey, Blake3CHPOKey
- legacy borg 1.x (read-only): AESCTRKey, Blake2AESCTRKey
There is now exactly one type byte per modern crypto suite (the old separate
repokey type bytes 0x11/0x21/0x31/0x41 were removed; borg2 is beta and only
needs to read repos it created). identify_key() matches on TYPES_ACCEPTABLE.

CLI: --encryption selects only the crypto suite (aes-ocb, chacha20-poly1305,
blake3-aes-ocb, blake3-chacha20-poly1305, authenticated*, none); the storage
location is chosen with the new --key-location=repokey|keyfile (default
repokey). The old combined modes (repokey-aes-ocb etc.) were removed.
borg key import also gained --key-location. borg key change-location no longer
swaps key classes or rewrites the manifest; it just re-saves the unlocked key
at the new location.

Keyfile removal (key remove, change-location) now overwrites the keyfile with
random data via secure_erase() before unlinking, consistent with save().

borg 1.x legacy read compatibility is preserved (the legacy class merge is a
behavior-preserving rename; the legacy type bytes incl. PASSPHRASE stay in
TYPES_ACCEPTABLE).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-12 23:48:45 +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
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
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
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
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
Thomas Waldmann
f12f67a76d
build_usage build_man 2026-03-15 14:37:50 +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
Thomas Waldmann
dd38e2c2df
docs: archive specification, FAQ, fixes #9248, fixes #9053 2026-03-06 21:36:05 +01:00
Mrityunjay Raj
02f447536c docs: document platformdirs change and platform-specific directory paths, fixes #7332 2026-02-27 11:50:35 +05:30
Thomas Waldmann
0b05b44c0a
rename BORG_RLIST_FORMAT to BORG_REPO_LIST_FORMAT, #9411 2026-02-24 10:42:50 +01:00
defnvary
4344eb37d1 use zstd from python stdlib or backport.zstd, closes #9261 2026-02-23 00:33:21 +05:30
Rohan salunke
179b5cdd92
Regenerate usage docs from current CLI help source
This also fixes #8146 (experimental markings in docs).
2026-02-22 11:50:58 +01:00
Thomas Waldmann
4073bb263f
fix S3 url description, fixes #9249
- profile also must be followed by @
- in URL specs, it is "scheme", not "schema"
- note that the scheme is usually https
2026-01-28 12:12:26 +01:00
Thomas Waldmann
fcbf7f3572
build_usage build_man 2025-12-23 18:00:09 +01:00
Thomas Waldmann
43c7878a56
docs: update installation requirements and BORG_FUSE_IMPL about mfusepy 2025-12-20 19:31:51 +01:00
TW
1b9779b4f3
Merge pull request #9162 from ThomasWaldmann/docs/archive-series-note-8955
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 (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
docs: highlight archive series naming for fast incrementals (fixes #8955)
2025-11-18 02:11:46 +01:00
Thomas Waldmann
15f59233b5
completion: borg can now generate completion scripts for supported shells, fixes #9172
Added `shtab` dependency for shell completion functionality:
- bash completion (works).
- zsh completion (known-broken due to iterative/shtab#183).
2025-11-17 18:47:00 +01:00
Thomas Waldmann
71ca0ac6a7
docs: add prominent note to borg create about archive series and files cache; recommend stable NAME per series for performance (#8955) 2025-11-10 02:37:55 +01:00
Thomas Waldmann
5c44dad125
diff --sort-by: enhanced sorting, fixes #8998
use borg diff --sort-by=spec1,spec2,spec2 for enhanced sorting.

remove legacy --sort behaviour (sort by path), this was deprecated
since 1.4.2.

Co-authored-by: Daniel Rudolf <github.com@daniel-rudolf.de>

This is a port of #9005 to master branch.
2025-11-03 19:25:02 +01:00
Thomas Waldmann
7e6dea9408
BORG_MSGPACK_VERSION_CHECK=no to disable the version check, fixes #9109
(cherry picked from commit 2d63dc9a4f)
2025-11-01 16:48:00 +01:00
Atemu
fdabbd7633
extract: document how to use wildcards in PATHs
Fixes https://github.com/borgbackup/borg/issues/8589
2025-10-10 11:20:08 +02:00
Thomas Waldmann
2c7bec0149
manual corrections/reverts 2025-09-23 14:56:35 +02:00
Thomas Waldmann
3120f9cd1c
fixed typos and grammar (AI)
this was done by Junie AI.
2025-09-23 14:56:23 +02:00
Thomas Waldmann
f327af11a6
build_usage build_man 2025-08-02 11:12:20 +02:00
Thomas Waldmann
9b26b1011a
build_usage build_man 2025-06-18 17:35:37 +02:00
Thomas Waldmann
7741b503ad
reformat text 2025-06-09 14:19:14 +02:00
Thomas Waldmann
c850f508f8
fix grammar 2025-06-09 14:19:12 +02:00