Commit Graph

20 Commits

Author SHA1 Message Date
Thomas Waldmann abe6545853
do not return the rc from Archiver methods
this is not needed and getting rid of it makes
the code / behaviour simpler to understand:

if a fatal error is detected, we throw an exception.

if we encounter something warning worthy, we emit and collect the warning.

in a few cases, we directly call set_ec to set the
exit code as needed, e.g. if passing it through
from a subprocess.

also:
- get rid of Archiver.exit_code
- assert that return value of archiver methods is None
- fix a print_warning call to use the correct formatting method
2024-02-17 22:07:47 +01:00
Thomas Waldmann c704e5ea9e
new warnings infrastructure to support modern exit codes
- implement updating exit code based on severity, including modern codes
- extend print_warning with kwargs wc (warning code) and wt (warning type)
- update a global warnings_list with warning_info elements
- create a class hierarchy below BorgWarning class similar to Error class
- diff: change harmless warnings about speed to rc == 0
- delete --force --force: change harmless warnings to rc == 0

Also:

- have BackupRaceConditionError as a more precise subclass of BackupError
2024-02-14 01:26:12 +01:00
Thomas Waldmann 73284db53f
PATH: do not accept empty strings, fixes #4221 2024-01-02 19:17:55 +01:00
Thomas Waldmann 1b6f928917
ro_type: typed repo objects, see #7670
writing: put type into repoobj metadata
reading: check wanted type against type we got

repoobj metadata is encrypted and authenticated.
repoobj data is encrypted and authenticated, also (separately).
encryption and decryption of both metadata and data get the
same "chunk ID" as AAD, so both are "bound" to that (same) ID.

a repo-side attacker can neither see cleartext metadata/data,
nor successfully tamper with it (AEAD decryption would fail).

also, a repo-side attacker could not replace a repoobj A with a
differently typed repoobj B without borg noticing:
- the metadata/data is cryptographically bound to its ID.
  authentication/decryption would fail on mismatch.
- the type check would fail.

thus, the problem (see CVEs in changelog) solved in borg 1 by the
manifest and archive TAMs is now already solved by the type check.
2023-09-24 20:10:50 +02:00
Thomas Waldmann 1ed7f29572
avoid tarfile deprecation warning for py312 2023-09-14 03:04:36 +02:00
Thomas Waldmann 971438dfa0
import/export-tar: more Highlander options, fixes #6269 2023-04-06 17:53:27 +02:00
Artem Sheremet c999d5dded Explain multiple tarball import with ignore-zeros 2023-03-22 11:13:19 +01:00
Artem Sheremet 3c941ae604 Add --ignore-zeros flag to import-tar
Fixes #7432.
2023-03-21 22:49:23 +01:00
Thomas Waldmann 0fed44110a
remove part files from final archive
checkpoint archives might have a single, incomplete part file as last item.
part files are always a prefix of the full file, growing in size from
checkpoint to checkpoint.

we now manage the archive items metadata stream in a special way:
- checkpoint archive A(n) might end with a partial item PI(n)
- checkpoint archive A(n+1) does not contain PI(n)
- checkpoint archive A(n+1) contains a new partial item PI(n+1)
- the final archive does not contain any partial items
2023-02-01 13:04:12 +01:00
Thomas Waldmann a0330d578e
run black 23.1.0 on the code 2023-02-01 12:30:37 +01:00
Thomas Waldmann 7e31fab754
cleanup: remove Archive.checkpoint_interval (not used)
checkpoint_interval and checkpoint_volume are only needed for
the ChunksProcessor.
2023-01-31 04:01:39 +01:00
Thomas Waldmann 56b6f1d2e0
create/recreate/import-tar: add --checkpoint-volume option
volume based checkpointing is easier to test than its time based cousin.

also added first checkpointing test.
2023-01-31 04:01:37 +01:00
Thomas Waldmann 1672aee031
Item: symlinks: rename .source to .target, fixes #7245
Also, in JSON:
- rename "linktarget" to "target" for symlinks
- remove "source" for symlinks
2023-01-16 20:28:25 +01:00
Thomas Waldmann 18898d68f0
export-tar: for items w/o uid/gid, default to 0/0, see #7249 2023-01-16 18:17:17 +01:00
Thomas Waldmann a475227e18
use archivename_validator everywhere
also: simplify, reuse code from text_validator.
2022-12-15 22:54:46 +01:00
Thomas Waldmann 4b54b5565e
use comment validator for cli args and borg transfer 2022-12-12 18:48:01 +01:00
Thomas Waldmann 1f859c9f17
refactor: get archive timestamps via archive_ts_now() 2022-12-04 10:55:17 +01:00
nyuszika7h 54ec166219
tar_filter: recognize .tar.zst as zstd (#7093)
tar_filter: recognize .tar.zst as zstd
2022-10-22 14:46:12 +02:00
Thomas Waldmann fa986a9f19 repoobj: add a layer to format/parse repo objects
borg < 2:

obj = encrypted(compressed(data))

borg 2:

obj = enc_meta_len32 + encrypted(msgpacked(meta)) + encrypted(compressed(data))

handle compr / decompr in repoobj

move the assert_id call from decrypt to RepoObj.parse

also:
- for AEADKeyBase, add a dummy assert_id (not needed here)
- only test assert_id for other if not AEADKeyBase instance
- remove test_getting_wrong_chunk. assert_id is called elsewhere
  and is not needed any more anyway with the new AEAD crypto.
- only give manifest (includes key, repo, repo_objs)
- only return manifest from Manifest.load (includes key, repo, repo_objs)
2022-09-04 00:49:38 +02:00
Thomas Waldmann 66e74e0471 archiver modules: rename to *_cmd[s]
this was already required for list_cmd (due to "list"
being a builtin), now renamed all else also.
2022-08-13 22:59:48 +02:00
Renamed from src/borg/archiver/tar.py (Browse further)