Commit graph

748 commits

Author SHA1 Message Date
Marian Beermann
39051ac5f1 file_integrity: split in IntegrityCheckedFile + Detached variant 2017-05-25 14:04:41 +02:00
Marian Beermann
38ed9a20af key file names: limit to 100 characters (not bytes) 2017-05-25 12:36:45 +02:00
Marian Beermann
4b8a04b5e7 key file names: remove colons from host name 2017-05-25 12:32:42 +02:00
enkore
2dcbe02e5a Merge pull request #2528 from ThomasWaldmann/follow-symlinks
document follow_symlinks requirements, check libc, fixes #2507
2017-05-25 09:26:09 +02:00
Marian Beermann
573d728f7a init: don't allow creating nested repositories 2017-05-25 00:36:50 +02:00
TW
9d82db1851 Merge pull request #2539 from RonnyPfannschmidt/avoid-repacakaging-pitfall
fail in borg package if version metadata is completely broken
2017-05-23 15:19:57 +02:00
Ronny Pfannschmidt
53d0f1fd02 fail in borg package if version metadata is completely broken
this helps to fail early when people do badly done scm based repackaging
2017-05-23 14:36:40 +02:00
Thomas Waldmann
0d406e7baf use _host to store host/ipv4/ipv6
for ipv6, it includes the outer square brackets.

the host property strips any outer square brackets.
2017-05-23 03:09:57 +02:00
Benedikt Neuffer
d99aff1276 ipv6 address support
also: Location: more informative exception when parsing fails
2017-05-23 02:08:44 +02:00
Thomas Waldmann
6f81d24324 remove unused no_lchflags_because 2017-05-22 17:54:43 +02:00
Thomas Waldmann
efec00b39c use stat with follow_symlinks=False
should be equivalent to using os.lstat() before.
2017-05-22 17:54:42 +02:00
Thomas Waldmann
094376a8ad require and use chown with follow_symlinks=False
should be equivalent to using os.lchown() before.
2017-05-22 17:54:42 +02:00
Thomas Waldmann
b484c79bc2 document follow_symlinks requirements, check libc, fixes #2507 2017-05-22 17:54:42 +02:00
enkore
58791583d9 Merge pull request #2530 from enkore/f/compact-revisit@2
Repository compaction docs
2017-05-22 13:55:04 +02:00
Marian Beermann
869ab1a47b mount: do pre-mount checks before opening repository 2017-05-22 13:29:38 +02:00
Marian Beermann
8e24ddae06 increase DEFAULT_SEGMENTS_PER_DIR to 2000 2017-05-22 12:31:52 +02:00
enkore
dc02c79e97 Merge pull request #2546 from enkore/issue/2543
docs: add systemd warning regarding placeholders
2017-05-21 17:45:34 +02:00
Marian Beermann
384d7635a4 docs: add systemd warning regarding placeholders 2017-05-21 17:22:29 +02:00
edgimar
ed14181cc1 add test for preserved intermediate folder permissions (#2477)
This tests whether the permissions metadata is preserved when a folder is excluded but still recursed into to find a matching file in a subfolder.
2017-05-21 17:18:56 +02:00
Marian Beermann
e689d8f2f6 mount: check llfuse is installed before asking for passphrase 2017-05-21 11:24:09 +02:00
Marian Beermann
85aabeb9c7 testsuite: call setup_logging after destroying logging config 2017-05-20 22:55:17 +02:00
Marian Beermann
58edbe15f4 xattr: document API 2017-05-20 18:50:10 +02:00
Marian Beermann
c6309b148b fuse: fix crash if empty (None) xattr is read 2017-05-20 18:50:10 +02:00
enkore
5db667881a Merge pull request #2500 from enkore/issue/2487
Verify most operations against securitymanager
2017-05-20 16:00:49 +02:00
Marian Beermann
c23e1e28c6 use assert_secure for all commands that use the manifest
This already excludes the debug commands that we wouldn't want this on.
2017-05-20 14:58:17 +02:00
Marian Beermann
482b65eaea cache: extract CacheConfig class 2017-05-20 14:58:17 +02:00
Marian Beermann
97e9603531 implement --debug-topic for remote servers 2017-05-20 12:55:03 +02:00
Marian Beermann
b3b555395c remote: clarify remote log handling comments 2017-05-20 12:55:03 +02:00
Marian Beermann
5f4d97ff2b remote: restore "Remote:" prefix (as used in 1.0.x) 2017-05-20 12:54:57 +02:00
Marian Beermann
18a2902c9c rpc negotiate: enable v3 log protocol only for supported clients
avoid seeing JSON log output when a 1.1.0b<5 client talks to a
1.1.0b>6 server.
2017-05-20 12:54:48 +02:00
Marian Beermann
fc105b49b1 fix --progress and logging in general for remote 2017-05-20 12:54:48 +02:00
Marian Beermann
9778c103ef serve: fix incorrect type of exception_short for Errors 2017-05-17 16:27:52 +02:00
Marian Beermann
042a4b960b export-tar: test strip-components and hardlinks for partial export 2017-05-17 11:04:20 +02:00
Marian Beermann
293324810b introduce popen_with_error_handling to handle common user errors
(without tracebacks)
2017-05-17 10:54:39 +02:00
enkore
52fab07b3b Merge pull request #2510 from enkore/issue/2473
Add --debug-profile option
2017-05-17 00:10:14 +02:00
enkore
5788219ff4 borg export-tar (#2519) 2017-05-17 00:09:41 +02:00
Marian Beermann
6d6ae65be3 replace external script with "borg debug convert-profile" 2017-05-16 23:30:43 +02:00
Thomas Waldmann
d15c3f2d85 do not test logger name, fixes #2504
looks like PyInstaller modifies the module names.
2017-05-16 21:14:27 +02:00
Marian Beermann
a07463c96a --debug-profile: use msgpack instead of marshal by default 2017-05-16 20:52:18 +02:00
Marian Beermann
4c441c75b1 Implement --debug-profile 2017-05-16 20:52:18 +02:00
Marian Beermann
c831985bba CommonOptions: add unit test 2017-05-16 19:35:15 +02:00
Marian Beermann
150ace13cd init: document --encryption as required 2017-05-16 19:05:54 +02:00
Marian Beermann
b9efdb2ce3 refactor CommonOptions as a reusable class 2017-05-15 17:16:44 +02:00
Marian Beermann
2ab5df0217 support common options on mid-level commands (borg *key* export) 2017-05-15 17:16:27 +02:00
Marian Beermann
d5edb011f0 support common options 2017-05-14 18:45:20 +02:00
enkore
820066da5d Implement IntegrityCheckedFile (#2502)
Implement IntegrityCheckedFile

This is based on much earlier work from October 2016 by me, but is
overall simplified and changed terminology (from "signing" to
hashing and integrity checking).

See #1688 for the full history.
2017-05-12 21:38:31 +02:00
Marian Beermann
a16d81271a key: add round-trip test 2017-05-12 20:49:17 +02:00
Marian Beermann
848df38d08 Rename Key.passphrase_protected -> logically_encrypted & document 2017-05-12 20:36:23 +02:00
Marian Beermann
cad49b844e key: authenticated mode = not passphrase protected 2017-05-12 20:35:18 +02:00
enkore
9e6b8f67b9 serve: ignore --append-only when creating a repository (#2501) 2017-05-12 20:34:45 +02:00
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