Commit Graph

2770 Commits

Author SHA1 Message Date
bigtedde a438176b85 help_cmd converted 2023-07-07 10:08:25 -05:00
Björn Ketelaars 1074089d37 Fix failing test on OpenBSD
A borgbackup-2.0.0b6 test fails on OpenBSD with the message below.

```
=================================== FAILURES ===================================
_____________________________ test_get_runtime_dir _____________________________

path = '/run/user/55/borg', mode = 511, pretty_deadly = True

    def ensure_dir(path, mode=stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO, pretty_deadly=True):
        """
        Ensures that the dir exists with the right permissions.
        1) Make sure the directory exists in a race-free operation
        2) If mode is not None and the directory has been created, give the right
        permissions to the leaf directory. The current umask value is masked out first.
        3) If pretty_deadly is True, catch exceptions, reraise them with a pretty
        message.
        Returns if the directory has been created and has the right permissions,
        An exception otherwise. If a deadly exception happened it is reraised.
        """
        try:
>           os.makedirs(path, mode=mode, exist_ok=True)

build/lib.openbsd-7.3-amd64-cpython-310/borg/helpers/fs.py:37:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
```

If `$XDG_RUNTIME_DIR` is not set `platformdirs.user_runtime_dir()`
returns one of 3 different paths
(https://github.com/platformdirs/platformdirs/pull/201). Proposed fix is
to check if `get_runtime_dir()` returns one of these paths.
2023-07-07 15:38:13 +02:00
TW 7914e38160
Merge pull request #7712 from ThomasWaldmann/manifest-item_keys
manifest: move item_keys into config dict, fixes #7710
2023-07-07 00:58:27 +02:00
TW cfbfe2423f
Merge pull request #7676 from RayyanAnsari/paths-win
Properly normalise paths on Windows
2023-07-07 00:42:03 +02:00
TW e63775a316
Merge pull request #7711 from ThomasWaldmann/doc-updates-master
doc updates (master)
2023-07-07 00:30:16 +02:00
Felix Schwarz ae0b3d2fff replace "datetime.utcfromtimestamp" with custom helper to avoid deprecation warnings when using Python 3.12 2023-07-06 21:46:19 +02:00
Daniel Rudolf a661da13ee
Docs: Improve explanation of `borg check --max-duration`'s side effects 2023-07-06 00:42:57 +02:00
Daniel Rudolf 9d59146de4
Docs: Remove technical description from `borg check` docs 2023-07-06 00:19:48 +02:00
Daniel Rudolf 9edbf4e931
Docs: Rewrite `borg check` docs
Fixes #7578
2023-07-06 00:17:55 +02:00
bigtedde 5bc1bbd3a3 extract_cmd converted 2023-07-04 19:35:48 -05:00
bigtedde 95d48c054a disk_full converted 2023-07-04 18:38:10 -05:00
Thomas Waldmann 51e68c24e4
manifest: move item_keys into config dict, fixes #7710
also: manifest.version == 2 now
2023-07-05 01:11:24 +02:00
bigtedde dfaea063a5 diff_cmd converted 2023-07-04 17:15:15 -05:00
Thomas Waldmann 8db8fd601b
docs: OS X -> macOS 2023-07-04 23:59:44 +02:00
bigtedde 99bf56cfcd delete_cmd converted 2023-07-04 16:53:06 -05:00
bigtedde d18525ae49 debug_cmds added 2023-07-04 16:35:09 -05:00
bigtedde 2cf784d5c6 combined all tests into one single Archiver folder PR 2023-07-04 15:35:51 -05:00
Rayyan Ansari 7e0cdd7c5e testsuite: Enable test_archived_paths on Windows 2023-07-04 19:44:22 +01:00
Rayyan Ansari 54b654e3b1 fs: Properly normalise paths on Windows
Use forward slashes and integrate the drive letter into the path.
2023-07-04 19:44:22 +01:00
TW cd678a032d
Merge pull request #7696 from ThomasWaldmann/macfuse-volname-master
mount: make up volname if not given (macOS), fixes #7690
2023-07-01 16:02:28 +02:00
Thomas Waldmann bd9af62c07
mount: make up volname if not given (macOS), fixes #7690
macFUSE supports a volname mount option to give what
finder displays on desktop / in directory list.

if the user did not specify it, we make something up,
because otherwise it would be "macFUSE Volume 0 (Python)".
2023-07-01 15:35:03 +02:00
Thomas Waldmann 2aecdb91d4
extract: fix false warning about pattern never matching, fixes #4110 2023-07-01 15:31:00 +02:00
Thomas Waldmann 58d3dbcec0
keyfile: improve key sanity check, fixes #7561
check key file structure, make sure the binary key
is not way too short (or zero) length.

if key file looks strange, emit warnings.
2023-06-29 23:13:29 +02:00
Thomas Waldmann ec1f2dfbf1
--files-cache=size: fix crash, fixes #7658 2023-06-29 23:09:24 +02:00
Thomas Waldmann 45cda981f9
test_sparse_file: skip test on win32
about 10-50% of the github windows CI runs fail due to
this - root cause unknown.

Example failure:

        # we first check if we could create a sparse input file:
        sparse_support = is_sparse(filename, total_size, hole_size)
        if sparse_support:
            # we could create a sparse input file, so creating a backup of it and
            # extracting it again (as sparse) should also work:
            self.cmd(f"--repo={self.repository_location}", "rcreate", RK_ENCRYPTION)
            self.cmd(f"--repo={self.repository_location}", "create", "test", "input")
            with changedir(self.output_path):
                self.cmd(f"--repo={self.repository_location}", "extract", "test", "--sparse")
            self.assert_dirs_equal("input", "output/input")
            filename = os.path.join(self.output_path, "input", "sparse")
            with open(filename, "rb") as fd:
                # check if file contents are as expected
>               self.assert_equal(fd.read(hole_size), b"\0" * hole_size)
E               AssertionError: b'\x0[8388602 chars]x00\xf0Y\xb5\xe3\xee\xf3\x1f\xe3L\xcf\xae\x92\[159253621 chars]\x00' != b'\x0[8388602 chars]x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0[159383505 chars]\x00'

src/borg/testsuite/archiver/extract_cmd.py:212: AssertionError
2023-06-22 23:10:31 +02:00
TW c89eb98c18
Merge pull request #7665 from ThomasWaldmann/fix-benchmark
benchmark cpu: use sanitized path, fixes #7653
2023-06-22 21:56:31 +02:00
TW 67a32ee603
Merge pull request #7664 from ThomasWaldmann/test-for-backslashes
no backslashes
2023-06-22 21:41:37 +02:00
Thomas Waldmann 420eae6138
benchmark cpu: use sanitized path, fixes #7654 2023-06-22 21:22:18 +02:00
TW 44147fe5b3
Merge pull request #7663 from ThomasWaldmann/send-log-cb
remote logging/progress: add callback to send queued records, fixes #7662
2023-06-22 21:19:18 +02:00
Thomas Waldmann 4f49f9bae6
make_path_safe: remove test for backslashes, fixes #7651
looks like some tools use backslashes in linux/macOS paths.
2023-06-22 20:49:14 +02:00
Thomas Waldmann 3aec98ada9
remote logging/progress: use callback to send queued records, fixes #7662 2023-06-22 20:09:29 +02:00
Ted Lawson a5c4d0d310
Xattr.py unittest to pytest conversion (#7657) 2023-06-20 16:08:44 +02:00
Tarrailt 616d5e7330
Add --format option to `borg diff`, resolve issue #4634 (#7534)
diff: add --format option

also: refactoring/improvements of BaseFormatter
2023-06-11 22:41:36 +02:00
TW 8506c05ab6
Merge pull request #7642 from Deric-W/typehints
replace `LRUCache` internals with `OrderedDict`
2023-06-11 17:11:41 +02:00
Eric Wolf ad3c890167
rephrase docstring and remove unused sentinel 2023-06-11 13:56:58 +02:00
Eric Wolf e683c80c75
replace `LRUCache` internals with `OrderedDict`
Replacing the internals should make the implementation faster
and simpler since the order tracking is done by the `OrderedDict`.

Furthermore, this commit adds type hints to `LRUCache` and
renames the `upd` method to `replace` to make its use more clear.
2023-06-10 20:57:32 +02:00
TW 4f76f595a9
Merge pull request #7635 from eoli3n/master
Improve patterns help
2023-06-10 14:39:31 +02:00
Thomas Waldmann 518c4fbca8
skip test_import_tar_with_dotdot for binary testing 2023-06-10 14:17:07 +02:00
eoli3n 095d5f463b improve patterns help: added declarative includes sample 2023-06-10 14:00:06 +02:00
eoli3n ba922d2e0a improve patterns help: define a pattern style 2023-06-10 14:00:06 +02:00
eoli3n 9bbb38d9ab improve patterns help 2023-06-10 14:00:06 +02:00
Thomas Waldmann b7ce3b1156
make sure we do not get backslashes into item paths
on windows, we also want slashes, not backslashes.
2023-06-10 12:52:00 +02:00
Thomas Waldmann db96c0c487
subclass MakePathSafeAction from Highlander 2023-06-10 11:41:31 +02:00
Peter Gerber 438cf2e7ef
Sanitize paths during archive creation/extraction/...
Paths are not always sanitized when creating an archive and,
more importantly, never when extracting one. The following example
shows how this can be used to attempt to write a file outside the
extraction directory:

$ echo abcdef | borg create -r ~/borg/a --stdin-name x/../../../../../etc/shadow archive-1 -
$ borg list -r ~/borg/a archive-1
-rw-rw---- root   root          7 Sun, 2022-10-23 19:14:27  x/../../../../../etc/shadow
$ mkdir borg/target
$ cd borg/target
$ borg extract -r ~/borg/a archive-1
x/../../../../../etc/shadow: makedirs: [Errno 13] Permission denied: '/home/user/borg/target/x/../../../../../etc'

Note that Borg tries to extract the file to /etc/shadow and the
permission error is a result of the user not having access.

This patch ensures file names are sanitized before archiving.
As for files extracted from the archive, paths are sanitized
by making all paths relative, removing '.' elements, and removing
superfluous slashes (as in '//'). '..' elements, however, are
rejected outright. The reasoning here is that it is easy to start
a path with './' or insert a '//' by accident (e.g. via --stdin-name
or import-tar). '..', however, seem unlikely to be the result
of an accident and could indicate a tampered repository.

With paths being sanitized as they are being read, this "errors"
will be corrected during the `borg transfer` required when upgrading
to Borg 2. Hence, the sanitation, when reading the archive,
can be removed once support for reading v1 repositories is dropped.
V2 repository will not contain non-sanitized paths. Of course,
a check for absolute paths and '..' elements needs to kept in
place to detect tempered archives.

I recommend treating this as a security issue. I see the following
cases where extracting a file outside the extraction path could
constitute a security risk:

a) When extraction is done as a different user than archive
creation. The user that created the archive may be able to
get a file overwritten as a different user.
b) When the archive is created on one host and extracted on
another. The user that created the archive may be able to
get a file overwritten on another host.
c) When an archive is created and extracted after a OS reinstall.
When a host is suspected compromised, it is common to reinstall
(or set up a new machine), extract the backups and then evaluate
their integrity. A user that manipulates the archive before such
a reinstall may be able to get a file overwritten outside the
extraction path and may evade integrity checks.

