Commit Graph

8362 Commits

Author SHA1 Message Date
Thomas Waldmann 45815554ce
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-02-20 00:07:43 +01:00
TW 7bed7b86d4
Merge pull request #8105 from ThomasWaldmann/corrupted-key-errmsg-master
better error msg for corrupted key data, fixes #8016
2024-02-19 23:30:38 +01:00
Thomas Waldmann 83c069ce5a
better error msg for corrupted key data, fixes #8016 2024-02-19 19:23:48 +01:00
TW 2d31b027c7
Merge pull request #8104 from ThomasWaldmann/error-msg-bad-nonce-file2-master
refactor: use less binascii
2024-02-19 03:02:02 +01:00
Thomas Waldmann 334fbab897
refactor: use less binascii
our own hex_to_bin / bin_to_hex is more comfortable to use.

also: optimize remaining binascii usage / imports.
2024-02-19 02:16:19 +01:00
TW 3bfd7652cd
Merge pull request #8102 from ThomasWaldmann/error-msg-bad-nonce-file-master
give clean error msg for invalid nonce file, see #7967
2024-02-18 15:21:52 +01:00
Thomas Waldmann ab0b111af0
give clean error msg for invalid nonce file, see #7967
this is a fwd port from 1.4-maint. as we don't have nonce files
any more in master, only the generally useful stuff has been ported.

- add Error / ErrorWithTraceback exception classes to RPC layer.
- add hex_to_bin helper
2024-02-18 14:47:52 +01:00
TW b65888f057
Merge pull request #8101 from ThomasWaldmann/fix-commanderror-args-master
fix CommandError args, fixes 8029
2024-02-18 14:33:35 +01:00
Thomas Waldmann 930ecd845a
fix CommandError args, fixes 8029
this is a fwd port from 1.4-maint and most of it was
already done in master, so only a minor change in here.
2024-02-18 14:18:33 +01:00
TW 74129e539b
Merge pull request #8100 from ThomasWaldmann/fix-with-lock-exceptions-master
borg with-lock: catch exception, print error msg, fixes #8022
2024-02-18 14:07:37 +01:00
kmille 1f5cc355a3
borg with-lock: catch exception, print error msg, fixes #8022 2024-02-18 13:36:10 +01:00
TW ad3f1365f5
Merge pull request #8098 from ThomasWaldmann/new-rc-master
optional more specific return codes (master)
2024-02-18 13:18:36 +01:00
Thomas Waldmann ed28eb9e03
fix: Error/CommandError have a output format for 1 argument 2024-02-18 04:40:32 +01:00
Thomas Waldmann d7e2e2cea9
fix mypy error 2024-02-17 23:01:46 +01:00
Thomas Waldmann a0a07ab464
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).
2024-02-17 22:37:44 +01:00
Thomas Waldmann b53c86cf4c
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.
2024-02-17 22:29:18 +01:00
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 5caf747011
update frontends.rst error/warning list 2024-02-15 18:17:18 +01:00
Thomas Waldmann 2e05c234b6
BackupErrors get caught and give warning RCs
also: use more union operators rather than .union()
2024-02-15 18:15:10 +01:00
Thomas Waldmann 97dd287584
raise BackupOSError subclasses 2024-02-15 17:53:53 +01:00
Thomas Waldmann 9ac4672254
add NotFoundWarning 2024-02-15 17:04:21 +01:00
Thomas Waldmann 4adc782100
print_warning*: support warning msgids, fixes #7080 2024-02-14 02:22:35 +01:00
Thomas Waldmann 5168a97782
extend errorlist script to warnings, update docs 2024-02-14 02:04:44 +01:00
Thomas Waldmann 982aeb56a7
more detailled warnings for source file OSErrors 2024-02-14 02:00:19 +01:00
Thomas Waldmann e8fa4986cc
BackupError->BackupWarning, BackupOSError->BackupOSWarning 2024-02-14 01:59:08 +01:00
Thomas Waldmann 900a1674df
move Backup*Error to errors module 2024-02-14 01:40:55 +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 b18e613627
get rid of some rare error classes, use RTError instead 2024-02-13 23:44:02 +01:00
Thomas Waldmann 0504dee0d9
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).
2024-02-13 23:33:30 +01:00
Thomas Waldmann cb8b718a96
refactor set_ec usage
- msgpack version check: raise Error instead of calling set_ec
2024-02-13 23:16:46 +01:00
Thomas Waldmann bec02a36c8
use print_warning also in borg delete ::archive --force --force 2024-02-13 23:13:25 +01:00
Thomas Waldmann 9de07ebd46
update "modern" error RCs (docs and code) 2024-02-13 22:58:02 +01:00
Thomas Waldmann 34bbce8e71
scripts/errorlist.py: improve error list docs generation
- also output modern rc and traceback yes/no
- recursive list of Error subclasses
2024-02-13 19:56:32 +01:00
Thomas Waldmann 1b09d0efd7
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.
2024-02-13 19:53:17 +01:00
TW 0e859a6d2d
Merge pull request #8096 from ThomasWaldmann/update-changes-master
update CHANGES
2024-02-13 19:30:19 +01:00
Thomas Waldmann 3a85433ffb
update CHANGES 2024-02-13 18:20:10 +01:00
TW 3b43770ca6
Merge pull request #8091 from ThomasWaldmann/fix-long-desc-master
sdist: dynamically compute readme (long_description)
2024-02-11 00:32:40 +01:00
Thomas Waldmann dd9358f1e2
sdist: dynamically compute readme (long_description)
The long_desc_from_readme() was not called, it just read the
whole README.rst until "readme" was declared dynamic.
2024-02-10 18:06:49 +01:00
TW 77e13ad752
Merge pull request #8087 from ThomasWaldmann/less-setuppy-master
use less setup.py (master)
2024-02-10 00:16:39 +01:00
Thomas Waldmann 8eba627b29
scripts: make.py clean implementation 2024-02-09 17:37:46 +01:00
Thomas Waldmann 4d424de69e
scripts: update docs about make.py 2024-02-09 17:37:44 +01:00
Thomas Waldmann 59bca06630
scripts: rename gendocs.py to make.py 2024-02-09 17:37:43 +01:00
Thomas Waldmann 48afc4c519
requirements are defined in pyproject.toml 2024-02-09 17:37:42 +01:00
Thomas Waldmann 38ba1c383a
docs: do not refer to setup.py installation method
Invoking setup.py is deprecated.
2024-02-09 17:37:40 +01:00
Thomas Waldmann b64f6e3335
scripts/gendocs.py: make it work
remove unused html_write function

gendocs: update developer docs
2024-02-09 17:37:38 +01:00
TW 8cfbd3ea3e
Merge pull request #8083 from ThomasWaldmann/increase-gh-actions-timeout-master
gh actions: increase timeout
2024-02-09 03:28:14 +01:00
Thomas Waldmann b34a99f337
git mv setup_docs.py scripts/gendocs.py 2024-02-09 02:53:17 +01:00
Thomas Waldmann 9d913b0e82
setup.py: remove build_usage and build_man as setup.py command 2024-02-09 02:50:19 +01:00
Thomas Waldmann 7d77985601
setup.py: move long_desc_from_readme definition to here 2024-02-09 02:38:47 +01:00
TW a4c8d52ca0
Merge pull request #8086 from ThomasWaldmann/index-check-value-errors-master
check: fix return code for index entry value discrepancies
2024-02-09 02:29:46 +01:00