Commit graph

1486 commits

Author SHA1 Message Date
Thomas Waldmann
49b1421682 FUSE: support pyfuse3 additionally to llfuse, fixes #5407
FUSE implementation can be switched via env var BORG_FUSE_IMPL.
2020-10-31 22:04:44 +01:00
Marian Beermann
c81bc43ad5 export-tar: set tar format to GNU_FORMAT explicitly
Python 3.8 changed the default format to PAX, but GNU format is
documented for Borg.
2020-10-17 21:52:40 +02:00
eike-fokken
1f0458d016
Clarify '--one-file-system' for btrfs (#5391)
docs: clarify borg create's '--one-file-system' option, #4009

The documentation now explicitly mentions btrfs subvolumes and
explains how --one-file-system works.

Co-authored-by: Eike <e.fokken+git@posteo.de>
2020-10-12 13:26:09 +02:00
Thomas Waldmann
725402371d upgrade bundled zstd to 1.4.5 2020-10-04 19:03:17 +02:00
Thomas Waldmann
f41a264d77 if self test fails, also point to OS and hardware, fixes #5334 2020-10-01 20:58:58 +02:00
Thomas Waldmann
24e89dd1aa upgrade bundled xxhash to 0.8.0, fixes #5362 2020-09-29 12:11:38 +02:00
Thomas Waldmann
90aef3bfcc docs: mention double --force in prune docs 2020-09-27 23:57:30 +02:00
TW
47446f2043
Merge pull request #5330 from ThomasWaldmann/better-error-msg-large-archive
prettier error message when archive gets too big, fixes #5307
2020-09-22 12:22:29 +02:00
Thomas Waldmann
0839ac3034 prettier error message when archive gets too big, fixes #5307 2020-09-08 21:00:27 +02:00
Thomas Waldmann
bf8706b741 fixup: invert nesting of context managers
cleaner teardown of contexts:

close mmap, close src_fd (reading), close dst_fd (and rename)

maybe it was not a real problem to rename a still open-for-reading / mmapped file,
but in any case it is cleaner like now.
2020-09-08 18:26:03 +02:00
Thomas Waldmann
b198160257 check --repair: fix potential data loss, fixes #5325
We already have used SaveFile context manager since long at other places.
By using it, the original segment file stays in place until recovery of it
is completed (writing/syncing into *.tmp).
On successful completion, .tmp is renamed over original + dir syncing.
If aborted by some exception, including Ctrl-C, the original file is unmodified.
2020-09-08 18:25:36 +02:00
TW
9d96d78d19
Merge pull request #5266 from fantasya-pbem/docs/5165_recreate-list-item-flags_master
docs: point to borg create --list item flags in recreate usage, fixes #5165
2020-07-30 12:12:17 +02:00
Thalian
78396bfc23 docs: point to borg create --list item flags in recreate usage, fixes #5165 2020-07-30 07:39:33 +02:00
Peter Gerber
97f84a6cb2 Stop relying on false exiting with status code 1
According to the manpage, it's only guaranteed to return with
an exit code indicating an error. However, the manpage is silent
on the exact code returned.

Likely fixes #5273.
2020-07-29 06:12:08 +00:00
Thomas Waldmann
7bfa766192 persist shadow_index in between borg runs, fixes #4830
in borg 1.1, compact_segments() was always run directly after some repo writing
operation (in same borg process). but now, only "borg compact" is used to compact
segments and it is a separate borg invocation (new process), so we need to persist
the shadow_index so we do not lose that information.
2020-07-28 21:15:56 +02:00
Thomas Waldmann
9bf030ef2c add a test for hints persistence and behaviour, see #4830 2020-07-28 21:15:31 +02:00
Thomas Waldmann
220d890f32 fix locking on openindiana, fixes #5271
OI rmdir gives errno 17 EEXIST when trying to remove a non-empty dir,
not ENOTEMPTY like other OSes.

Also: fix one error handler to also use a tuple-member check instead of "or".
2020-07-26 15:25:26 +02:00
Thalian
528e507d21 docs: add a note to create from stdin regarding files cache, fixes #5180 2020-07-25 20:10:29 +02:00
TW
303c11f245
rephrase some warnings, fixes #5164 (#5241)
rephrase some warnings, fixes #5164

borg check --repair and borg recreate are now present in the code since rather long, so they are not experimental any more.

borg recreate might be used wrongly (e.g. accidentally excluding everything / not matching anything when recreating an archive). added some warning words in the docs, but it will not ask for confirmation any more.

borg check: there might be kinds of corruption borg check --repair can not fix and it might make things even worse while trying to fix. so this will still ask for confirmation, just with different wording.
2020-07-10 19:26:18 +02:00
Thomas Portmann
ef9fdcf992 fix race condition in lock migration, fixes #4953
- add a daemonizing() ctx manager

The foreground borg mount process (local repo) survives until the lock
migration (performed by the background) is finished, so the lock to be
migrated is never stale, and the race condition is gone.

- add a test case revealing that locking is not safe during daemonization (borg mount)

- amend printing in testsuite.archiver
2020-07-09 21:31:13 +02:00
Thomas Waldmann
264c799c50 use allow/deny list wording 2020-07-07 23:01:55 +02:00
TW
ca75f08c14
Merge pull request #5246 from ThomasWaldmann/sizeof_fmt
sizeof_fmt
2020-07-06 22:58:35 +02:00
Thomas Waldmann
87e3b699c0 revert 0-formatting to be compatible with previous behaviour
as we format differences (growing/shrinking) we want:
-N  # negative / shrinking
 0  # no change -> no +/- sign here!
+N  # positive / growing
2020-07-06 19:47:15 +02:00
Dark Dragon
831448684c Improve sizeof_fmt()
- Use built-in sign handling
- Format integer correctly when using biggest unit
- Use consistent format inside and outside of loop
2020-07-06 19:42:36 +02:00
Thomas Portmann
dfc5e915cc
Fixed locking, issue #4923 (#4928)
locking: fix ExclusiveLock race condition bug, fixes #4923

- ExclusiveLock is now based on os.rename instead of os.mkdir.
- catch FileNotFoundError observed under race condition in ExclusiveLock.release()
  and .kill_stale_lock()
- added TestExclusiveLock.test_race_condition() which reveals issue #4923
- updated docs
- locking: use "raise LockTimeout from None" for prettier traceback

Co-authored-by: Thomas Portmann <thomas@portmann.org>
Co-authored-by: Thomas Waldmann <tw@waldmann-edv.de>
2020-07-03 10:09:32 +02:00
Thomas Waldmann
e0545e921d exit with 128 + signal number, fixes #5161
as documented:

https://borgbackup.readthedocs.io/en/stable/usage/general.html#return-codes

compatibility warning: in case you have scripts expecting rc == 2 for a
signal exit, you need to update them to check for >= 128.
2020-06-30 00:17:10 +02:00
TW
5b5bd9f7f2
Merge pull request #5238 from fantasya-pbem/docs/5193_Recreate-exclude-if-present
docs: clarify --exclude-if-present in recreate, #5193
2020-06-29 21:18:12 +02:00
Thalian
f096656438 docs: clarify how exclude options work in recreate, #5193
fixes #5193
2020-06-28 15:40:28 +02:00
TW
7033d5054f
Merge pull request #5226 from ThomasWaldmann/server-enforces-umask
--umask is for the local borg process only, fixes #4947
2020-06-28 14:58:41 +02:00
TW
8e846935a2
Merge pull request #5201 from strager/import-to-key-file
allow key-import+BORG_KEY_FILE to create key files
2020-06-20 00:32:09 +02:00
Thomas Waldmann
d2536de4ee fix hardlinked CACHEDIR.TAG processing, fixes #4911 2020-06-14 22:00:02 +02:00
Thomas Waldmann
29731401b5 add test for hardlinked CACHEDIR.TAG issue #4911 2020-06-14 20:36:47 +02:00
Thomas Waldmann
c531901763 --umask is for the local borg process only, fixes #4947
The umask value is NOT transmitted from client to server any more,
so the borg client can not influence the borg server umask any more.

If one wants to have a specific umask on the server side, one needs to
use a ssh forced command in .ssh/authorized_keys file.

OTOH, as the default value is 077 (in general, for client as well as for
the server) and the server does not take the value from the client any more,
there usually should be no need to give it on the server side, IF you are
happy with the default value.
2020-06-14 18:35:03 +02:00
Thomas Waldmann
dee402652f --read-special: .part files also should be regular files, fixes #5217 2020-06-14 15:36:22 +02:00
Thomas Waldmann
d8cbdfc359 fix typo 2020-06-08 01:46:56 +02:00
Matthew Glazar
5a32de918e allow key-import+BORG_KEY_FILE to create key files
Running 'borg key import' on a keyfile repository with the BORG_KEY_FILE
environment variable set works correctly if the BORG_KEY_FILE file
already exists. However, the command crashes if the BORG_KEY_FILE file
does not exist:

    $ BORG_KEY_FILE=newborgkey borg key import /home/strager/borg-backups/straglum borgkey
    Local Exception
    Traceback (most recent call last):
      [snip]
      File "[snip]/borg/crypto/key.py", line 713, in sanity_check
        with open(filename, 'rb') as fd:
    FileNotFoundError: [Errno 2] No such file or directory: '[snip]/newborgkey'

    Platform: Linux straglum 5.0.0-25-generic #26~18.04.1-Ubuntu SMP Thu Aug 1 13:51:02 UTC 2019 x86_64
    Linux: debian buster/sid
    Borg: 1.1.11  Python: CPython 3.7.7 msgpack: 0.5.6
    PID: 15306  CWD: /home/strager/Projects/borg
    sys.argv: ['[snip]/borg', 'key', 'import', '/home/strager/borg-backups/straglum', 'borgkey']
    SSH_ORIGINAL_COMMAND: None

Make 'borg key import' not require the BORG_KEY_FILE file to already
exist.

This commit does not change the behavior of 'borg key import' without
BORG_KEY_FILE. This commit also does not change the behavior of 'borg
key import' on a repokey repository.
2020-06-04 19:29:15 -07:00
Matthew Glazar
538d3245cd refactor key file searching functions
I want to change the key lookup logic for the 'borg key import' command.
Extract methods out of the KeyfileKey.find_key and
KeyfileKey.get_new_target to make this future change possible without
duplicating code.

This commit should not change behavior.
2020-06-03 19:02:33 -07:00
Peter Gerber
00b09370c0
Allow creating archives using stdout of given command (#5174)
allow creating archives using stdout of given command

In addition to allowing:

some-command --param value | borg create REPO::ARCH -

also allow:

borg create --content-from-command create REPO::ARCH -- some-command --param value

The difference is that the latter approach deals with errors properly.
In the former example, an archive is created no matter what. Even, if
`some-command` aborts and the output is truncated, Borg won't realize.
In the latter example, the status code is checked and archive creation
is aborted properly when appropriate.
2020-06-02 22:24:14 +02:00
TW
ebd83a5688
Merge pull request #5206 from elho/feature/fix-unintended-preload
fix memory leak related to preloading, fixes #5202

affected: extract, recreate and other functions.
2020-06-02 02:39:20 +02:00
Elmar Hoffmann
dad3aa9dae rename local preload() function to not overwrite keyword argument of same name
The locally defined preload() function overwrites the preload boolean keyword
argument, always evaluating to true, so preloading is done, even when not
requested by the caller, causing a memory leak.
Also move its definition outside of the loop.

This issue was found by Antonio Larrosa in borg issue #5202.
2020-06-01 17:12:51 +02:00
Thomas Waldmann
bf2fadc54d test_delete_force: avoid sporadic test setup issues, fixes #5196
the old test stumbled over files with an empty chunks list,
so I guess just having some empty file in src/borg could make
that test fail.

fixed this by deleting a chunk of some specific file (we use
this file / this construction at misc. other places in the
archiver tests).
2020-06-01 15:38:52 +02:00
Hauke Rehfeld
9019b48fd5
parseformat: unnecessary calls removed (#5169)
parseformat: unnecessary calls removed

also: list item formatter: remove add_key because only use was in the constructor
2020-04-30 20:11:38 +02:00
TW
08a12cc405
Merge pull request #5160 from fantasya-pbem/bugfix/borg-config-last-segment-checked
borg config --list does not show last_segment_checked, fixes #5159
2020-04-28 19:31:32 +02:00
Thalian
94189b3203 [BUGFIX] Borg config --list does not show last_segment_checked, #5159
fixes #5159
2020-04-27 21:31:57 +02:00
RR
0e76dff33e
fix "--recompress option is counter intuitive", fixes #5154 (#5155)
docs: clarify --recompress option, fixes #5154
2020-04-27 21:08:47 +02:00
TW
914a52ac15
Merge pull request #4683 from elho/only-compress-if-smaller
only store compressed data if the result actually is smaller
2020-04-21 22:43:03 +02:00
Elmar Hoffmann
d1e730355d only store compressed data if the result actually is smaller
- add DecidingCompressor class providing generic decide(),
  decide_compress() and compress() suited to work using a typical
  private _decide() implementation that eventually generates compressed
  data as a side-effect of the actual decision process
- the new decide_compress() method returns both the actually used
  compressor (which may be NONE) and the compressed data to allow
  the auto compressor to use that information instead of having to
  figure out whether the LZ4 compressor decided to use NONE or LZ4
  compression
- derive LZ4, LZMA and ZSTD classes from DecidingCompressor and
  have them fall back to NONE if the compressed data turns out bigger
  than the original data
- leave ZLIB as is, as it does not use an ID header and compatibility
  being the only reason to use it instead of above algorithms anyway
- adapt testsuite to cope with incompressible test data not being
  compressed
- add tests to verify that incompressible data is not compressed to
  larger size compressed data
2020-04-21 18:32:12 +02:00
TW
27a41f5c1f
Merge pull request #5115 from ThomasWaldmann/redo-pr-4269
docs: clarify borg init's encryption modes
2020-04-21 11:45:40 +02:00
finefoot
07e445f026
Fix read-only tests for fakeroot environment 2020-04-20 20:29:37 +02:00
finefoot
f320384827
Fix testing of unsuccessful mount 2020-04-19 22:24:11 +02:00