Commit graph

2018 commits

Author SHA1 Message Date
Thomas Waldmann
d4a83edfdd
improve acl_get / acl_set error handling, see #4049 2024-03-16 15:56:55 +01:00
Thomas Waldmann
0151c9a38f
allow msgpack 1.0.8, fixes #8133 2024-03-02 14:19:11 +01:00
Thomas Waldmann
a88c3d9e25
create: deal with EBUSY, fixes #8123
I put it into same class as EPERM and EACCES:
BackupPermissionError: borg is not permitted to access the file.
2024-02-25 11:21:44 +01:00
TW
4522c040f3
Merge pull request #8117 from ThomasWaldmann/remove-bundled-3rd-party-1.4
Remove bundled 3rd party sw (1.4-maint)
2024-02-24 19:38:29 +01:00
Thomas Waldmann
5a8a505046
benchmark: inherit options --rsh --remote-path, fixes #8099 2024-02-22 21:35:11 +01:00
Thomas Waldmann
30dc27b11a
remove bundled lz4/zstd/xxhash code
Also adapt our Cython code to directly use the lib headers,
remove our wrappers.
2024-02-22 13:48:51 +01:00
Thomas Waldmann
420ef45f63
fix: Error/CommandError have a output format for 1 argument
(backport from master, only thing todo here was that one place)
2024-02-20 04:23:02 +01:00
Thomas Waldmann
97fe48c44c
check: fix return code for index entry value discrepancies
Also: use ERROR loglevel for these (not WARNING).

A different amount of index entries was already logged as error
and led to "error_found = True" in repository.check.

Different values in the rebuilt index vs. the on-disk index were
only logged on warning level, but did not lead to error_found = True.

Guess there is no reason why these should not be errors and lead to
error_found = True, so this was fixed in this commit.

Minor related change: change report_error function args, so it can be
called like logger.error - including giving a format AND args.
2024-02-08 19:31:24 +01:00
Thomas Waldmann
fb44fb5011
init: better borg key export instructions 2024-02-01 12:55:31 +01:00
Thomas Waldmann
f2b3a3a383
init: remove compatibility warning for borg <=1.0.8
The warning refers to a compatibility issue not relevant any
more since borg 1.0.9 (released 2016-12).

It is now better to remove this warning to make the output
of borg init shorter and maybe get more people to completely
read the important parts of it.
2024-01-31 17:26:20 +01:00
Thomas Waldmann
5b96d5acc3
create: add the slashdot hack, fixes #4685 2024-01-30 14:01:40 +01:00
TW
e0de99307a
Merge pull request #8066 from ThomasWaldmann/upgrade-bundled-code-1.4
Upgrade bundled code (1.4-maint)
2024-01-30 00:37:24 +01:00
Thomas Waldmann
b1a8924c0e
upgrade bundled zstd to 1.5.5 2024-01-29 22:30:04 +01:00
Thomas Waldmann
c8007e45ce
upgrade bundled xxhash to 0.8.2 2024-01-29 22:07:39 +01:00
Thomas Waldmann
a3998d0663
upgrade bundled lz4 to 1.9.4 2024-01-29 21:54:49 +01:00
Thomas Waldmann
e80d922730
requirements are defined in pyproject.toml 2024-01-29 20:44:37 +01:00
Thomas Waldmann
5d956b9655
add ConnectionBrokenWithHint for BrokenPipeErrors and similar, see #7016
no traceback, but error message and specific exit code.
2024-01-19 18:38:07 +01:00
Thomas Waldmann
45f65f7c57
check_can_create_repository: deal with PermissionErrors, see #7016
borg init calls this. If there is a PermissionError, it is
usually fs permission issue at path or its parent directory.

Don't give a traceback, but rather an error msg and a specific exit code.
2024-01-19 18:13:53 +01:00
Thomas Waldmann
8d72927e77
implement "borg version", fixes #7829
Additional new command "borg version <REPO>" which shows client and server version.
2024-01-19 13:01:14 +01:00
TW
319441e75d
Merge pull request #8051 from ThomasWaldmann/corrupted-key-errmsg-1.4
better error msg for corrupted key data, fixes #8016
2024-01-19 00:45:59 +01:00
Thomas Waldmann
dbbccf9451
better error msg for corrupted key data, fixes #8016 2024-01-18 23:59:35 +01:00
Thomas Waldmann
98fa922904
bump api version to 1.4 2024-01-18 20:09:49 +01:00
Thomas Waldmann
742bd0c097
refactor: use less binascii
our own hex_to_bin / bin_to_hex is more comfortable to use.

also: optimize remaining binascii usage / imports.
2024-01-18 18:13:40 +01:00
Thomas Waldmann
d9132a34d4
give clean error msg for invalid nonce file, see #7967
That rather long traceback was not pretty.

Of course users should usually have valid nonce files,
but multiple users managed to corrupt the file contents somehow.

