Commit graph

748 commits

Author SHA1 Message Date
enkore
6cd7d415ca hashindex: Use Python I/O (#2496)
- Preparation for #1688 / #1101
- Support hash indices >2 GB
- Better error reporting
2017-05-09 21:30:14 +02:00
enkore
c805adc267 Merge pull request #2489 from enkore/issue/2169
consider repokey w/o passphrase == unencrypted
2017-05-08 08:57:15 +02:00
enkore
badc79c323 Merge pull request #2488 from enkore/issue/2439
list: --json-lines for archive contents
2017-05-07 22:31:58 +02:00
Marian Beermann
1daab244c6 testsuite.archiver: normalise pytest.raises vs. assert_raises 2017-05-07 22:21:40 +02:00
Marian Beermann
d964101eb5 consider repokey w/o passphrase == unencrypted 2017-05-07 22:13:49 +02:00
Marian Beermann
be9a94c22c list: add test for handling of --json/--json-lines 2017-05-07 22:04:25 +02:00
TW
06a4e722a5 Merge pull request #2486 from enkore/f/common-progress
make --progress a common option
2017-05-06 23:08:42 +02:00
enkore
85df969c34 Merge pull request #2485 from enkore/issue/2469.2
fix --exclude and --exclude-from recursing into directories
2017-05-06 14:39:13 +02:00
Marian Beermann
a719097611 add test case for --log-json 2017-05-05 16:05:12 +02:00
Marian Beermann
2a22f93e44 list: JSON lines output for archive contents 2017-05-05 15:49:56 +02:00
Marian Beermann
bd8186f901 make --progress a common option
everything that touches the repository can take a long time and display
progress information, from compaction to replaying segments.
2017-05-05 15:12:23 +02:00
Marian Beermann
4d9fd6d13f fix --exclude and --exclude-from recursing into directories 2017-05-05 14:55:01 +02:00
Marian Beermann
ba5d6693f9 --json: fix encryption[mode] not being the cmdline name 2017-05-05 14:38:21 +02:00
Marian Beermann
a976e11a63 create crypto package with key, keymanager, low_level 2017-05-02 20:49:27 +02:00
Marian Beermann
956b50b29c move chunker to borg.algorithms 2017-05-02 19:15:01 +02:00
Marian Beermann
390aa76c72 move blake2 to borg/algorithms 2017-05-02 18:53:54 +02:00
Marian Beermann
fa381ffcbe create package borg.algorithms with borg.algorithms.crc32 module 2017-05-02 18:53:54 +02:00
Marian Beermann
ef4cdfacae patterns: use set literal instead of set([]) 2017-05-01 22:20:34 +02:00
Marian Beermann
c5e3232187 patterns: explicate translate source 2017-05-01 22:20:34 +02:00
Marian Beermann
580496b592 create patterns module 2017-05-01 22:20:33 +02:00
enkore
65bdeb47ca Merge pull request #2404 from ThomasWaldmann/limit-y2038
embrace y2038 issue to support 32bit platforms
2017-04-29 23:36:18 +02:00
Thomas Waldmann
d949d6bc7c fix invalid param issue in benchmarks
fixes CID1431887
2017-04-29 03:00:59 +02:00
enkore
c43cfb708f Merge pull request #2432 from ThomasWaldmann/beyond-repair
more clear exception if borg check does not help, fixes #2427
2017-04-28 16:06:54 +02:00
enkore
6109d223ee Merge pull request #2443 from ThomasWaldmann/verify-data-defect-chunk-processing
verify_data: fix IntegrityError handling for defect chunks, fixes #2442
2017-04-28 10:50:23 +02:00
Thomas Waldmann
f0188449c3 add hint about chunker params to borg upgrade docs, fixes #2421 2017-04-25 22:47:18 +02:00
Thomas Waldmann
ca6257dd48 clarify borg upgrade docs, fixes #2436 2017-04-25 22:21:58 +02:00
Thomas Waldmann
28b0700437 verify_data: fix IntegrityError handling for defect chunks, fixes #2442
just getting data from the repo can already raise IntegrityErrors
in LoggedIO, so we need to catch them also.

see also the code a few lines above where this is done in the same way.
2017-04-25 15:48:16 +02:00
Thomas Waldmann
de76a6b821 embrace y2038 issue to support 32bit platforms 2017-04-24 18:50:33 +02:00
TW
6f47b797f9 Merge pull request #2322 from edgimar/master
allow excluding parent and including child, fixes #2314
2017-04-23 12:58:10 +02:00
Thomas Waldmann
697942cd01 be more clear that this is a "beyond repair" case, fixes #2427 2017-04-20 19:54:45 +02:00
Marian Beermann
7b519e4769 platform.linux: get rid of "resource" module 2017-04-19 11:31:40 +02:00
Mark Edgington
798127f636 allow excluding parent and including child, fixes #2314
This fixes the problem raised by issue #2314 by requiring that each root
subtree be fully traversed.

The problem occurs when a patterns file excludes a parent directory P later
in the file, but earlier in the file a subdirectory S of P is included.
Because a tree is processed recursively with a depth-first search, P is
processed before S is.  Previously, if P was excluded, then S would not even
be considered.  Now, it is possible to recurse into P nonetheless, while not
adding P (as a directory entry) to the archive.

With this commit, a `-` in a patterns-file will allow an excluded directory
to be searched for matching descendants.  If the old behavior is desired, it
can be achieved by using a `!` in place of the `-`.

The following is a list of specific changes made by this commit:

 * renamed InclExclPattern named-tuple -> CmdTuple (with names 'val' and 'cmd'), since it is used more generally for commands, and not only for representing patterns.
 * represent commands as IECommand enum types (RootPath, PatternStyle, Include, Exclude, ExcludeNoRecurse)
 * archiver: Archiver.build_matcher() paths arg renamed -> include_paths to prevent confusion as to whether the list of paths are to be included or excluded.
 * helpers: PatternMatcher has recurse_dir attribute that is used to communicate whether an excluded dir should be recursed (used by Archiver._process())
 * archiver: Archiver.build_matcher() now only returns a PatternMatcher instance, and not an include_patterns list -- this list is now created and housed within the PatternMatcher instance, and can be accessed from there.
 * moved operation of finding unmatched patterns from Archiver to PatternMatcher.get_unmatched_include_patterns()
 * added / modified some documentation of code
 * renamed _PATTERN_STYLES -> _PATTERN_CLASSES since "style" is ambiguous and this helps clarify that the set contains classes and not instances.
 * have PatternBase subclass instances store whether excluded dirs are to be recursed.  Because PatternBase objs are created corresponding to each +, -, ! command it is necessary to differentiate - from ! within these objects.
 * add test for '!' exclusion rule (which doesn't recurse)
2017-04-12 12:06:18 -04:00
TW
9ae4bf023e Merge pull request #2188 from rciorba/hashindex_test
add extra test for the hashindex
2017-04-09 20:47:00 +02:00
Patrick Goering
f64f432e51 catch exception for os.link when hardlinks are not supported 2017-04-08 17:10:02 +02:00
Radu Ciorba
9f31dba7b5 cleanup the test and add more checks 2017-04-07 16:00:34 +03:00
Radu Ciorba
8c2064cc5a add extra test for the hashindex
Insert a few keys, delete some of them, check we still have
the values we expect, check the deleted ones aren't there.
2017-04-07 16:00:34 +03:00
Marian Beermann
03ed4d31ca recreate: expand placeholders 2017-04-06 11:37:55 +02:00
Thomas Waldmann
c7256abd84 borg rename: expand placeholders, fixes #2386 2017-04-06 01:03:24 +02:00
enkore
736a815972 Merge pull request #2342 from ThomasWaldmann/generic-hardlinks
Generic hardlinks
2017-04-05 14:34:29 +02:00
enkore
7255e3b298 Merge pull request #2387 from enkore/f/placeholders-internals
placeholders: deny access to internals and other unspecified stuff
2017-04-05 14:10:30 +02:00
enkore
9a1c1e90c1 Merge pull request #2375 from enkore/buhdf
BORG_HOSTNAME_IS_UNIQUE=yes by default.
2017-04-05 14:09:58 +02:00
Thomas Waldmann
155f38c233 remove comment about strange hardlink_masters term
(maybe revisit this later, this is not in scope of the generic hardlinks refactor)
2017-04-05 13:56:57 +02:00
Marian Beermann
cc24fa2064 format_line: whitelist instead of checking against blacklist 2017-04-05 13:51:20 +02:00
Thomas Waldmann
8f769a9b24 implement and use hardlinkable() helper 2017-04-05 13:38:27 +02:00
Thomas Waldmann
cb86bda413 extract: implement extract_helper context manager
Most code of the CM is just moved 1:1 from the regular file block.

Use the CM for regular files, FIFOs and devices, but not for:
- directories (can not have hardlinks)
- symlinks (we can not support hardlinked symlinks)
2017-04-05 13:36:09 +02:00
Thomas Waldmann
cda7465038 extract: indent code, no semantics change
prepare for a extract_helper context manager

(some changes may seem superfluous, but see the following changesets)
2017-04-05 13:36:00 +02:00
Thomas Waldmann
3cc1cdd2ed extract: refactor hardlinks related code
prepare for a extract_helper context manager

(some changes may seem superfluous, but see the following changesets)
2017-04-05 13:03:58 +02:00
Thomas Waldmann
23cc679617 no hardlinking for directories and symlinks
- nlink > 1 for dirs does not mean hardlinking
  (at least not everywhere, wondering how apple does it)
- we can not archive hardlinked symlinks due to item.source dual-use,
  see issue #2343.

likely nobody uses this anyway.
2017-04-05 13:03:53 +02:00
Thomas Waldmann
1f6dc55eab simplify char/block device file dispatching 2017-04-05 13:01:04 +02:00
Thomas Waldmann
9478e8abd0 support hardlinks via create_helper context manager
also: reduce code duplication
2017-04-05 12:58:25 +02:00
Thomas Waldmann
e5d094d0ce use same finalizing code for hardlink masters and slaves
hardlink slaves get a precomputed size attribute now.
2017-04-05 12:31:15 +02:00
Thomas Waldmann
a206a85890 indent block, no semantics change 2017-04-05 12:31:11 +02:00
Thomas Waldmann
66f4cd1a29 minor refactor for regular file hardlink processing 2017-04-05 12:24:08 +02:00
enkore
7a80b1802f Merge pull request #2383 from enkore/f/recreaterecompressargsthingsthatareugly
recreate: add --recompress flag, avoid weirdo use of args.compression
2017-04-05 12:23:59 +02:00
Marian Beermann
707316b0ea placeholders: document escaping 2017-04-05 00:11:46 +02:00
Marian Beermann
1bd381a13a format_line: deny conversions (!r, !s, !a) 2017-04-05 00:09:32 +02:00
Marian Beermann
e2e172c74f format_line: clearer error message for unrecognized placeholder 2017-04-05 00:09:32 +02:00
Marian Beermann
1924e33ef5 format_line: deny access to internal objects 2017-04-05 00:09:31 +02:00
Marian Beermann
dcfbd39125 recreate: unify --always-recompress and --recompress 2017-04-04 18:34:37 +02:00
Marian Beermann
88dfb3e9c5 serve: fix forced command lines containing BORG_ env vars 2017-04-04 15:25:40 +02:00
Marian Beermann
b2953357ed recreate: add --recompress flag, avoid weirdo use of args.compression 2017-04-04 15:11:15 +02:00
Marian Beermann
2ff75d58f2 remove Chunk() 2017-04-04 00:16:15 +02:00
Marian Beermann
69fb9bd403 remove --compression-from 2017-04-04 00:16:15 +02:00
Marian Beermann
929f2760dd change global compression default to lz4 as well
To be consistent with --compression defaults.
2017-04-04 00:16:15 +02:00
Marian Beermann
0847c3f9a5 Unify ComprSpec and CompressionSpec; don't instanciate Compressors right away 2017-04-04 00:16:14 +02:00
Marian Beermann
d1826cca92 Rename CompressionDecider1 -> CompressionDecider 2017-04-03 21:31:28 +02:00
Marian Beermann
0c7410104c Rename Chunk.meta[compress] => Chunk.meta[compressor] 2017-04-03 21:31:28 +02:00
Marian Beermann
88647595ac compress: docs 2017-04-03 21:31:28 +02:00
Marian Beermann
5a20fc08de key: compress(chunk) return data 2017-04-03 21:31:28 +02:00
Marian Beermann
a27f585eaa refactor CompressionDecider2 into a meta Compressor 2017-04-03 21:31:28 +02:00
Marian Beermann
bb6b4fde93 BORG_HOSTNAME_IS_UNIQUE=yes by default. 2017-04-01 21:28:41 +02:00
Thomas Waldmann
bdbcbf7bb8 extract: remove duplicate code
anything at <path> gets nuked already a few lines above, if possible.
2017-04-01 16:56:21 +02:00
Thomas Waldmann
d4e27e2952 extract: small bugfix and refactoring for parent dir creation
make_parent(path) helper to reduce code duplication.
also use it for directories although makedirs can also do it.

bugfix: also create parent dir for device files, if needed.
2017-03-28 23:22:25 +02:00
Thomas Waldmann
ceaf4a8fcf extract: small bugfix and optimization for hardlink masters
if a hardlink master is not in the to-be-extracted subset, the "x"
status was not displayed for it.

also, the matcher was called twice for matching items.
2017-03-28 22:02:54 +02:00
Thomas Waldmann
38860b3f53 lz4 compress: lower max. buffer size, exception handling
on the wheezy32 test machine, a test testing with corrupted data crashed
with a MemoryError when it tried to get a ~800MB large buffer.
MemoryError is now transformed to DecompressionError, so it gets handled
better.

Also, the bound for giving up is now much lower: 1GiB -> 128MiB.
2017-03-27 12:08:54 +02:00
Thomas Waldmann
acd3da62f4 add docstring to do_benchmark_crud 2017-03-27 01:57:52 +02:00
Thomas Waldmann
5bc17148e1 patterns help: mention path full-match in intro 2017-03-27 01:45:04 +02:00
Thomas Waldmann
cb6bfdf4d6 add docs for path full-match patterns 2017-03-27 00:31:08 +02:00
Thomas Waldmann
93feb75411 optimize PathFullPattern matching for O(1) time
For a borg create run using a patterns file with 15.000 PathFullPattern excludes
that excluded almost all files in the input data set:
- before this optimization: ~60s
- after this optimization: ~1s
2017-03-27 00:31:08 +02:00
Thomas Waldmann
ebd928795e add PathFullPattern
not really a pattern (as in potentially having any variable parts) - it just does a full,
precise match, after the usual normalizations.

the reason for adding this is mainly for later optimizations, e.g. via set membership check,
so that a lot of such PathFullPatterns can be "matched" within O(1) time.
2017-03-27 00:31:08 +02:00
Thomas Waldmann
90dd0e8eca fix symlink item fs size computation
a symlink has a 'source' attribute, so it was confused with a hardlink
slave here. see also issue #2343.

also, a symlink's fs size is defined as the length of the target path.
2017-03-26 23:11:14 +02:00
Thomas Waldmann
a9088135aa RemoteRepository: shutdown with timeout 2017-03-26 17:41:41 +02:00
Thomas Waldmann
945880af47 implement async_response, add wait=True for add_chunk/chunk_decref
Before this changeset, async responses were:
- if not an error: ignored
- if an error: raised as response to the arbitrary/unrelated next command

Now, after sending async commands,  the async_response command must be used
to process outstanding responses / exceptions.

We are avoiding to pile up lots of stuff in cases of high latency, because we do NOT
first wait until ALL responses have arrived, but we just can begin to process responses.
Calls with wait=False will just return what we already have received.
Repeated calls with wait=True until None is returned will fetch all responses.

Async commands now actually could have non-exception non-None results, but
this is not used yet. None responses are still dropped.

The motivation for this is to have a clear separation between a request
blowing up because it (itself) failed and failures unrelated to that request /
to that line in the sourcecode.

also: fix processing for async repo obj deletes

exception_ignored is a special object used that is "not None" (as None is used to signal
"finished with processing async results") but also not a potential async response result value.

Also:

added wait=True to chunk_decref() and add_chunk()

this makes async processing explicit - the default is synchronous and you only
need to be careful and do extra steps for async processing if you explicitly
request async by calling with wait=False (usually for speed reasons).

to process async results, use async_response, see above.
2017-03-26 17:33:19 +02:00
enkore
713889dbfd Merge pull request #2340 from jdchristensen/auto-threshold
With --compression auto,C, only use C if lz4 achieves at least 3% compression
2017-03-26 04:59:42 +02:00
Dan Christensen
48652a65a6 With --compression auto,C, only use C if lz4 achieves at least 3% compression 2017-03-25 19:57:54 -04:00
Thomas Waldmann
1a376ae1f1 PatternMatcher: only normalize the path once
not N times for N patterns.
2017-03-25 23:16:05 +01:00
Thomas Waldmann
126e782998 path normalization: rather use function than decorator
less and less complex code, more flexible usage.
2017-03-25 22:49:39 +01:00
Thomas Waldmann
2414cd4df7 use immutable data structure for the compression spec, fixes #2331
the bug was compr_args.update(compr_spec), helpers.py:2168 - that mutated
the compression spec dict (and not just some local one, but the compr spec
dict parsed from the commandline args).

so a change that was intended just for 1 chunk changed the desired
compression level on the archive scope.

I refactored the stuff to use a namedtuple (which is immutable, so such
effects can not happen again).
2017-03-24 03:09:55 +01:00
Thomas Waldmann
1b008f725c fixup: remove unneeded imports 2017-03-21 02:42:51 +01:00
Thomas Waldmann
b27cc37e85 safe_timestamp: arg is always an int
the Item object already does the bigint_to_int decode when accessing .mtime/.atime/.ctime
2017-03-21 02:40:50 +01:00
Thomas Waldmann
3665cc3024 bigint conversion: add compatibility note 2017-03-21 02:27:20 +01:00
Thomas Waldmann
f708183743 Revert "don't do "bigint" conversion for nanosecond mtime"
This reverts commit 8b2e7ec680.

We still need the bigint stuff for borg 1.0 compatibility.

# Conflicts:
#	src/borg/cache.py
2017-03-21 02:21:32 +01:00
Thomas Waldmann
04dba76fc9 Mostly revert "clean imports, remove unused code"
This reverts commit b7eaeee266.

We still need the bigint stuff for compatibility to borg 1.0 archives.

# Conflicts:
#	src/borg/archive.py
#	src/borg/archiver.py
#	src/borg/helpers.py
#	src/borg/key.py
2017-03-21 02:05:38 +01:00
TW
16e6e3d989 Merge pull request #2288 from ThomasWaldmann/patterns-style-default
support setting the pattern style default in patterns file
2017-03-17 14:09:47 +01:00
TW
10d4c97cad Merge pull request #2309 from ThomasWaldmann/fix-2304
clamp (nano)second values to unproblematic range, fixes #2304
2017-03-16 20:31:39 +01:00
Thomas Waldmann
b7a17a6db7 clamp (nano)second values to unproblematic range, fixes #2304
filesystem -> clamp -> archive (create)
2017-03-16 20:31:05 +01:00
Thomas Waldmann
42371181fc support switching the pattern style default in patterns file 2017-03-16 19:37:48 +01:00
enkore
883a7eefb2 Archive: allocate zeros when needed (#2308)
fixes huge memory usage of mount (8 MiB × number of archives)
2017-03-15 17:08:07 +01:00
Milkey Mouse
2117861738 Securely erase config file, fixes #2257
The SaveFile code, while ensuring atomicity, did not allow for secure
erasure of the config file (containing the old encrypted key). Now it
creates a hardlink to the file, lets SaveFile do its thing, and writes
random data over the old file (via the hardlink). A secure erase is
needed because the config file can contain the old key after changing
one's password.
2017-03-12 12:18:02 +01:00
Thomas Waldmann
23f6a82f1b fix borg key/debug/benchmark crashing without subcommand, fixes #2240 2017-03-12 11:55:43 +01:00
Thomas Waldmann
a842001385 fix error msg, it is --keep-within, not --within 2017-03-12 11:53:42 +01:00
Marian Beermann
cdb4df0885 --log-json: time property on most progress/log objects, remove is_prompt 2017-03-09 21:36:37 +01:00
Marian Beermann
e98b5b20df yes(): handle JSON output 2017-03-09 21:36:37 +01:00
Abdel-Rahman
63b5cbfc99 extract: warning RC for unextracted big extended attributes, followup (#2258)
* Set warning exit code when xattr is too big

* Warnings for more extended attributes errors (ENOTSUP, EACCES)

* Add tests for all xattr warnings
2017-03-08 17:13:42 +01:00
enkore
fc41c98a86 Redo key_creator, key_factory, centralise key knowledge (#2272)
* key: put key metadata (name, storage) into key classses

* keymanager: use key-declared storage types
2017-03-08 17:08:54 +01:00
Mark Edgington
e4391dec54 docs: improve --exclude-if-present and --keep-exclude-tags 2017-03-07 22:32:52 -05:00
Abdel-Rahman
4b33c3fe14 Add return code functions (#2199) 2017-03-05 13:33:42 +01:00
TW
89114d4885 Merge pull request #2198 from Abogical/too-big-xattr
Handle big extended attributes. Fixes #2161
2017-03-04 17:54:58 +01:00
Thomas Waldmann
fd0649767a hashindex: rebuild hashtable if we have too little empty buckets, fixes #2246
if there are too many deleted buckets (tombstones), hashtable performance goes down the drain.
in the worst case of 0 empty buckets and lots of tombstones, this results in full table scans for
new / unknown keys.
thus we make sure we always have a good amount of empty buckets.
2017-03-04 03:09:18 +01:00
TW
503e9a27e6 Fix compression exceptions (#2224)
* trigger bug in --verify-data, see #2221

* raise decompression errors as DecompressionError, fixes #2221

this is a subclass of IntegrityError, so borg check --verify-data works correctly if
the decompressor stumbles over corrupted data before the plaintext gets verified
(in a unencrypted repository, otherwise the MAC check would fail first).

* fixup: fix exception docstring, add placeholder, change wording
2017-03-04 00:01:02 +01:00
enkore
6468b8a0c2 Merge pull request #2229 from enkore/f/jsonp
JSON progress indicators
2017-03-03 14:39:28 +01:00
Marian Beermann
c50ffc21b0 list: only load cache if needed 2017-03-02 00:24:22 +01:00
Marian Beermann
abb0a20d4f list: files->items, clarifications 2017-03-01 16:58:06 +01:00
Thomas Waldmann
d5707929fd [docs] improve remote-path description
(ported bebehei's 1.0-maint change to master)
2017-03-01 01:53:23 +01:00
TW
0db058345b Merge pull request #2217 from ThomasWaldmann/bench-cmd
borg benchmark crud command
2017-02-28 21:49:04 +01:00
Thomas Waldmann
9f3a970cec borg benchmark crud command, fixes #1788 2017-02-28 20:50:25 +01:00
Alexander 'Leo' Bergolth
5cd424e4be --patterns-from was accessing args.roots instead of args.paths
add a test case that parses a command containing --patterns-from
2017-02-28 14:18:18 +01:00
Marian Beermann
6ee0585b33 extract: fix missing call to ProgressIndicator.finish 2017-02-28 02:04:46 +01:00
Marian Beermann
8e1edaf258 ArchiveFormatter: add "start" key for compatibility with "info" 2017-02-28 01:33:36 +01:00
Marian Beermann
d327109604 json progress: emit info (current $something) 2017-02-28 01:33:36 +01:00
Marian Beermann
fcad0ddab4 pass msgid for common errors 2017-02-28 01:19:20 +01:00
Marian Beermann
9f446aa6d4 pass --log-json to remote
Obviously this means that --log-json with remote repos requires 1.1
on the remote end, but if you don't have that, then random "Remote:"
lines would break stderr anyway.
2017-02-28 01:19:20 +01:00
Marian Beermann
d5515b6952 add msgid to progress output 2017-02-28 01:19:20 +01:00
Marian Beermann
6288c9f751 enhance JSON progress information
separate output types, extra information
2017-02-27 20:30:20 +01:00
enkore
7c9c4b61d7 Merge pull request #2157 from ThomasWaldmann/add-filesize
archived file items: add size metadata
2017-02-27 18:05:43 +01:00
Thomas Waldmann
0721cb1ede files cache: update inode number, fixes #2226 2017-02-27 15:30:55 +01:00
TW
1a67b82726 Merge pull request #2220 from ThomasWaldmann/compression-default-lz4
use lz4 compression by default, fixes #2179
2017-02-27 00:31:43 +01:00
enkore
46787a90a0 Merge pull request #2204 from ThomasWaldmann/test-delete-force
Test delete --force
2017-02-26 21:23:23 +01:00
kmq
757921dbdc
Document relative path usage #1868 2017-02-26 20:33:15 +02:00
Thomas Waldmann
2ad5f903fe add test for borg delete --force 2017-02-26 18:49:10 +01:00
TW
9bc825a27a Merge pull request #2184 from ThomasWaldmann/zap
borg delete --force --force to delete severely corrupted archives, fixes #1975
2017-02-26 18:44:31 +01:00
Thomas Waldmann
92e5db0c2e use lz4 compression by default, fixes #2179
not for create_src_archive() though as this triggers a bug that has to get fixed outside this PR first.
2017-02-26 18:38:29 +01:00
enkore
ecd13f11b0 Merge pull request #2218 from kmq/master
document snapshot usage #2178
2017-02-26 17:34:15 +01:00
Marian Beermann
70c11976bc Add --log-json option for structured logging output 2017-02-26 16:25:58 +01:00
kmq
f7d28e76a0
document snapshot usage #2178 2017-02-26 13:47:26 +02:00
enkore
0f9b7a270d Merge pull request #2203 from enkore/f/jsono
JSON output for major commands
2017-02-25 23:05:35 +01:00
enkore
5c46136433 Merge pull request #2210 from enkore/f/rxtx
RemoteRepository: account rx/tx bytes
2017-02-25 22:41:27 +01:00
Thomas Waldmann
c8ec698d73 Location: accept //servername/share/path 2017-02-24 04:22:12 +01:00
Thomas Waldmann
4d81b186ec borg delete --force --force to delete severely corrupted archives, fixes #1975 2017-02-24 01:28:42 +01:00
Abogical
e487b8404c Add testsuite to test handling of too big xattr 2017-02-23 23:42:56 +02:00
Abogical
4c9bc96fb7 Print a warning for too big extended attributes 2017-02-23 23:42:56 +02:00
Thomas Waldmann
7da0a9c982 borg extract: check file size consistency 2017-02-23 21:46:15 +01:00
Thomas Waldmann
adc4da280d borg check: check file size consistency 2017-02-23 21:46:15 +01:00
Marian Beermann
4f1db82f6d info <archive>: use Archive.info() for both JSON and human display 2017-02-23 21:39:56 +01:00
Thomas Waldmann
50068c596d rename Item.file_size -> get_size
file_size is misleading here because one thinks of on-disk file size,
but for compressed=True, there is no such on-disk file.
2017-02-23 21:27:05 +01:00
Thomas Waldmann
97bb1b7d9a deduplicate / refactor item (c)size code 2017-02-23 21:27:05 +01:00
Thomas Waldmann
0021052dbd reduce code duplication 2017-02-23 21:24:37 +01:00
Thomas Waldmann
ae6742fb34 fuse: use precomputed size from Item 2017-02-23 21:24:37 +01:00
Thomas Waldmann
fe8e14cb2c fuse: get rid of chunk accounting
the chunk accounting code tried to reflect repo space usage via the st_blocks of the files.
so, a specific chunk that was shared between multiple files [inodes] was only accounted for one specific file.
thus, the overall "du" of everything in the fuse mounted repo was maybe correctly reflecting the repo space usage,
but the decision which file has the chunk (the space) was kind of arbitrary and not really useful.

otoh, a simple fuse getattr() was rather expensive due to this as it needed to iterate over the chunks list
to compute the st_blocks value. also it needed quite some memory for the accounting.

thus, st_blocks is now just ceil(size / blocksize).

also: fixed bug that st_blocks was a floating point value previously.

also: preparing for further optimization of size computation (see next cs)
2017-02-23 21:24:37 +01:00
Thomas Waldmann
a52b54dc3c archived file items: add size metadata
if an item has a chunk list, pre-compute the total size and store it into "size" metadata entry.

this speeds up access to item size (e.g. for regular files) and could also be used to verify the validity of the chunks list.

note about hardlinks: size is only stored for hardlink masters (only they have an own chunk list)
2017-02-23 21:24:37 +01:00
Marian Beermann
f3c7e7cd36 RemoteRepository: account rx/tx bytes 2017-02-23 16:50:52 +01:00
Marian Beermann
8cdf192511 list: add "name" key for consistency with info cmd 2017-02-23 15:23:27 +01:00
Marian Beermann
56563a4392 move JSON generation and utilities to helpers 2017-02-23 15:23:27 +01:00
enkore
4862efe718 Merge pull request #2194 from jdchristensen/master
In api decorator, pass wait argument to RemoteRepository.call; fixes …
2017-02-23 14:50:33 +01:00
Marian Beermann
1f8c0929bf list: --json for archive contents listing 2017-02-23 14:28:30 +01:00
Marian Beermann
25781f53d4 list: --json for archive listing 2017-02-23 14:28:15 +01:00
Marian Beermann
6180f5055c info: --json for archives 2017-02-23 14:28:15 +01:00
Marian Beermann
2ab5d0f213 use custom JSON encoder for repr'ing Borg objects consistently 2017-02-23 14:27:52 +01:00
Marian Beermann
7cbade2f8c create: add --json option 2017-02-23 12:00:21 +01:00
Marian Beermann
cc26bdf810 info: add --json option 2017-02-23 11:55:14 +01:00
Marian Beermann
b0e4f13fba set MAX_DATA_SIZE = 20971479 bytes in solid stone 2017-02-23 00:34:40 +01:00
Marian Beermann
69f7810658 info: show utilization of maximum archive size
See #1452

This is 100 % accurate.

Also increases maximum data size by ~41 bytes. Not 100 % side-effect free;
if you manage to exactly land in that area then older Borg would not read
it. OTOH it gives us a nice round number there.
2017-02-22 23:47:21 +01:00
Dan Christensen
20a5282a4c In api decorator, pass wait argument to RemoteRepository.call; fixes #2185 2017-02-22 16:26:08 -05:00
TW
268d74bb43 Merge pull request #2181 from ThomasWaldmann/fix-2180
archive check: detect and fix missing replacement chunks, fixes #2180
2017-02-21 21:57:23 +01:00
enkore
cd1df96ef5 Merge pull request #2171 from ThomasWaldmann/limit-unpacker
borg rpc: use limited msgpack.Unpacker
2017-02-21 21:53:09 +01:00
Thomas Waldmann
8d7dfe739f fix ChunkIndex.__contains__ assertion for big-endian archs
also: add some missing assertion messages

severity:

- no issue on little-endian platforms (== most, including x86/x64)
- harmless even on big-endian as long as refcount is below 0xfffbffff,
  which is very likely always the case in practice anyway.
2017-02-20 07:38:55 +01:00
Thomas Waldmann
b82f648875 archive check: detect and fix missing all-zero replacement chunks, fixes #2180 2017-02-19 03:05:41 +01:00
enkore
63d4cf4c82 Merge pull request #2172 from Abogical/master
Add dsize and dcsize keys, fixes #2164
2017-02-18 18:24:52 +01:00
Abogical
38e4817b48 Correct calculation of unique chunks 2017-02-18 12:37:28 +02:00
Abogical
cd3cbee962 Refactor unique chunks summing 2017-02-18 12:36:08 +02:00
Abogical
6ed0746934 Count non-unique chunks deduplicated sizes 2017-02-17 17:33:04 +02:00
Abogical
59571115a1 Add tests for dsize and dcsize 2017-02-17 15:26:14 +02:00
Abogical
5aa74abedf Add dsize and dcsize keys
These keys shows the amount of deduplicated size and compressed
size of each file in the archive.
2017-02-17 14:28:39 +02:00
Thomas Waldmann
b05893e723 borg rpc: use limited msgpack.Unpacker, fixes #2139
we do not trust the remote, so we are careful unpacking its responses.

the remote could return manipulated msgpack data that announces e.g.
a huge array or map or string. the local would then need to allocate huge
amounts of RAM in expectation of that data (no matter whether really
that much is coming or not).

by using limits in the Unpacker, a ValueError will be raised if unexpected
amounts of data shall get unpacked. memory DoS will be avoided.
2017-02-17 05:44:48 +01:00
Marian Beermann
caeff71a6c init: mandatory --encryption arg 2017-02-16 19:03:23 +01:00
Marian Beermann
788b608aa9 setup.py build_usage/build_man fixes 2017-02-14 23:02:56 +01:00
Marian Beermann
73990b878f create: handle BackupOSError on a per-path level in one spot 2017-02-14 20:39:29 +01:00
Alexander 'Leo' Bergolth
30a5c5e44b add two new options --pattern and --patterns-from as discussed in #1406
# Conflicts:
#	src/borg/archiver.py
#	src/borg/helpers.py
#	src/borg/testsuite/helpers.py

Original-Commit: 876b670d
2017-02-13 21:47:51 +01:00
Thomas Waldmann
8d432b01e1 paperkey.html - decode as utf-8, fixes #2150
hardcoded the encoding for reading it. while utf-8 is the default
encoding on many systems, it does not work everywhere.

and when it tries to decode with the ascii decoder, it fails.
2017-02-13 21:24:34 +01:00
Marian Beermann
1fabb2df58 key export: center QR code on the page 2017-02-13 21:24:33 +01:00
Marian Beermann
04bd6fb013 add test for export key --qr-html 2017-02-13 21:24:33 +01:00
Benedikt Heine
2cdb583879 clearify doc for same filesystems
# Conflicts:
#	src/borg/archiver.py

Original-Commit: d3a2f36b03
2017-02-13 21:24:33 +01:00
Martin Hostettler
179f1bc147 Add qr html export mode to key export command 2017-02-13 21:24:33 +01:00
Martin Hostettler
32e73e8c7e Manifest: Make sure manifest timestamp is strictly monotonically increasing.
Computer clocks are often not set very accurately set, but borg
assumes manifest timestamps are never going back in time.

Ensure that this is actually the case.

# Conflicts:
#	src/borg/helpers.py

Original-Commit: 6b8cf0a
2017-02-13 20:43:57 +01:00
Marian Beermann
e4486cd370 fix rST warning in Repository.scan 2017-02-12 18:51:41 +01:00
Marian Beermann
15dfaae223 docs: create: move --exclude note to main doc 2017-02-12 15:28:59 +01:00
Marian Beermann
0710bbd40e docs: create: move item flags to main doc 2017-02-12 15:28:58 +01:00
Marian Beermann
497da8df04 docs: init: fix markup/typos 2017-02-12 15:27:06 +01:00
Martin Hostettler
e8335dba0f archiver: Add 'debug dump-manifest' and 'debug dump-archive' commands. 2017-02-10 22:56:54 +01:00
Marian Beermann
7e486074e8 docs: list: don't print key listings in fat (html + man) 2017-02-05 15:46:46 +01:00
Marian Beermann
c7106e756e create real nice man pages 2017-02-05 15:46:09 +01:00
Marian Beermann
5bc03cc042 migrate-to-repokey: ask using canonical_path() as we do everywhere else 2017-02-04 15:16:18 +01:00
Marian Beermann
4e0422cdf0 Move change-passphrase to the "key" group (but leave old name, too) 2017-02-04 15:10:45 +01:00
Marian Beermann
5fe32866e6 Move migrate-to-repokey to the "key" command group 2017-02-04 15:10:45 +01:00
TW
c6ea34be96 Merge pull request #2111 from ThomasWaldmann/merge-1.0-maint
Merge 1.0-maint
2017-02-01 12:13:37 +01:00
enkore
f52bf883c3 Merge pull request #2010 from costela/master
change dir_is_tagged to use os.path.exists()
2017-02-01 00:53:36 +01:00
Radu Ciorba
a85cf75465 fix wrong skip_hint on hashindex_set when encountering tombstones
hashindex_lookup would always hint at skipping whatever it's probe
length had been with no regard for tombstones it had encountered. This
meant new keys would not overwrite first tombstones, but would always
land on empty buckets.

The regression was introduced in #1748
2017-01-30 23:29:08 +02:00
Thomas Waldmann
7f2a108c94 fixup: do not access os.POSIX_FADV_* early
before we know posix_fadvise support exists on the platform.
2017-01-30 03:11:42 +01:00
Leo Antunes
dd6b90fe6c change dir_is_tagged to use os.path.exists()
Add --keep-exclude-tags option as alias to --keep-tag-files and
deprecate the later. Also make tagging accept directories as tags,
allowing things like `--exclude-if-present .git`.

fixes #1999
2017-01-29 18:13:51 +01:00
Thomas Waldmann
c0dc644ef6 Merge branch '1.0-maint' into merge-1.0-maint
# Conflicts:
#	MANIFEST.in
#	Vagrantfile
#	docs/changes.rst
#	docs/usage/mount.rst.inc
#	src/borg/archiver.py
#	src/borg/fuse.py
#	src/borg/repository.py
2017-01-29 05:49:53 +01:00
Thomas Waldmann
e0dfb656ee fix crc32 compilation issues on wheezy
moving the declaration / assignment from the middle of the function to the beginning.
2017-01-15 15:09:40 +01:00
Thomas Waldmann
740312f725 Merge branch '1.0-maint' into merge-1.0-maint
# Conflicts:
#	requirements.d/development.txt
#	tox.ini
2017-01-15 01:15:04 +01:00
TW
abfcf9955b Merge pull request #2045 from ThomasWaldmann/fix-platform
posix platform module: only build / import on non-win32 platforms
2017-01-14 16:06:28 +01:00
Marian Beermann
ae0f1422bf crc: openbsd has no Intel intrinsics 2017-01-14 15:24:03 +01:00
Thomas Waldmann
e4c5db4efc posix platform module: only build / import on non-win32 platforms, fixes #2041
rather use a inverted check like "not windows".
also: add a base implementation for this stuff, just raising NotImplementedError
2017-01-14 14:48:49 +01:00
Thomas Waldmann
ededb6f2c8 fix crc32 compile error, fixes #2039 2017-01-14 05:06:15 +01:00
Thomas Waldmann
e431d60cc5 merge 1.0-maint into master
# Conflicts:
#	src/borg/crypto.pyx
#	src/borg/hashindex.pyx
#	src/borg/helpers.py
#	src/borg/platform/__init__.py
#	src/borg/platform/darwin.pyx
#	src/borg/platform/freebsd.pyx
#	src/borg/platform/linux.pyx
#	src/borg/remote.py
2017-01-14 03:07:11 +01:00
Marian Beermann
5cc292c52c fix performance regression in "borg info ::archive" 2017-01-13 15:33:38 +01:00
Marian Beermann
f482c32423 crc32: sb8: remove some unneeded stuff, use hashindex byteorder detection 2017-01-13 00:33:34 +01:00
Marian Beermann
292fb1e2a9 crc: disable nice CLMUL version due to clang bugs. 2017-01-12 21:30:37 +01:00
Marian Beermann
7923088ff9 check: pick better insufficent archives matched warning from TW's merge 2017-01-12 17:04:51 +01:00
Marian Beermann
1d40675ce4 merge fixup 2017-01-12 15:04:57 +01:00
Marian Beermann
ecad0ed53a Merge branch '1.0-maint' into merge/1.0-maint
# Conflicts: ... everywhere ...
#	.travis.yml
#	Vagrantfile
#	borg/testsuite/key.py
#	docs/changes.rst
#	docs/quickstart.rst
#	docs/usage.rst
#	docs/usage/upgrade.rst.inc
#	src/borg/archive.py
#	src/borg/archiver.py
#	src/borg/crypto.pyx
#	src/borg/helpers.py
#	src/borg/key.py
#	src/borg/remote.py
#	src/borg/repository.py
#	src/borg/testsuite/archive.py
#	src/borg/testsuite/archiver.py
#	src/borg/testsuite/crypto.py
#	src/borg/testsuite/helpers.py
#	src/borg/testsuite/repository.py
#	src/borg/upgrader.py
#	tox.ini
2017-01-12 15:01:41 +01:00
enkore
07049098ee Merge pull request #2014 from enkore/f/hostname->fqdn
posix: use fully-qualified hostname + node ID
2017-01-12 02:07:08 +01:00
enkore
ded22d3650 Merge pull request #1927 from ThomasWaldmann/blake2b-mac-key-length
demonstrate mac key length issue
2017-01-12 01:21:13 +01:00
Marian Beermann
81bd55eec3 key testsuite: update blake2 test data to include padded keys 2017-01-12 01:05:59 +01:00
Marian Beermann
b9770c348f posix: use fully-qualified hostname + node ID
The node ID is usually the 48 bit MAC of the primary network
interface.
2017-01-12 00:54:17 +01:00
enkore
902c423086 Merge pull request #1970 from enkore/f/dbg-speed
fast crc
2017-01-02 16:11:11 +01:00
Marian Beermann
56818d1db8 Credit the excellent work of these people in AUTHORS 2017-01-02 15:54:14 +01:00
Marian Beermann
9afebead84 two fast CRC implementations
CRC slice by 8 for generic CPUs outperforms zlib CRC32 on ppc
and x86 (ARM untested but expected to as well).

PCLMULQDQ derived from Intel's zlib patches outperforms every other
CRC implementation by a huge margin.
2017-01-02 15:54:14 +01:00
enkore
cf19db466d Merge pull request #1989 from Abogical/master
Happy new year!
2017-01-01 01:14:08 +01:00
Abogical
f043b966da It's 2017 2016-12-31 16:53:30 +02:00
Thomas Waldmann
7d48878cfe borg init --encryption - remove default
use --encryption=repokey for all the tests except if they
have special needs.
2016-12-24 02:53:44 +01:00
enkore
a4eef67e3b Merge pull request #1912 from Abogical/prune-progress
Add prune progress display
2016-12-22 14:57:26 +01:00
Marian Beermann
742bfa33c4 flake8 2016-12-21 00:36:31 +01:00
Marian Beermann
f9aefd6a68 Merge commit '343387b36ef' into merge/1.0-maint
# Conflicts:
#	src/borg/archiver.py
2016-12-20 23:00:28 +01:00
Marian Beermann
df40b3840c upgrade: --disable-tam
# Conflicts:
#	src/borg/helpers.py
#	src/borg/testsuite/archiver.py
2016-12-20 22:53:57 +01:00
Marian Beermann
c7c8c0fb57 init: explain manifest auth compatibility
# Conflicts:
#	src/borg/archiver.py
2016-12-20 22:53:55 +01:00
Marian Beermann
d15fb241bd check: handle duplicate archive items neatly
# Conflicts:
#	src/borg/archive.py
2016-12-20 22:53:55 +01:00
Marian Beermann
5e1cb9d899 Add tertiary authentication for metadata (TAM) 2016-12-20 22:53:53 +01:00
Marian Beermann
84d13751d5 Fix processing of remote ~/ and ~user/ paths 2016-12-17 14:33:40 +01:00
Marian Beermann
63ce627a35 fix in-file checkpoints when clock jumps 2016-12-17 13:59:37 +01:00
Marian Beermann
a9db2a2e55 Merge branch '1.0-maint' into master
# Conflicts:
#	src/borg/archive.py
#	src/borg/archiver.py
#	src/borg/helpers.py
2016-12-17 13:26:28 +01:00
Marian Beermann
87f8b2bb64 Merge branch 'merge-1.0-maint' of https://github.com/ThomasWaldmann/borg into ThomasWaldmann-merge-1.0-maint 2016-12-17 13:21:58 +01:00
Marian Beermann
34e19ccb6a mention failed operation in per-file warnings
on the one hand one can say it's ugly global state, on the other it's
totally handy!

just have to keep that in mind for MT, but it's rather obvious.
2016-12-14 15:20:08 +01:00
Thomas Waldmann
c855c687eb Merge branch '1.0-maint' 2016-12-14 03:33:53 +01:00
Marian Beermann
be18418b74 cache: no archive caches => work directly on master cache (no merges) 2016-12-08 22:45:59 +01:00
Marian Beermann
e169510116 cache: don't create Item in fetch_and_build_idx 2016-12-08 22:39:04 +01:00
Thomas Waldmann
58752c9de9 add assertion to demonstrate mac key length issue in test data 2016-12-04 17:56:23 +01:00
Abogical
0994a0a681 Let prune --list display archives deleted per total archives 2016-12-03 19:34:45 +02:00
Marian Beermann
b7eaeee266 clean imports, remove unused code 2016-12-03 17:50:50 +01:00
Marian Beermann
8b2e7ec680 don't do "bigint" conversion for nanosecond mtime
2**63 nanoseconds are 292 years, so this change is good until 2262.
See also https://en.wikipedia.org/wiki/Time_formatting_and_storage_bugs#Year_2262

I expect that we will have plenty of time to revert this commit in time
for 2262.

timespec := time_t + long, so it's probably only 64 bits on some platforms
anyway.
2016-12-03 11:52:49 +01:00
Marian Beermann
b3707f7175 Replace backup_io with a singleton
This is some 15 times faster than @contextmanager, because no instance
creation is involved and no generator has to be maintained. Overall
difference is low, but still nice for a very simple change.
2016-12-03 11:52:48 +01:00
Marian Beermann
b885841c39 make item native code
This makes an surprisingly large difference. Test case: ~70000 empty files.
(Ie. little data shoveling, lots of metadata shoveling). Before: 9.1 seconds
+- 0.1 seconds. After: 8.4 seconds +- 0.1 seconds.). That's a huge
win for changing a few lines.

I'd expect that this improves performance in almost all areas that touch
the items (list, delete, prune).
2016-12-03 00:11:36 +01:00
enkore
e9d7f928e2 Merge pull request #1921 from enkore/f/recreate-fixes
recreate fixes
2016-12-03 00:02:01 +01:00
Marian Beermann
a9395dd8b1 recreate: don't rechunkify unless explicitly told so 2016-12-02 20:19:59 +01:00
Marian Beermann
30df63c509 recreate: remove special-cased --dry-run 2016-12-02 18:15:11 +01:00
Marian Beermann
c6f0969352 recreate: update --help 2016-12-02 13:20:43 +01:00
Marian Beermann
c1ccad82c3 recreate: update/remove/rename outdated comments 2016-12-02 12:54:27 +01:00
Marian Beermann
eade10a0a8 recreate: fix crash on checkpoint 2016-12-02 11:39:10 +01:00