Commit graph

92 commits

Author SHA1 Message Date
Thomas Waldmann
a912c02757 detect inconsistency / corruption / hash collision, closes #170
added a check that compares the size of the new chunk with the stored size of the
already existing chunk in storage that has the same id_hash value.
raise an exception if there is a size mismatch.

this could happen if:

- the stored size is somehow incorrect (corruption or software bug)
- we found a hash collision for the id_hash (for sha256, this is very unlikely)
2015-09-06 01:10:43 +02:00
TW
17c4394896 Merge pull request #161 from RonnyPfannschmidt/setuptools-scm
replace versioneer with setuptools_scm
2015-08-29 16:46:41 +02:00
Thomas Waldmann
31e97d568b remove x bits from repository.py 2015-08-29 12:52:18 +02:00
Thomas Waldmann
d779057b79 fix issue with negative "all archives" size, fixes #165
This fixes a infrequent problem when (refcount * chunksize) overflowed a int32_t.
chunksize is always <= 8MiB and usually rather ~64KiB (with default chunker params).
Thus, this happened only for high refcounts and/or unusually big chunks.
2015-08-29 04:46:13 +02:00
Thomas Waldmann
c823554b6b docs: usage: improved formatting, cosmetic changes 2015-08-29 04:00:22 +02:00
Thomas Waldmann
9ebc53ad77 restore_xattrs: ignore if setxattr fails with EACCES, fixes #162
e.g.:
- setting any security.* key is expected to fail with EACCES if one is not root.
- issue #162 on our issue tracker: user was root, but due to some specific scenario
  involving docker and selinux, setting security.selinux key fails even when running as root

not sure if it is the best solution to silently ignore this, but some lines below this change
failure to do a chown is also silently ignored (happens e.g. when restoring a file not owned
by the current user as a non-root user).
2015-08-29 00:11:04 +02:00
Thomas Waldmann
ea8f3bd7e7 restore_xattrs: minor cleanup / simplification
if we use {} as default for item.get(), we do not need the "if" as iteration over an empty dict won't do anything.
also fixes too deep indentation the original code had.
2015-08-28 23:22:26 +02:00
Ronny Pfannschmidt
8b6ca0d912 propperly handle borg._version using setuptools_scm 2015-08-22 15:54:40 +02:00
Thomas Waldmann
0a2bd8dad5 lock roster: catch file not found in remove() method and ignore it 2015-08-20 18:40:24 +02:00
Thomas Waldmann
d3d78f7ae3 call fadvise DONTNEED for the byterange we actually have read, fixes #158
avoid throwing away potential readahead data the OS might have read into the cache.
2015-08-20 05:33:51 +02:00
Thomas Waldmann
93a89d97fa ChunkerParams: fix parameter order
the parser for the --chunker-params argument had a wrong parameter order.
fixed the order so it conforms to the help text and the docs.
also added some tests for it and a text for the ValueError exception.
2015-08-17 11:50:47 +02:00
Thomas Waldmann
b180158876 generalize hashindex code for any key length
currently, we only use sha256 hashes as key, so key length is always 32.
but instead of hardcoding 32 everywhere, using key_length is just better
readable and also more flexible for the future.
2015-08-16 14:51:15 +02:00
Thomas Waldmann
608c0935e0 borg list --short, remove requirement for fakeroot, xfail a test
borg list --short just spills out the list of files / dirs - better for some tests
and also useful on the commandline for interactive use.

the tests previously needed fakeroot because in the test setup it always
made calls to mknod and chown, which require (fake)root.
now, the tests adapt to whether it detects (fake)root or not - to run the
the tests completely, you still need fakeroot, but it won't fail all the archiver
tests just due to failing test setup.

also, a test not working correctly due to fakeroot was found:
it should detect whether a read-only repo is usable, but it failed to do that
because with (fake)root, there is no "read only" (at least not via taking away
 the w permission bits).
2015-08-15 20:52:14 +02:00
Thomas Waldmann
738ed5d91b 2 small archiver testsuite fixes
environment context manager: if a env var was not present before, it should not be present afterwards

teardown: cd out of the tmpdir before deleting it
2015-08-15 17:07:09 +02:00
Thomas Waldmann
e5b647fbd1 minor lrucache test fix 2015-08-15 16:15:10 +02:00
Thomas Waldmann
986b70c189 Merge branch 'lrucache' of https://github.com/sourcejedi/borg 2015-08-15 16:06:09 +02:00
Thomas Waldmann
bf757738f7 Merge branch 'master' into compression 2015-08-14 23:24:04 +02:00
Thomas Waldmann
a6b6712d6a deprecate the numeric --compression argument, rename null compression to none, update CHANGES 2015-08-14 23:00:04 +02:00
Alan Jenkins
02b3fbb401 lrucache: change test case to py.test
I re-wrote lrucache (and it seems like no-one had looked at it much
before :).  I was told my test function would have been simpler in
native py.test, so let's have a go converting it all.

We can avoid any reference to unittest, because lrucache doesn't write
files so it doesn't need any of our custom assertion helpers.
2015-08-14 14:51:10 +01:00
Alan Jenkins
0ee78240ee lrucache: test added code
Tests saved my butt, so I'd better contribute :).

