Commit graph

276 commits

Author SHA1 Message Date
Thomas Waldmann
d3000a7e5d LZ4: dynamically enlarge the (de)compression buffer, fixes #1453
the statically allocated COMPR_BUFFER was right size for chunks,
but not for the archive item which could get larger if you have
many millions of files/dirs.
2016-08-09 02:52:21 +02:00
Thomas Waldmann
64dcbbfdd0 change RPC API, fix remote repo tests 2016-08-05 19:11:16 +02:00
Thomas Waldmann
1e739fd52d fix local repo / upgrader tests 2016-08-05 19:06:38 +02:00
Thomas Waldmann
d3d51e12ea rename UpgradableLock to Lock
lock upgrading is troublesome / may deadlock, do not advertise it.
2016-08-05 19:06:09 +02:00
Thomas Waldmann
26007c0162 add Lock.got_exclusive_lock 2016-08-05 18:52:20 +02:00
TW
976925c625 Merge pull request #1436 from ThomasWaldmann/fix-fuse-tests
fix fuse tests on OS X, fixes #1433
2016-08-05 15:08:16 +02:00
Thomas Waldmann
4fa420ef29 borg debug-dump-repo-objs
dump all objects stored in the repository (decrypted and decompressed)
2016-08-05 13:48:48 +02:00
Thomas Waldmann
40163c2e9f fix fuse tests on OS X, fixes #1433
NOATIME support needed checking and the flagfile was UF_NODUMP and thus not there in the backup archive.

Note: i have just duplicated the has_noatime function instead of refactoring it to be global,
to avoid merge conflicts in case we cherry-pick the test improvements from master.
2016-08-04 01:32:01 +02:00
Marian Beermann
4891d33e2a test_atime: detect O_NOATIME support by checking atime and flags 2016-07-12 16:45:20 +02:00
Marian Beermann
c07d91e9ca test_atime: exclude GNU Hurd from this test
It has O_NOATIME, opening doesn't fail with EPERM, but it still updates
the atime of the file.
2016-07-12 14:42:00 +02:00
Marian Beermann
0e0f487b95 test_atime: try to open with O_NOATIME to determine support 2016-07-12 13:17:54 +02:00
Thomas Waldmann
0fb6cb8417 more compatible sparse file testing, fixes #1310
removed the pointless platform check.

just first test the input file with the same checks we expect succeeding
on the extracted file. skip sparse archiving / extraction testing if the input
file checks fail - likely we have a problem with the OS or the FS then.
2016-07-11 20:48:13 +02:00
TW
e50c78988e Merge pull request #1304 from ThomasWaldmann/binary-test-issue-rmtreefail
binary test issues
2016-07-10 17:51:28 +02:00
enkore
2639b5d0ff Merge pull request #1303 from enkore/issue/1302
fuse: EIO on damaged files unless told not to (-o allow_damaged_files)
2016-07-10 17:43:54 +02:00
Marian Beermann
1c7bdcdf9c test_fuse_allow_damaged_files: assert exact error code 2016-07-10 17:25:38 +02:00
Marian Beermann
cb4a52eb84
fuse: EIO on damaged files unless told not to (-o allow_damaged_files) 2016-07-10 02:19:30 +02:00
Thomas Waldmann
35c39b5743 skip 2 usually failing tests for the binary, see #862
likely related to the subprocess being created for the binary and fakeroot.
2016-07-10 00:17:12 +02:00
Thomas Waldmann
984bb0a5cd use ignore_errors=True workaround for test teardown cleanup, see #862 2016-07-09 23:57:37 +02:00
Thomas Waldmann
0668cdf786 add test for healing 2016-07-09 20:45:26 +02:00
Thomas Waldmann
edb70513eb add more FUSE tests, fixes #1284 2016-07-08 21:54:25 +02:00
Thomas Waldmann
846febb079 merge both fuse mounting tests 2016-07-08 20:06:28 +02:00
Thomas Waldmann
41348a76ef deduplicate fuse (u)mount code 2016-07-08 19:46:03 +02:00
TW
7987434a3f Merge pull request #1266 from ThomasWaldmann/fix-chown-cygwin
catch "invalid argument" on cygwin, fixes #257
2016-07-05 17:33:56 +02:00
Thomas Waldmann
72a7c0bae5 catch "invalid argument" on cygwin, fixes #257
obviously cygwin (windows) does not like the made-up uid 100 gid 200
and raises "invalid argument" OSError.
2016-07-05 17:20:23 +02:00
Thomas Waldmann
498d4b141e sparse test: fix sparseness assertion in test prep, fixes #1264
use the same condition for the input file as also later for the extracted file.

the test preparation sparseness assertion failed on cygwin / ntfs, because the
input file uses ~40MB in blocks vs. total_len ~80MB.
2016-07-05 16:49:50 +02:00
TW
eea46928ff Merge pull request #1234 from enkore/issue/1231
Implement fail-safe error handling for borg-extract
2016-07-04 04:40:27 +02:00
Marian Beermann
7db952ab7f fixup rename 2016-07-03 23:57:55 +02:00
Marian Beermann
5e260fdfda Rename input_io*() -> backup_io*() 2016-07-01 00:13:53 +02:00
Lee Bousfield
c515d6018d
Add --append-only to borg serve
Fixes #1168
2016-06-30 17:58:36 -04:00
Marian Beermann
431441f0d6 input_io_* tests 2016-06-27 22:00:24 +02:00
enkore
13b6f173ed Merge pull request #1193 from ThomasWaldmann/openssl-1.0-1.1-compat
OpenSSL 1.0 and 1.1 compatibility
2016-06-24 17:20:07 +02:00
enkore
5b34483310 Merge pull request #1194 from ThomasWaldmann/more-placeholders
add placeholder support at missing places, add missing help
2016-06-23 17:38:04 +02:00
Thomas Waldmann
b072e99394 fix invalid placeholder in unit test 2016-06-21 23:14:44 +02:00
Thomas Waldmann
ad1729401f improve exception handling for placeholder replacement
do not ignore bad placeholders and just return empty string,
this could have bad consequences, e.g. with --prefix '{invalidplaceholder}':
a typo in the placeholder name would cause the prefix to be the empty string.
2016-06-21 22:58:56 +02:00
Thomas Waldmann
52007dbd43 add tests for format_line 2016-06-21 22:02:13 +02:00
Thomas Waldmann
b5362fa5c8 make borg build/work on OpenSSL 1.0 and 1.1, fixes #1187
in openssl 1.1, the cipher context is opaque, members can not
be accessed directly. we only used this for ctx.iv to determine
the current IV (counter value).