Notably absent is the creation and extraction on the same host as
the same user. In such case, an adversary must be assumed to be able
to replace any file directly.

This also (partially) fixes #7099.
2023-06-07 23:23:53 +02:00
Thomas Waldmann ae97584218
fix logging, add some comments
shutting down logging is problematic as it is global
and we do multi-threaded execution, e.g. in tests.

thus, rather just flush the important loggers and keep
them alive.
2023-06-06 21:13:31 +02:00
Thomas Waldmann ffc59dd071
implement unix domain (ipc) socket support
server (listening) side:
borg serve --socket  # default location
borg serve --socket=/path/to/socket

client side:
borg -r socket:///path/to/repo create ...
borg --socket=/path/to/socket -r socket:///path/to/repo ...

served connections:
- for ssh: proto: one connection
- for socket: proto: many connections (one after the other)

The socket has user and group permissions (770).

skip socket tests on win32, they hang infinitely, until
github CI terminates them after 60 minutes.

socket tests: use unique socket name

don't use the standard / default socket name, otherwise tests
running in parallel would interfere with each other by using
the same socket / the same borg serve process.

write a .pid file, clean up .pid and .sock file at exit

add stderr print for accepted/finished socket connection
2023-06-06 21:12:54 +02:00
Thomas Waldmann 7878a34fd4
add get_runtime_dir / BORG_RUNTIME_DIR, tests, docs 2023-06-06 11:58:48 +02:00
TW 9f51600f20
Merge pull request #7627 from ThomasWaldmann/fix-chunksize-distrib-test-master
fix test_buzhash_chunksize_distribution
2023-06-06 10:43:53 +02:00
Thomas Waldmann 6625fb52ac
fix test_buzhash_chunksize_distribution
the last chunk can be smaller than 2**min_exp.
2023-06-06 10:09:53 +02:00
bigtedde 83d821171e Parameterize 'version' and 'item' tests 2023-06-04 14:38:22 -07:00
TW e70b5b1e94
Merge pull request #7620 from bigtedde/parameterize_test_compress
Parametrize compression tests
2023-06-02 23:03:24 +02:00
bigtedde e0f6685498 parameterized compression tests 2023-06-02 12:55:35 -07:00
David Rambo ee0ca13ab5 Update help docs to reflect support for alternative grouping in shell-style patterns 2023-05-31 16:57:31 -07:00
David Rambo 4efc7cd0bd Add support and tests for shell-style alternatives
Code review fixes