Also:
- add Error / ErrorWithTraceback exception classes to RPC layer.
- add hex_to_bin helper
- also call hex_to_bin for the local nonce file (security dir)
2024-01-17 15:31:03 +01:00
Thomas Waldmann
884668ee07
borg.logger: use same method params as python logging 2024-01-14 00:07:05 +01:00
Thomas Waldmann
c2e7b7cc96
fix CommandError args, fixes 8029 2024-01-07 19:47:50 +01:00
TW
2812f992b8
Merge pull request #8032 from kmille/1.4-maint
improve docs for borg with-lock, 1.4-maint backport
2024-01-07 19:08:40 +01:00
kmille
0c3c1e6e3c
improve docs for borg with-lock
discussion in #8022
port of #8024
2024-01-07 18:32:40 +01:00
kmille
aae959cd6d
borg with-lock: catch exception, print error msg, fixes #8022 2024-01-07 17:14:26 +01:00
Thomas Waldmann
46fc887647
msgpack: remove max_*_len, msgpack has builtin DoS-protection
msgpack >= 0.6.1 has DoS-protection and we require >= 1.0.3 anyway.

This is now a bit closer to what master branch uses.
2024-01-04 20:14:59 +01:00
Thomas Waldmann
8cb7bc3d32
msgpack: simplify, we are always using msgpack >= 1.0.3 now
see requirements, we also check this in is_supported_msgpack().

update comment about msgpack api change.
2024-01-04 20:14:34 +01:00
Thomas Waldmann
2b6dd14464
use get_reset_ec to internally re-init ec/warnings
if we do multiple calls to Archiver.do_something(),
we need to reset the ec / warnings after each call,
otherwise they will keep growing (in severity, in length).
2023-12-27 13:49:11 +01:00
Thomas Waldmann
242b8f9f51
refactor (re-)init of exit_code and warnings_list globals
stop directly accessing the variables from other modules.

prefix with underscore to indicate that these shall
only be used within this module and every other user
shall call the respective functions.
2023-12-27 13:49:08 +01:00
Thomas Waldmann
4bb42d2a00
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
2023-12-27 13:49:06 +01:00
Thomas Waldmann
69072f0c17
BackupErrors get caught and give warning RCs
also: use more union operators rather than .union()
2023-12-27 13:48:55 +01:00
Thomas Waldmann
83bf4d8c7d
raise BackupOSError subclasses 2023-12-27 13:48:52 +01:00
Thomas Waldmann
82f147f63f
add NotFoundWarning 2023-12-27 13:48:49 +01:00
Thomas Waldmann
ead9fe4763
print_warning*: support warning msgids, fixes #7080 2023-12-27 13:48:47 +01:00
Thomas Waldmann
775b9f5560
extend errorlist script to warnings, update docs 2023-12-27 13:48:41 +01:00
Thomas Waldmann
2fda86ce61
more detailled warnings for source file OSErrors 2023-12-27 13:48:14 +01:00
Thomas Waldmann
53291a4ac0
BackupError->BackupWarning, BackupOSError->BackupOSWarning 2023-12-27 13:48:12 +01:00
Thomas Waldmann
c2e8bb0468
move Backup*Error to errors module 2023-12-27 13:48:11 +01:00
Thomas Waldmann
482ac47ed8
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
2023-12-27 13:47:52 +01:00
Thomas Waldmann
770f4117a5
get rid of some rare error classes, use RTError instead 2023-12-27 13:46:15 +01:00
Thomas Waldmann
f6279eac9d
shorten TAMRequiredError error msg
Users using recently created repos (after borg 1.0.9) or
who followed the upgrade procedure of 1.0.9 or >1.2.4 will
never see this error msg.

So, have it as short as and similar to the ArchiveTAMRequiredError.
2023-12-27 13:46:13 +01:00
Thomas Waldmann
41351af635
fix dealing with remote repo Locking Exceptions
previously, this was handled in RPCError handler and always resulted in rc 2.

now re-raise Lock Exceptions locally, so it gives rc 2 (legacy) or 7x (modern).
2023-12-27 13:46:12 +01:00
Thomas Waldmann
add7a22581
refactor set_ec usage
- _export_tar: remove unneeded call to set_ec
  print_warning() already sets the exit code to EXIT_WARNING.

- msgpack version check: raise Error instead of calling set_ec
2023-12-27 13:46:11 +01:00
Thomas Waldmann
74954faec8
use print_warning also in borg delete ::archive --force --force 2023-12-27 13:46:04 +01:00
Thomas Waldmann
62ad0369ef
update "modern" error RCs (docs and code) 2023-12-27 13:45:48 +01:00
Thomas Waldmann
2a13268e05
BORG_EXIT_CODES=modern can be set to get more specific process exit codes
If not set, it will default to "legacy" (always return 2 for errors).

This commit only changes the Error exception class and its subclasses.

The more specific exit codes need to be defined via .exit_mcode in the subclasses.
2023-12-27 13:41:46 +01:00