now, we just remember the original IV, count the AES blocks we
process and then compute iv = iv_orig + blocks.

that way, it works on OpenSSL 1.0.x and >= 1.1 in the same way.
2016-06-21 20:20:48 +02:00
Thomas Waldmann
9be32e97b1 fix sparse file test, fixes #1170
found out that xfs is doing stuff behind the scenes: it is pre-allocating 16MB
to prevent fragmentation (in my case, value depends on misc factors).

fixed the test so it just checks that the extracted sparse file uses less (not
necessary much less) space than a non-sparse file would use.

another problem showed up when i tried to verify the holes in the sparse file
via SEEK_HOLE, SEEK_DATA:
after the few bytes of real data in the file, there was another 16MB
preallocated space.
So I ended up checking just the hole at the start of the file.

tested on: ext4, xfs, zfs, btrfs
2016-06-15 12:22:29 +02:00
Thomas Waldmann
866417853d rename valid_msgpacked_item to valid_msgpacked_dict
the code is generic, it can also be used for other msgpacked dictionaries.
2016-06-12 15:31:31 +02:00
Thomas Waldmann
78121a8d04 store item_keys into manifest, fixes #1147
we need a list of valid item metadata keys. using a list stored in the repo manifest
is more future-proof than the hardcoded ITEM_KEYS in the source code.

keys that are in union(item_keys_from_repo, item_keys_from_source) are considered valid.
2016-06-12 00:11:10 +02:00
Thomas Waldmann
918e0b2a52 fix resync and msgpacked item qualifier, fixes #1135
when trying to resync and skip invalid data, borg tries to qualify a byte sequence as
valid-looking msgpacked item metadata dict (or not) before even invoking msgpack's unpack.

besides previously hard to understand code, there were 2 issues:

- a missing check for map16 - this type is what msgpack uses if the dict has more than
15 items (could happen in future, not for 1.0.x).

- missing checks for str8/16/32 - str16 is what msgpack uses if the bytestring has more than 31 bytes
(borg does not have that long key names, thus this wasn't causing any harm)

this misqualification (valid data considered invalid) could lead to a wrong resync, skipping valid items.

added more comments and tests.
2016-06-09 22:08:06 +02:00
Marian Beermann
714e93bf64
Repository: fix commit tags being seen in data 2016-05-19 01:12:06 +02:00
Thomas Waldmann
b743fd09ab borg prune: ignore checkpoints, fixes #997
also:
- add a test for this
- add some words to borg create help about the archive name
2016-05-02 01:12:15 +02:00
Marian Beermann
39a40cd7b7
Fix capabilities extraction on Linux
They are extracted correctly, for a little while at least, since chown()
*resets* all capabilities on the chowned file. Which I find curious,
since chown() is a privileged syscall. Probably a safeguard for
sysadmins who are unaware of capabilities.

The solution is to set the xattrs last, after chown()ing files.
2016-04-16 23:52:27 +02:00
Marian Beermann
29ebdbadae
refcounting: use uint32_t, protect against overflows, fix merging for BE 2016-04-14 23:38:56 +02:00
Marian Beermann
c90745cdbb Port hashindex_summarize into ChunkIndex.summarize 2016-04-14 11:46:12 +02:00
Marian Beermann
b59f92a533 Test suite: Reset exit code of persistent archiver
#844
2016-04-06 10:04:35 +02:00
TW
fc10ac0ef9 Merge pull request #830 from enkore/feature/1.0ctxmng
Make Repository a context manager, use decorators for wrapping withs
2016-04-03 17:36:38 +02:00
Marian Beermann
83586ae09c Make Repository a context manager, use decorators for wrapping withs
(Remote)Repository.close() is not a public API anymore, but a private
API. It shall not be used from within other classes than Repository
or it's tests. The proper way is to use a context manager now. However,
for RPC/Remote compatibility with Borg 1.0 it is kept and unchanged.

Repositories are not opened by __init__ now anymore, it is done
by binding it to a context manager. (This SHOULD be compatible both ways
with remote, since opening the repo is handled by a RepositoryServer method)

Decorators @with_repository() and @with_archive simplify
context manager handling and remove unnecessary indentation.

Backported to 1.0-maint
2016-04-03 17:14:43 +02:00
TW
ad57178ad7 Merge pull request #819 from enkore/fix/chunker-io2
Chunker: fix wrong EOF assumption, check for return type
2016-03-31 23:45:47 +02:00
Marian Beermann
061bf59d5d Chunker: fix wrong EOF assumption[1], check for return type[2]
[1]
This worked incidentally because OSes tend to return at least one page
worth of data when EOF is not reached. Increasing WINDOW_SIZE beyond
the page size might have lead to data loss.

[2]
If read() of the passed Python object returned something not-bytes,
PyBytes_Size returns -1 (ssize_t) which becomes a very larger number for
memcpy()s size_t.
2016-03-31 22:03:17 +02:00