Remove empty line
2023-05-31 15:38:05 -07:00
Thomas Waldmann e2ea5cf164
tests: fix usage of .reopen()
also:
add missing param to RemoteRepositoryTestCase.open method, but ignore it.
2023-05-29 23:02:42 +02:00
Thomas Waldmann 48c7879887
RemoteRepository: add .close method
- tears down logging (so no new log output is generated afterwards)
- sends all queued log output
- then returns

also: make stdin_fd / stdout_fd instance variables
2023-05-29 22:40:55 +02:00
Thomas Waldmann f84951b53c
add logging debugging functionality 2023-05-29 22:40:53 +02:00
Thomas Waldmann ac4b5c35da
borg serve: shutdown server after sending all queued log records 2023-05-29 22:40:52 +02:00
Thomas Waldmann 746cef1cba
teardown logging in exec_cmd
for normal borg command invocation:
- logging is set up in Archiver.run
- the atexit handler calls logging.shutdown when process terminates

for tests:
- Archiver.run called by exec_cmd
- no atexit handler executed as process lives on
- borg.logger.teardown (calls shutdown and configured=False) now
  called in exec_cmd
2023-05-29 22:40:50 +02:00
Thomas Waldmann dac4609468
remove_handlers 2023-05-29 22:40:49 +02:00
Thomas Waldmann c3a4568870
channel progress output via logging system
- simplify progress output (no \r, no terminal size related tweaks)
- emit progress output via the logging system (so it does not use stderr
  of borg serve)
- progress code always logs a json string, the json has all needed
  to either do json log output or plain text log output.
- use formatters to generate plain or json output from that.
- clean up setup_logging
- use a StderrHandler that always uses the **current** sys.stderr
- tweak TestPassphrase to not accidentally trigger just because of seeing 12 in output
2023-05-29 22:40:47 +02:00
Thomas Waldmann 0be545dc45
remove ProgressIndicatorEndless (not used) 2023-05-29 22:40:45 +02:00
Thomas Waldmann e351e67aee
RepositoryServer: do not use stderr for logging, see #7604
Instead, install a handler that sends the LogRecord dicts to a queue.
That queue is then emptied in the borg serve main loop and
the LogRecords are sent msgpacked via stdout to the client,
similar to the RPC results.

On the client side, the LogRecords are recreated from the
received dicts and fed into the clientside logging system.

As we use msgpacked LogRecord dicts, we don't need JSON for
this purpose on the borg serve side any more.
On the client side, the LogRecords will then be either formatted
as normal text or as JSON log output (by the clientside log
formatter).
2023-05-29 22:40:42 +02:00
Thomas Waldmann 6ae23bc0d7
fix typo 2023-05-29 15:04:30 +02:00
nain 4a7a5b2253 Add function to clear empty directories at end of compact process.
Compact moves data to new segments, and then removes the old segments.
When enough segments are moved, directories holding the now cleared segments
may thus become empty.

With this commit any empty directories are cleared after segments compacting.
Fixes #6823
2023-05-28 01:48:32 -04:00
nain ffe237ce0c unify scanning and listing of segment dirs / segment files and apply good practices
+ os.scandir instead of os.listdir
  Improved speed and added flexibility with attributes (name, path, is_dir(), is_file())
+ use is_dir / is_file to make sure  we're reading only dirs / files respectively
+ Filtering to particular start, end index range built in
+ Move value bounds of segment (index) into constants module and use them instead

Resolves #7597

(forward patch from commits c9f35a16e9bf9e7073c486553177cef79ff1cb06^..edb5e749f512b7737b6933e13b7e61fefcd17bcb)
2023-05-27 07:54:32 -04:00
Thomas Waldmann 89297398c4
fix borg.remote._resolve_path
this used to call get_base_dir (and would have needed
legacy=True now to work like expected).

rather implemented the desired behaviour locally and
got rid of the legacy call (which was a bit strange
anyway as it also considered BORG_BASE_DIR, which is
unexpected when resolving ~).
2023-05-24 17:01:45 +02:00
Thomas Waldmann 90c6b7f794
remote exceptions: simplify sysinfo processing
in the sysinfo function, there is a way to suppress
all sysinfo output via an env var and just return an
empty string.

so we can expect it is always in unpacked, but it
might be the empty string.
2023-05-24 15:30:20 +02:00
Thomas Waldmann 2331341b74
simplify handle_error 2023-05-24 14:38:30 +02:00
Thomas Waldmann 4b796a7337
remote repos: remove support for borg < 1.1.0 ($LOG, logging setup)
log output:

always expect json, remove $LOG format support.

we keep limited support for unstructured format also,
just not to lose anything from remote stderr.
2023-05-24 14:38:24 +02:00
Thomas Waldmann 51177b9f06
remote repos: remove support for borg < 1.1.0 (exceptions)
exception infos:
ancient borg gave only limited infos about exceptions,
but recent ones give more.
2023-05-24 02:13:30 +02:00
Thomas Waldmann 591d8efac4
remote repos: remove support for borg < 1.1.0 (rpc data format, version)
rpc format:
ancient borg used tuples in the rpc protocol,
but recent ones use easier-to-work-with dicts.

