Commit graph

813 commits

Author SHA1 Message Date
Thomas Waldmann
dde18d6a76 security fix: --restrict-to-path must not accept pathes with same name prefix
bug: --restrict-to-path /foo  erroneously allowed  /foobar.
even worse: --restrict-to-path /foo/  erroneously allowed  /foobar.
2016-08-18 22:40:50 +02:00
Thomas Waldmann
28cbf24815 more tests for --restrict-to-path
especially test that other directory names sharing same name prefix are not allowed.
2016-08-18 22:40:50 +02:00
enkore
b124ec648a Merge pull request #1492 from enkore/c/textshell/leaky-preload
(cherry pick) Fix leak in borg-extract --strip-components
2016-08-18 21:59:44 +02:00
Marian Beermann
b46713224b Document DownloadPipeline.unpack_many precautions 2016-08-18 16:23:36 +02:00
TW
feb14de813 Merge pull request #1497 from enkore/issue/1490-2
Fix cosmetics + file leftover for "not a valid borg repository"
2016-08-18 15:27:14 +02:00
Marian Beermann
ef13d392c7 Cache: release lock if cache is invalid 2016-08-18 12:26:14 +02:00
Marian Beermann
928f6e0ca4 repository: fix spurious, empty lock.roster on InvalidRepository exception 2016-08-18 00:54:12 +02:00
Marian Beermann
adaeb32cd4 Repository: fix repo not closed cleanly on InvalidRepository exception 2016-08-18 00:54:10 +02:00
Marian Beermann
8268e26c6b extract: refactor filter building 2016-08-17 22:36:25 +02:00
Martin Hostettler
724586e965 Add test for preloading releated leaks on extract with --strip-components 2016-08-17 01:35:43 +02:00
Martin Hostettler
c84ad6b7b1 Archiver.do_extract: Fix leak of downloaded chunk contents caused by preloading
Include condition that path is non empty after applying strip_components into
filter passed to iter_items.

All filtering of files to extract must be done in the filter callable used in
archive.iter_items because iter_items will preload all chunks used in items
it returns. If they are not actually extracted the accumulate in the
responsed dict.
2016-08-17 01:35:35 +02:00
enkore
35a0ab2183 Merge pull request #1481 from ThomasWaldmann/debug-info
implement borg debug-info, fixes #1122
2016-08-16 01:21:19 +02:00
Thomas Waldmann
2a434c3928 skip the O_NOATIME test on GNU Hurd, fixes #1315
GNU Hurd needs to fix their O_NOATIME, after that we can
re-enable the test on that platform.
2016-08-15 22:49:38 +02:00
Thomas Waldmann
e50646a07b implement borg debug-info, fixes #1122
In tracebacks we have it already, but with the command,
you can have it without a traceback also.
2016-08-15 19:20:51 +02:00
TW
a12672530c Merge pull request #1448 from enkore/issue/1442
Fix untracked segments made by moved DELETEs
2016-08-13 02:13:27 +02:00
Marian Beermann
3b716f98ff Add regression test for 95cf337 2016-08-13 01:47:51 +02:00
Marian Beermann
95cf337fa5 Fix untracked segments made by moved DELETEs
Fixes #1442

(note that the segments _still_ get generated, see the comment, they
 should be collected now on the next compaction run)
2016-08-13 01:46:37 +02:00
Thomas Waldmann
e1bc7b62f6 lz4: reuse helpers.Buffer 2016-08-13 01:46:15 +02:00
Thomas Waldmann
ef9e8a584b refactor buffer code into helpers.Buffer class, add tests 2016-08-13 01:45:23 +02:00
TW
4e5b80bbd5 Merge pull request #1464 from ThomasWaldmann/fix-xattr-exception
xattr: dynamically grow result buffer until it fits, fixes #1462
2016-08-12 18:21:59 +02:00
Thomas Waldmann
8630ebf3f0 xattr: fix module docstring 2016-08-12 16:56:19 +02:00
Thomas Waldmann
b6ead3dce2 xattr: use some string processing functions, dedup, simplify 2016-08-12 16:56:19 +02:00
Thomas Waldmann
7ea052a5e8 xattr: buffer full check for freebsd
freebsd 10.2:

it does not give rc < 0 and errno == ERANGE if the buffer was too small,
like linux or mac OS X does.

rv == buffer len might be a signal of truncation.
rv > buffer len would be even worse

not sure if some implementation returns the total length of the data,
not just the amount put into the buffer.