These tests have been tested - substituting a null dispose function
causes an immediate failure.
2015-08-14 12:03:23 +01:00
Alan Jenkins
5e0013c5db Merge branch 'master' into lrucache 2015-08-14 10:59:21 +01:00
Thomas Waldmann
3100fac361 fix archiver test to not expect backup of the UF_NODUMP file, try 2 2015-08-12 17:03:30 +02:00
Thomas Waldmann
0481424128 fix archiver test to not expect backup of the UF_NODUMP file 2015-08-12 16:41:30 +02:00
Thomas Waldmann
b512827b07 Merge branch 'honor_nodump' of https://github.com/jeffrizzo/attic 2015-08-12 15:57:54 +02:00
Thomas Waldmann
02ccf37766 Merge branch 'minor' of https://github.com/sourcejedi/attic 2015-08-12 15:16:44 +02:00
Thomas Waldmann
8300efb1db remote: pragma: no cover for the stuff we can't test 2015-08-12 04:28:31 +02:00
Thomas Waldmann
4d8949e66a archiver: more tests 2015-08-12 04:09:36 +02:00
Thomas Waldmann
b16dc03e36 tests for CompressionSpec 2015-08-12 02:27:41 +02:00
Thomas Waldmann
e06b0b3612 use C99's uintmax_t and %ju format
whatever size_t and off_t is, should even fit in there
2015-08-12 01:04:03 +02:00
Thomas Waldmann
8af3aa3397 merged master 2015-08-09 23:51:46 +02:00
Thomas Waldmann
69456e07c4 cache sync: change progress output to separate lines
printing without \n plus sys.stdout.flush() didn't work as expected.
2015-08-09 19:02:35 +02:00
Thomas Waldmann
197ca9c0d3 C merge code: cast to correct pointer type, silences warning 2015-08-09 16:19:53 +02:00
Thomas Waldmann
955ac9c44c get rid of testsuite.mock, directly import from mock
this was left over from times when we either used mock from stdlib
or pypi mock. but as we only use pypi mock now, the indirection is
not needed any more.
2015-08-09 14:26:54 +02:00
Thomas Waldmann
74e5860508 document that passphrase(-only) mode is deprecated 2015-08-09 13:47:36 +02:00
Thomas Waldmann
e74c87d5b5 update borg check help 2015-08-09 12:52:39 +02:00
Thomas Waldmann
80ee8b98af fix the repair mode
if one used --last (or since shortly: gave an archive name), verify_chunks (old method name) was
not called because it requires all archives having been checked.

the problem was that also the final manifest.write() and repository.commit() was done in that method,
so all other repair work did not get committed in that case.

I moved these calls that to a separate finish() method.
2015-08-09 12:43:57 +02:00
Thomas Waldmann
4f6c43baec document what borg check does, fixes #138 2015-08-09 01:15:05 +02:00
Thomas Waldmann
03f39c2663 borg check: give a named single archive to it, fixes #139 2015-08-09 01:14:53 +02:00
Thomas Waldmann
35b0f38f5c cache sync: show progress indication
sync can take quite long, so show what we are doing.
2015-08-09 01:14:37 +02:00
Thomas Waldmann
cce0d20dad test whether borg extract can process unusual filenames 2015-08-09 01:14:37 +02:00
Thomas Waldmann
616d16a9b0 add help string for --no-files-cache, fixes #140 2015-08-08 20:50:21 +02:00
Thomas Waldmann
40801d74a6 remove old unittest discover / runner code, we use py.test now 2015-08-08 19:03:37 +02:00
Thomas Waldmann
a1e039ba21 reimplement the chunk index merging in C
the python code could take a rather long time and likely most of it was converting stuff from python to C and back.
2015-08-06 23:32:53 +02:00
Thomas Waldmann
5b441f7801 some small Cython code improvements, thanks to Stefan Behnel 2015-08-04 13:30:35 +02:00
Thomas Waldmann
175a6d7b04 simplify umask code
in a similar way as the remote_path code was implemented:
just patch the RemoteRepository class object
2015-08-04 12:31:06 +02:00
Thomas Waldmann
71646249cb implement --remote-path to allow non-default-path borg locations 2015-08-04 09:53:26 +02:00
Thomas Waldmann
9f1d92c993 implement --umask M
affects local and remote umask, secure by default M == 077
2015-08-03 23:48:56 +02:00
Thomas Waldmann
4c0012bddf add lzma compression
needs python 3.3+, on 3.2 it won't be available.
2015-08-03 00:31:33 +02:00
Thomas Waldmann
8997766202 integrate compress code, new compression spec parser for commandline
New null and lz4 compression.
Giving -C 0 now uses null compression, not zlib level 0 any more
(null has almost zero overhead while zlib-level0 still had to package everything into zlib frames).
Giving -C 10 uses new lz4 compression, super fast compression and even faster decompression.
See borg create --help (and --compression argument).

fix some issues, clean up, optimize:
CNULL: always return bytes
LZ4: deal with getting memoryviews
Compressor: give bytes to detect(), avoid memoryviews
for lz4, always use same COMPR_BUFFER, avoid memory management costs.
check --chunker-params CHUNK_MAX_EXP upper limit
2015-08-02 18:10:30 +02:00
Thomas Waldmann
746984c33b compress: add tests, zlib and null compression, ID header and autodetection 2015-08-02 01:21:41 +02:00