version info:
we expect dicts with server/client version now.
2023-05-24 02:13:01 +02:00
Thomas Waldmann 1fb1cc3ea3
tests: check buzhash chunksize distribution, see #7586 2023-05-23 00:20:28 +02:00
jetchirag eeefa55428
do not crash for empty archives list in borg rlist date based matching (#7544)
fix ValueError for empty archives list, add a test

Signed-off-by: Chirag Aggarwal <thechiragaggarwal@gmail.com>
2023-05-20 12:30:03 +02:00
Thomas Waldmann b9d0f00099
RepositoryTestCaseBase: remove need for "with" after reopen()
setUp enters the context manager, so let's .reopen() leave it.
then create a fresh Repository instance in self.repository and
enter the context manager again. tearDown then will leave that.
2023-05-20 01:31:07 +02:00
Thomas Waldmann f0e4be76b1
RepositoryTestCaseBase: call __exit__
As we call __enter__ in setUp,
let's call __exit__ in tearDown.
2023-05-20 01:31:05 +02:00
Thomas Waldmann 3d82be0b58
fix RepositoryTestCaseBase.reopen method
"if self.repository" did not work as expected:
- Repository has a __len__ method, so the boolean evaluation was calling that.
- self.repository is also not set to None anywhere.
2023-05-20 01:30:14 +02:00
Thomas Waldmann 989b0a2847
use correct path for security dir when accessing legacy repos (v1)
while on macOS the new and old security dir location is the same path,
this is not the case on e.g. Linux, it could move from .config/borg/security to
.local/share/borg/security .

See #5760.
2023-05-19 21:12:59 +02:00
Thomas Waldmann b8d49a0274
put security infos into data dir, fixes #5760 2023-05-18 12:48:45 +02:00
Thomas Waldmann b0b32e35f5
tests: avoid long ids in pytest output
sometimes the automatically computed IDs are just too long,
so rather give IDs directly or avoid them otherwise.
2023-05-18 05:46:33 +02:00
Thomas Waldmann 0744b7a241
fix test_extract_continue for hfs timestamp granularity 2023-05-17 00:19:42 +02:00
Thomas Waldmann 82ccf0c08c
fix test_extract_continue
make a hardlink to keep the inode allocated,
so it can not re-use the same inode when it
(deletes and re)creates the file.
2023-05-16 19:12:46 +02:00
elandorr bfe6e0da5d
Update create_cmd.py 2023-05-15 11:49:22 +00:00
elandorr c83507eb0c
mention paths-from-stdin's exclusiveness 2023-05-14 19:24:55 +00:00
elandorr 4fb2f2151e
include/exclude options 2023-05-14 19:23:15 +00:00
elandorr e086d2a8f6
markup fix + note about MAX_DATA_SIZE 2023-05-14 07:14:48 +00:00
elandorr 8e2f5a621b
escape 2023-05-14 07:09:45 +00:00
TW b70cefa474
Merge pull request #7556 from ThomasWaldmann/kill-nonce-manager
remove nonce management, related repo methods
2023-05-12 00:00:29 +02:00
Thomas Waldmann f970679b62
low_level crypto: fix borg version in comments 2023-05-11 20:10:55 +02:00
Thomas Waldmann 44f58b0870
low_level crypto: minor cleanup
HMAC is not used, we use hmac from py stdlib.
2023-05-11 20:09:47 +02:00
Thomas Waldmann e02d9edc34
remove nonce management, related repo methods
not needed for borg2 repos (we derive a new session key for each borg
invocation and start counting from 0).

also not needed for borg 1.x repos because we only read them (borg transfer)
and won't write new encrypted data to them.
2023-05-11 17:51:49 +02:00
Thomas Waldmann 0b62338d4a
borg transfer --compression=C --recompress=M, fixes #7529 2023-04-24 23:46:38 +02:00
TW ee9bf28df9
Merge pull request #7524 from ThomasWaldmann/test-no-backslashes
tests: check for posix-like paths in archives, see #7120
2023-04-18 18:21:48 +02:00
Thomas Waldmann 573275e678
extract --continue: continue a previously interrupted extraction, fixes #1356
This skips over all previously fully extracted regular files,
but will delete and fully re-extract incomplete files.
2023-04-16 21:09:48 +02:00
Thomas Waldmann 7786cc7cb4
extract: support extraction of atime/mtime on win32 2023-04-16 20:40:35 +02:00
Thomas Waldmann 9e534c1929
Archive.extract_item: remove unused params, make most params kwargs
stripped_components: this is done already in do_extract, it modifies item.path accordingly.

original_path: not used any more.

also: run black.
2023-04-16 15:40:36 +02:00
Thomas Waldmann 0dee28bd9f
tests: check for posix-like paths in archives, see #7120 2023-04-15 20:29:26 +02:00
TW 0679cbd410
Merge pull request #7523 from ThomasWaldmann/optimize-src-dir-master
tests: use a smaller dir for src_dir, fixes #7518
2023-04-15 17:19:32 +02:00
Thomas Waldmann 4505c90920
tests: use a smaller dir for src_dir, fixes #7518
also: introduce src_file, which is a file in src_dir.
2023-04-15 16:46:23 +02:00
TW b52a8af6f0
Merge pull request #7517 from snsmac/feat/highlander
Ensure that cli options specified with action=Highlander can only be set once.
2023-04-15 16:45:28 +02:00
snsmac 53b4cf05fb Ensure that cli options specified with action=Highlander can only be set once, even if the set value is a default value. Add tests for action=Highlander. See #7500 #6269 2023-04-15 16:12:36 +02:00
TW 9263705de7
Merge pull request #7521 from ThomasWaldmann/fix-argparse-errors-master
Fix argparse error messages
2023-04-15 15:08:07 +02:00
TW 81e618ba28
Merge pull request #7513 from ThomasWaldmann/friendlier-exceptions-master
refactor toplevel exception handling, see #6018
2023-04-15 15:03:27 +02:00
Thomas Waldmann 0b40e038ad
fix CompressionSpec validator and tests 2023-04-12 01:45:46 +02:00
Thomas Waldmann 05bf29f504
fix SortBySpec validator 2023-04-12 01:21:43 +02:00
Thomas Waldmann 0f923c8c4a
fix FilesCacheMode validator 2023-04-12 01:18:05 +02:00
Thomas Waldmann 6d38530ff1
fix ChunkerParams validator and tests 2023-04-12 01:15:46 +02:00
TW 1e1c922298
Merge pull request #7512 from ThomasWaldmann/prune-list-pruned-master
prune --list-kept/--list-pruned, fixes #7511
2023-04-08 17:37:33 +02:00
TW 33599b9115
Merge pull request #7509 from ThomasWaldmann/build-filter-microopt
build_filter: micro opt / easier code, fixes #3390
2023-04-08 17:11:40 +02:00
Thomas Waldmann 02b28882b3
prune --list-kept/--list-pruned, fixes #7511
use this to only list the kept (or pruned) archives.
--list-pruned and --list-kept also work in a additive way.

implied logging: support multiple prune options activating same logger

if any of --list / --list-kept / --list-pruned is used,
it should put the borg.output.list logger to INFO level,
otherwise to WARN level.
2023-04-08 15:40:07 +02:00
Thomas Waldmann 9f4f2b42e3
implement BORG_<CMD>_FORMAT env vars, fixes #5166
for now for: prune, list, rlist.
2023-04-08 00:53:53 +02:00
Thomas Waldmann b0b3d9e08c
refactor toplevel exception handling, see #6018
as a first step, i moved all the traceback formatting
to format_tb.

also, it **first** prints the error and then the traceback
as additional information for a bug report, as suggested
by @jimparis in that ticket.
2023-04-08 00:12:06 +02:00
TW 48f3161248
Merge pull request #7510 from ThomasWaldmann/prune-format-master
prune --short/--format: enable users to format the list output, fixes #3238
2023-04-07 20:24:40 +02:00
TW b8337b6f77
Merge pull request #7507 from ThomasWaldmann/ignore-empty-path-master
create: ignore empty paths, print warning, fixes #5637
2023-04-07 19:39:27 +02:00
TW cfbaa3feae
Merge pull request #7506 from ThomasWaldmann/archive-size-nfiles
rlist: size and nfiles format keys
2023-04-07 19:38:54 +02:00
Thomas Waldmann 7686a721af
strip_components: remove bad test 2023-04-07 19:34:32 +02:00
Thomas Waldmann a0e1110c16
prune --short/--format: enable users to format the list output, fixes #3238 2023-04-07 19:30:22 +02:00
Thomas Waldmann 8060d4100a
build_filter: micro opt / easier code, fixes #3390 2023-04-07 18:21:17 +02:00
Thomas Waldmann 08a2db9410
benchmark crud: use TemporaryDirectory below given path, fixes #4706 2023-04-07 18:05:19 +02:00
Thomas Waldmann 7df6301144
create: ignore empty paths, print warning, fixes #5637 2023-04-07 17:04:00 +02:00
Thomas Waldmann 7a2c757c69
rlist: add size and nfiles to format keys, fixes #6086 2023-04-07 16:37:17 +02:00
Thomas Waldmann 355a50225f
ArchiveFormatter.get_meta: add default value argument 2023-04-07 14:23:43 +02:00
TW 6662b8dadb
Merge pull request #7498 from ThomasWaldmann/mount-dir-check-master
mount: improve mountpoint error msgs, see #7496
2023-04-06 20:26:43 +02:00
Thomas Waldmann 12f9a26fad
common options: more Highlander options, fixes #6269 2023-04-06 19:11:58 +02:00
Thomas Waldmann 971438dfa0
import/export-tar: more Highlander options, fixes #6269 2023-04-06 17:53:27 +02:00
Thomas Waldmann d0d8cd1edf
serve: more Highlander options, fixes #6269 2023-04-06 17:49:40 +02:00
Thomas Waldmann 1a6d1d0c7c
rlist: more Highlander options, fixes #6269 2023-04-06 17:47:56 +02:00
Thomas Waldmann 6ca2256f26
rcompress: more Highlander options, fixes #6269 2023-04-06 17:46:17 +02:00
Thomas Waldmann 644796ad6b
list: more Highlander options, fixes #6269 2023-04-06 17:44:07 +02:00
Thomas Waldmann 6074ca44d9
debug: more Highlander options, fixes #6269 2023-04-06 17:40:47 +02:00
Thomas Waldmann ffdd156fd4
compact: more Highlander options, fixes #6269 2023-04-06 17:36:49 +02:00
Thomas Waldmann 5d8986c440
check: more Highlander options, fixes #6269 2023-04-06 17:35:54 +02:00
Thomas Waldmann afccb1dee5
transfer: more Highlander options, fixes #6269 2023-04-06 17:33:41 +02:00
Thomas Waldmann 79b39c4652
recreate: more Highlander options, fixes #6269 2023-04-06 17:31:48 +02:00
Thomas Waldmann 21a3a95cc8
rcreate: more Highlander options, fixes #6269 2023-04-06 17:26:31 +02:00
Thomas Waldmann 13e99033cb
delete: more Highlander options, fixes #6269 2023-04-06 17:15:09 +02:00
Thomas Waldmann 1aae04e66e
prune: more Highlander options, fixes #6269 2023-04-06 17:10:16 +02:00
Thomas Waldmann 645b0088c5
create: more Highlander options, fixes #6269 2023-04-06 17:03:08 +02:00
Thomas Waldmann 7eb04b86ed
mount: improve mountpoint error msgs, see #7496
saying "must be a writable directory" can distract
from the real root cause as seen in #7496.

so we better first check if the mountpoint is an
existing directory and if not, just tell that.

after that, we check permissions and if they are not
like required, tell that.
2023-04-04 23:25:29 +02:00
TW ffea8a0f25
Merge pull request #7487 from ThomasWaldmann/pyupgrade-py39-plus
pyupgrade --py39-plus ./**/*.py
2023-04-02 23:02:07 +02:00
TW 4faf375339
Merge pull request #7492 from ThomasWaldmann/fix-progress-msg-width-master
ProgressIndicatorPercent: fix space computation for wide chars, fixes #3027
2023-04-02 22:59:43 +02:00
TW 6b02c05f2b
Merge pull request #7489 from ThomasWaldmann/option-x-help-master
improve --one-file-system help /docs
2023-04-02 21:58:18 +02:00
Thomas Waldmann 3dd14f4855
ProgressIndicatorPercent: fix space computation for wide chars, fixes #3027
needs to use swidth() in case there are wide chars (like CJK)
in the left part of the msg (e.g. an archive name).
2023-04-02 21:57:02 +02:00
Thomas Waldmann b7adee65bd
--one-file-system: add macOS apfs notes, fixes #4876 2023-04-02 17:28:20 +02:00
Thomas Waldmann 63e17d6da2
borgfs.statfs: add comments 2023-04-02 16:56:28 +02:00
Thomas Waldmann 6ca1ed9716
improve --one-file-system help string, fixes #5618 2023-04-02 14:30:53 +02:00
Thomas Waldmann 52793be923
pyupgrade --py39-plus ./**/*.py 2023-04-02 02:14:54 +02:00
nain-F49FF806 dfef2b9092
fix config/cache dir compatibility issues, fixes #7445 (#7448)
fix config dir compatibility issue, fixes #7445

- add tests
- make sure the result of get_cache_dir matches pre and post #7300 where desired
- harmonize implementation of config_dir_compat and cache_dir_compat tests

Co-authored-by: nain <126972030+F49FF806@users.noreply.github.com>
2023-03-30 00:24:42 +02:00
Soumik Dutta 1428ffeae9
Add parse-obj and format-obj debug commands (#7443)
add parse-obj and format-obj debug commands, fixes #7406

Signed-off-by: Soumik Dutta <shalearkane@gmail.com>
2023-03-28 21:45:48 +02:00
Thomas Waldmann 2692fa1146
skip "do not retry when permissions denied" test if running as root
we can not take away read permissions for root,
so the test would fail.
2023-03-28 15:55:10 +02:00
Thomas Waldmann 3d65cb3fea
transfer: verify chunks we get using assert_id, fixes #7383
this needs to decompress and to hash the chunk data,
but better let's play safe.

at least we still can avoid the (re-)compression with
borg transfer (which is often much more expensive
than decompression).
2023-03-27 16:36:53 +02:00
Michael Deyaso 6e8310346e Forward port of #7471. Fixes #7470 2023-03-24 09:01:42 +03:00
Artem Sheremet 335efbf187 Simplify import-tar ignore-zeros negative test
Some of those cleanups are unnecessary since we don't use
assert_dirs_equal.
2023-03-22 11:19:44 +01:00
Artem Sheremet c999d5dded Explain multiple tarball import with ignore-zeros 2023-03-22 11:13:19 +01:00
Artem Sheremet 8071ef6280 Add a negative test for import-tar --ignore-zeros 2023-03-21 23:08:40 +01:00
Artem Sheremet 3c941ae604 Add --ignore-zeros flag to import-tar
Fixes #7432.
2023-03-21 22:49:23 +01:00
TW 46f1cda204
Merge pull request #7455 from ThomasWaldmann/remove-cache-only-from-delete
delete: remove --cache-only option, fixes #7440
2023-03-20 21:48:57 +01:00
Thomas Waldmann dad99650af
test whether borg skips permission denied files without retries 2023-03-20 21:21:15 +01:00
Thomas Waldmann 02eb9cd443
delete: remove --cache-only option, fixes #7440
for deleting the cache only, use:

borg rdelete --cache-only
2023-03-20 20:51:13 +01:00
snsmac 045d428ecc Do not retry on permission errors 2023-03-19 12:35:39 +01:00
Thomas Waldmann 88231a2f64
xattrs: fix namespace processing on FreeBSD, fixes #6997 2023-03-13 11:14:07 +01:00
Thomas Waldmann cf0eade672 debug id-hash: implement file content id-hash computation, see #7406 2023-03-12 18:02:38 +01:00
Thomas Waldmann 1ab90b339e
allow msgpack 1.0.5 also 2023-03-09 22:26:38 +01:00
Michael Deyaso 2c232449b0
Modified Item.pyx to include diffs in ctime and mtime (#7335)
diff: include changes in ctime and mtime, fixes #7248

also:
- sort JSON output alphabetically
- add --content-only to ignore metadata changes

Co-authored-by: Michael Deyaso <mdeyaso@fusioniq.io>
2023-03-06 23:18:36 +01:00
Thomas Waldmann e7de9dcdcb "auto" compressor tests: do not assume zlib is better than lz4, fixes #7363
while that might be true for many cases, we can not assume it is
always true, as proven by the failing test on S390.
2023-03-06 18:43:09 +01:00
TW 9f703e9138
Merge pull request #7403 from ThomasWaldmann/mount-docs-master
docs: improve mount options rendering, fixes #7359
2023-03-05 17:48:24 +01:00
Thomas Waldmann 9a39b53828
debug put-obj: id must be given on commandline, fixes #7290
this is an incompatible change:

before:
borg debug put-obj path1 path2 ...
(and borg computed all IDs automatically) (*)

after:
borg debug put-obj id path
(id must be given)

(*) the code just using sha256(data) was outdated and incorrect anyway.

also: debug get-obj: improve error handling
2023-03-04 20:05:23 +01:00
Thomas Waldmann 1632d6305e
docs: improve mount options rendering, fixes #7359 2023-03-04 16:56:18 +01:00
TW 437ee97e66
Merge pull request #7388 from diivi/feat/log-cache-dir
feat: add cache dir to --debug
2023-02-26 21:02:12 +01:00
Divyansh Singh 7dd186ccf3 feat: add cache dir to --debug 2023-02-26 23:48:35 +05:30
Thomas Waldmann a3ab390e59
test_create_read_special_symlink: fix exception in test cleanup code on FreeBSD, fixes #7386 2023-02-26 19:10:39 +01:00
Thomas Waldmann 98338f4cc0
hfs+ filesystem (darwin64 VM) has 1s ts granularity, fixes #7387 2023-02-26 19:07:10 +01:00
Thomas Waldmann 2b935cfe41
transfer: fix exception in dry-run mode
Only call archive.stats.show_progress(final=True) if
we actually have an archive (== not in dry-run mode).
2023-02-26 00:41:13 +01:00
Soumik Dutta cad138aa23
Add files changed while reading to Statistics class #7354 (#7378)
add files changed while reading to Statistics class, fixes #7354

Signed-off-by: Soumik Dutta <shalearkane@gmail.com>
2023-02-25 01:47:39 +01:00
Thomas Waldmann 7e6afc93e9
create: implement retries for individual fs files
Errors handled for backup src files:
- BackupOSError (converted from OSError), e.g. I/O Error
- BackupError (stats race, file changed while we backed it up)

Error Handling:
- retry the same file after some sleep time
- sleep time starts from 1ms, increases exponentially up to 10s
- 10 tries

If retrying does not help:
- BackupOSError: skip the file, log it with "E" status
- BackupError: last try will back it up, log it with "C" status

Works for:
- borg create's normal (builtin) fs recursion
- borg create --paths-from-command
- borg create --paths-from-stdin

Notes:
- update stats.files_stats late (so we don't get wrong
  stats in case of e.g. IOErrors while reading the file).
- _process_any: no changes to the big block, just indented
  for adding the retry loop and the try/except.
- test_create_erroneous_file succeeds because we retry the file.
2023-02-23 01:19:19 +01:00
TW 6da5b7d1ba
Merge pull request #7367 from ThomasWaldmann/new-crypto-assert-id
assert_id: better be paranoid, fixes #7362
2023-02-23 01:14:25 +01:00
vhadzhiev a08a3eb173 fixed Statistics.__add__(), fixes #7355 2023-02-20 11:25:28 +02:00
Thomas Waldmann 74a19ee2a0
verify_data: always decompress and call assert_id(), see #7362 2023-02-19 21:25:24 +01:00
Thomas Waldmann fea630027c
assert_id: better be paranoid, fixes #7362
This makes borg2's new crypto do the same check as borg1's old crypto
and makes sure that no chunks created by an evil borg client would
go unnoticed.
2023-02-19 21:14:20 +01:00
Thomas Waldmann 71f8dd3a17
FilesystemObjectProcessors.process_pipe: also add same exception handler there 2023-02-13 20:46:48 +01:00
Thomas Waldmann c9dbe323e3
TarfileObjectProcessors.process_file: also add same exception handler there 2023-02-13 20:46:46 +01:00
Thomas Waldmann d0c61bbbf1
FilesystemObjectProcessors.process_file: clean up orphaned chunks in case of exceptions
Note: no changes inside the indented block,
just added the try and the except block.
2023-02-13 20:46:45 +01:00
Thomas Waldmann f1981715e4
2nd+ hardlinks: add to item.chunks after incref'ing
we do book-keeping in item.chunks:
in case something goes wrong and we need to clean up,
we will have a list with chunks to decref in item.chunks.

also:
- make variable naming more consistent
- cosmetic changes
2023-02-13 20:46:21 +01:00
Thomas Waldmann 5cb3a17796
Revert "avoid orphan content chunks on BackupOSError, fixes #6709"
This reverts commit ffe32316a5.
2023-02-13 18:24:28 +01:00
Thomas Waldmann 11fd6afb0f
use "fail" chunker to test erroneous input file skipping
if a file can't be read (like here: there is a simulated
I/O error in the 2nd chunk of file2), it should be logged
with "E" status, skipped and backup shall proceed with
next file(s).

also, check that the repo has no orphan chunks (exception
handling code needs to deal with 1st chunk of file2 which
already has been written / incref'd in the repo).
2023-02-13 17:19:49 +01:00
Thomas Waldmann 7f973a5b34
implement "fail" chunker for testing purposes
--chunker-params=fail,4096,rrrEErrrr means:
- cut chunks of 4096b fixed size (last chunk in a file can be less)
- read chunks 0, 1 and 2 successfully
- error at chunk 3 and 4 (simulated OSError(errno.EIO))
- read successfully again for the next 4 chunks

Chunks are counted inside the chunker instance, starting
from 0, always increasing while the same instance is used.

Read chunks as well as failed chunks count up by 1.
2023-02-13 17:15:45 +01:00
Dan Christensen 3daf7e186d testsuite/hashindex.py: add comments about validity of hashtables 2023-02-12 09:39:07 -05:00
Dan Christensen c705c8573d testsuite/hashindex.py: add a few more tests 2023-02-12 08:28:14 -05:00
Dan Christensen 8eff0b2f02 _hashindex.c: fix comment 2023-02-12 08:24:27 -05:00
Dan Christensen 2f9f22e2a8 hashindex.py: make black happy 2023-02-11 20:33:07 -05:00
Dan Christensen 36aa395e49 _hashindex.c: set min_empty and num_empty even when permit_compact=True 2023-02-11 20:11:09 -05:00
Dan Christensen 60bea46eb7 _hashindex.c: rewrite hashindex_compact 2023-02-11 20:10:02 -05:00
Dan Christensen 6f5efb3f74 testsuite/hashindex.py: create and use compare_compact to avoid repetition 2023-02-11 20:06:38 -05:00
Dan Christensen d3fd93f82b testsuite/hashindex.py: use compare_indexes in one more spot 2023-02-11 19:53:28 -05:00
Dan Christensen cc78ef8939 testsuite/hashindex.py: add two more tests 2023-02-11 19:44:56 -05:00
Dan Christensen 6aa53a5627 hashindex_pytest.py: add test_hashindex_compact_stress 2023-02-11 19:13:20 -05:00
Dan Christensen 51b29ab426 hashindex.py: make .compact tests independent of order 2023-02-11 17:37:53 -05:00
Dan Christensen 133ffebc8d hashindex_pytest.py: factor out verify_hash_table 2023-02-11 17:37:20 -05:00
TW 6db21fa330
Merge pull request #7344 from RayyanAnsari/parseformat-rm-hack
parseformat: remove Windows-specific hack
2023-02-11 18:23:47 +01:00
TW 098fca7861
Merge pull request #7343 from ThomasWaldmann/timestamp-comparisons-master
relaxed timestamp comparisons (master)
2023-02-11 18:15:02 +01:00
Rayyan Ansari 03a27654e0 parseformat: remove Windows-specific hack
This fixes the rest of the tests.
2023-02-11 16:32:19 +00:00
Thomas Waldmann aee17a87e2
tests: use same_ts_ns for all timestamp comparisons 2023-02-11 17:08:56 +01:00
TW d90ebc8bef
Merge pull request #7340 from ThomasWaldmann/fix-recreate-rechunkify-master
recreate: --chunker-params must default to None, fixes #7337
2023-02-11 14:11:03 +01:00
TW ce04521a9a
Merge pull request #7333 from ThomasWaldmann/excluded-included-status-chars
better included/excluded status chars, docs, fixes #7321
2023-02-11 13:48:43 +01:00
TW f39d1bcd7b
Merge pull request #7334 from ThomasWaldmann/list-progress-json-is-nice
allow mixing --progress and --list in log-json mode
2023-02-11 13:42:59 +01:00
Thomas Waldmann 2ef09eaa77
same_ts_ns: add a timestamp comparison function
also: HAVE_UTIMES means 1us resolution (*)

(*) at least as far as the utimes() call is concerned.

Whether there are other limitations has to be seen.
2023-02-11 01:19:01 +01:00
Thomas Waldmann ce5f1589ea
recreate: --chunker-params must default to None, fixes #7336
also add a test: recreate without --chunker-params shall not rechunk

before the fix, it triggered rechunking if an archive
was created with non-default chunker params.

but it only should rechunk if borg recreate is invoked with explicitly giving --chunker-params=....
2023-02-11 01:08:01 +01:00
Thomas Waldmann fdc48fdd1b
more directory timestamp tests 2023-02-11 00:42:30 +01:00
Thomas Waldmann a42cd161de
add test for extracted directory mtime 2023-02-11 00:29:57 +01:00
Thomas Waldmann ff564de1cc
allow mixing --progress and --list in log-json mode 2023-02-10 01:45:59 +01:00
Thomas Waldmann 303c474f21
better included/excluded status chars, docs, fixes #7321
more consistent now between dry-run and non-dry-run mode.

--filter=... users might need to update the status chars they filter for.
2023-02-10 01:13:21 +01:00
TW 366731ba00
Merge pull request #7300 from RayyanAnsari/borg-platformdirs
use platformdirs
2023-02-10 00:09:44 +01:00
Thomas Waldmann 3d57dc0590
hashindex: add tests, misc. minor fixes/changes
test hashtable expansion/rebuild.

hashindex_lookup:
- return -2 for a compact / completely full hashtable
- return -1 and (via start_idx pointer) the deleted/tombstone bucket index.

fix size assertion (we add 1 element to trigger rebuild)

fix upper_limit check - since we'll be adding 1 to num_entries below,
the condition should be >=:

hashindex_compact: set min_empty/upper_limit

Co-authored-by: Dan Christensen <jdc+github@uwo.ca>
2023-02-09 22:14:07 +01:00
Thomas Waldmann 1ed8ac0408
hashindex_pytest: move hashtable create into separate function 2023-02-09 21:58:40 +01:00
Thomas Waldmann e556233e30
hashindex_pytest: add a comment 2023-02-09 21:58:37 +01:00
Thomas Waldmann 4c2af9fb96
renamed hashindex_stress -> hashindex_pytest 2023-02-09 21:58:23 +01:00
Thomas Waldmann 316bb7c937
add num_entries assertion 2023-02-08 22:45:11 +01:00
Thomas Waldmann b79766a933
hashindex: simplify size_idx function
Thanks to @jdchristensen for the code.
2023-02-08 22:11:49 +01:00
Thomas Waldmann a13d53ec1e
Simplify full HT scan assertion 2023-02-08 22:11:47 +01:00
Thomas Waldmann 4fc7815f11
hashindex: always have at least 1 empty bucket
avoid rounding / integer conversion issues bringing this down to 0.
2023-02-08 22:11:44 +01:00
Thomas Waldmann 4f8c4aea19
implement ht idx wrap around less strangely, add comment 2023-02-08 22:11:43 +01:00
Thomas Waldmann 907da00931
if HT is full with entries and tombstones: give up/fail early 2023-02-08 22:11:41 +01:00
Thomas Waldmann 0098ac9e63
more comments for hashindex_lookup 2023-02-08 22:11:34 +01:00
Thomas Waldmann 9bf352d00c
bugfix: do not resize hashindex with wrong num_empty
otherwise we would lose the decrement operation on num_empty.
2023-02-08 22:10:50 +01:00
Thomas Waldmann 83e6b4269e
hashindex: simplify assert 2023-02-08 16:25:15 +01:00
Thomas Waldmann c9573c04ac
_hashindex: easier to understand code, dubious loops removed, asserts
hashindex_index returns the perfect hashtable index, but does not
check what's in the bucket there, so we had these loops afterwards
to search for an empty or deleted bucket.

problem: if the HT were completely filled with no empty and no deleted
buckets, that loop would never end. due to our HT resizing, it can
never happen, but still not pretty.

when using hashindex_lookup (as also used some lines above), the code
is easier to understand, because (after we resized the HT), we freshly
create the same situation as after the first call of that function:
- return value < 0, because we (still) can not find the key
- start_idx will point to an empty bucket

Thus, we do not need the problematic loops we had there.

Modified the checks to make sure we really have an empty or deleted
bucket before overwriting it with data.

Added some additional asserts to make sure the code behaves.
2023-02-08 14:51:54 +01:00
Thomas Waldmann 3e33656238
add comment about how to provoke more collisions 2023-02-08 02:13:14 +01:00
Thomas Waldmann 9697f55534
add hashtable stress tests
Using NSIndex (repo index) HashIndex, but they all are very similar.
2023-02-08 01:53:30 +01:00
Thomas Waldmann 516c070c7c
fix tests for platformdirs 3.x.x 2023-02-07 21:14:16 +01:00
Thomas Waldmann d9875a4d7e
improve test_get_security_dir 2023-02-04 18:23:35 +01:00
Thomas Waldmann 078bb7ee02
improve test_get_keys_dir 2023-02-04 18:19:15 +01:00
Thomas Waldmann 6ab424598d
improve test_get_cache_dir 2023-02-04 18:17:43 +01:00
Thomas Waldmann 4bacd0b722
improve test_get_config_dir 2023-02-04 18:15:57 +01:00
Thomas Waldmann bb73e8682f
fix win2 typo 2023-02-04 18:11:28 +01:00
Thomas Waldmann 499e5133b5
test_config_dir_compat: don't test on win32
there is no old borg < 2.0 there anyway.
2023-02-04 01:18:16 +01:00
Thomas Waldmann bde0f11e1e
get_security_dir: legacy=False default 2023-02-04 00:35:04 +01:00
Thomas Waldmann 1d4810af23
get_keys_dir: legacy=False default 2023-02-04 00:35:03 +01:00
Thomas Waldmann b06dd1c66c
get_config_dir: legacy=False default 2023-02-04 00:35:01 +01:00
Thomas Waldmann ebcda6f0a5
get_cache_dir: legacy=False default 2023-02-04 00:34:57 +01:00
Thomas Waldmann 424be763b2
get_base_dir: legacy=False default 2023-02-04 00:34:54 +01:00
Thomas Waldmann 81595a9ca0
conftest.py: use BORG_BASE_DIR to redirect borg testing .config/.cache into a temp dir
XDG_*_HOME is not honoured on macOS and on Windows if we use platformdirs.
2023-02-04 00:34:52 +01:00
Thomas Waldmann fddf6afded
get_*_dir: make legacy=... kwarg only
it's better readable.
2023-02-04 00:34:45 +01:00
Thomas Waldmann 437b5fa859
do not fail on macOS due to different dirs from platformdirs 2023-02-04 00:34:42 +01:00
Thomas Waldmann 8379ecefaa
deal with BORG_BASE_DIR 2023-02-04 00:34:26 +01:00
Thomas Waldmann d3d909ad31
add compatibility test: legacy vs. non-legacy platformdirs 2023-02-03 18:22:51 +01:00
Rayyan Ansari f2452aef2a
helpers: use platformdirs on win32 2023-02-03 17:46:49 +01:00
Thomas Waldmann 7ad25ba9e2
transfer: support --progress 2023-02-03 02:10:29 +01:00
TW 63a0b3bed4
Merge pull request #7310 from ThomasWaldmann/avoid-orphan-content-chunks2
avoid orphan content chunks on BackupOSErrors
2023-02-03 02:08:49 +01:00
TW c96c5652b0
Merge pull request #7317 from pgerber/hanging-test
Fix test hanging reading FIFO when `borg create` failed
2023-02-03 01:59:15 +01:00
Thomas Waldmann ffe32316a5
avoid orphan content chunks on BackupOSError, fixes #6709
if we run into some issue reading an input file, e.g. an I/O error,
the BackupOSError exception raised due to that will skip the current
file and no archive item will be created for this file.

But we maybe have already added some of its content chunks to the repo,
we have either written them as new chunks or incref'd some identical chunk
in the repo.

Added an exception handler that decrefs (and deletes if refcount reaches 0)
these chunks again before re-raising the exception, so the repo is in a
consistent state again and we do not have orphaned content chunks in the repo.
2023-02-03 01:35:12 +01:00