but as we use the returned length to "truncate" the buffer, we better
make sure it is not longer than the buffer.

also: freebsd listxattr memoryview len bugfix
2016-08-12 16:56:19 +02:00
Thomas Waldmann
4eac66fe2a xattr: fix race condition in get_all(), see issue #906 2016-08-12 16:56:19 +02:00
Thomas Waldmann
418794f66f xattr: errno ERANGE has different meanings 2016-08-12 16:56:19 +02:00
Thomas Waldmann
09dbec99a0 raise OSError including the error message derived from errno
also: deal with path being a integer FD
2016-08-12 16:56:19 +02:00
Thomas Waldmann
67c6c1898c xattr: refactor code, deduplicate
this code would be otherwise duplicated 3 times for linux, freebsd, darwin.
2016-08-12 16:56:19 +02:00
Thomas Waldmann
17c77a5dc5 xattr: dynamically grow result buffer until it fits, fixes #1462
this also fixes the race condition seen in #1462 because there is only 1 call now.
either it succeeds, then we get the correct length as result and truncate the result value to that length.
or it fails with ERANGE, then we grow the buffer to double size and repeat.
or it fails with some other error, then we throw OSError.
2016-08-12 16:56:19 +02:00
enkore
6bf48bbf67 Merge pull request #1457 from ThomasWaldmann/explain-compat-typeerror
explain the confusing TypeError, fixes #1456
2016-08-12 15:16:36 +02:00
Marian Beermann
c61a9e8aa0 Print active env var override by default
Fixes #1467
2016-08-12 13:00:53 +02:00
enkore
a951d23d27 Merge pull request #1460 from ThomasWaldmann/fix-init
add transaction_id assertion
2016-08-10 14:29:46 +02:00
Thomas Waldmann
7b5772df2d add transaction_id assertion
an acd_cli (amazon cloud drive fuse filesystem) user had "borg init" crash in the line below.

by adding the assertion we tell that we do not expect the transaction_id to be None there,
so it is easier to differentiate from a random coding error.
2016-08-10 13:56:06 +02:00
Thomas Waldmann
2624d6f818 larger item metadata stream chunks, fixes #1452
increasing the mask (target chunk size) from 14 (16kiB) to 17 (128kiB).
this should reduce the amount of item metadata chunks an archive has to reference to 1/8.
this does not completely fix #1452, but at least enables a 8x larger item metadata stream.
2016-08-09 20:30:50 +02:00
TW
316c0cd6f0 Merge pull request #1455 from ThomasWaldmann/fix-compr-buffer-size
LZ4: dynamically enlarge the (de)compression buffer, fixes #1453
2016-08-09 18:36:55 +02:00
Thomas Waldmann
20392f8dd9 repo: split size check into too small and too big
also add a hint if somebody needs to restore an archive that has too big objects.
2016-08-09 18:05:22 +02:00
Thomas Waldmann
a360307938 repo: do not put objects that we won't get, fixes #1451
we will not get() objects that have a segment entry larger than MAX_OBJECT_SIZE.
thus we should never produce such entries.

also: introduce repository.MAX_DATA_SIZE that gives the max payload size.
2016-08-09 18:05:22 +02:00
Thomas Waldmann
fc92822b6c explain the confusing TypeError, fixes #1456 2016-08-09 17:35:27 +02:00
Thomas Waldmann
b0e7bb5ddc fixup: use thread-local buffer
start with 0 bytes length (saves memory in case lz4 is not used).
always grow when a bigger buffer is needed.
avoid per-call reallocation / freeing / garbage.
2016-08-09 17:05:24 +02:00
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
33e3348208 locking: better differentiate new vs. old clients, lock upgrade for replay
old clients use self.exclusive = None and do a read->write lock upgrade when needed.
new clients use self.exclusive = True/False and never upgrade.

replay fakes an old client by setting self.exclusive = None to get a lock upgrade if needed.
2016-08-05 19:11:16 +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
2a355e547e make sure we have a excl. lock when starting a transaction
if we don't, we try to upgrade the lock.
this is to support old clients talking to a new server and also
to avoid bad consequences from coding mistakes for new clients.
2016-08-05 18:55:32 +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
TW
109c095c42 Merge pull request #1435 from ThomasWaldmann/fix-1430
fix unintended file cache eviction, fixes #1430
2016-08-05 14:19:56 +02:00
Thomas Waldmann
b96bc155ac fix unintended file cache eviction, fixes #1430
thanks much to e477 for diagnosing this and finding the right fix.
2016-08-05 13:59:21 +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