1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2025-02-22 14:11:27 +00:00
Commit graph

115 commits

Author SHA1 Message Date
Thomas Waldmann
26bde96a3a Merge branch 'master' into faster-cache-sync 2015-09-10 23:12:55 +02:00
Thomas Waldmann
1eecb020e8 cython code: add some int types to get rid of unspecific python add / subtract operations
they somehow pull in some floating point error code that led to a undefined
symbol FPE_... when using the borgbackup wheel on some non-ubuntu/debian linux
platform.
2015-09-10 23:12:12 +02:00
Ed Blackman
13ddfdf4a3 Move pattern normalization decision into decorator
Using a decorator moves the duplicate code in the init methods into a
single decorator method, while still retaining the same runtime overhead
(zero for for the non-OSX path, one extra function call plus the call to
unicodedata.normalize for OSX).  The pattern classes are much visually
cleaner, and duplicate code limited to two lines normalizing the pattern
on OSX.

Because the decoration happens at class init time (vs instance init time
for the previous approach), the OSX and non-OSX test cases can no longer
be called in the same run, so I also removed the OSX test case monkey
patching and uncommented the platform skipif decorator.
2015-09-09 15:00:58 -04:00
Ed Blackman
cc13f3db97 Express non-ascii pattern platform skips better
including correcting thinko in the commented-out OSX-only test
2015-09-09 13:48:46 -04:00
Ed Blackman
d510ff7c63 Merge non-ascii Include and ExcludePattern tests
to parallel the OSX non-ascii tests
2015-09-09 13:41:34 -04:00
Ed Blackman
d9fb1d2b03 Normalize paths before pattern matching on OS X
The OS X file system HFS+ stores path names as Unicode, and converts
them to a variant of Unicode NFD for storage.  Because path names will
always be in this canonical form, it's not friendly to require users to
match this form exactly.  Convert paths from the repository and patterns
from the command line to NFD before comparing them.

Unix (and Windows, I think) file systems don't convert path names into a
canonical form, so users will continue to have to exactly match the path
name they want, because there could be two paths with the same character
visually that are actually composed of different byte sequences.
2015-09-08 23:33:34 -04:00
Thomas Waldmann
1aacdda4a4 implement borg create --dry-run, attic issue #267
also: fix verbose mode display of stdin backup
2015-09-08 03:12:45 +02:00
Thomas Waldmann
13f20647dc use absolute path, attic issue #200, attic issue #137
the daemonize code changes the cwd, thus a relative repo path can't work.

borg mount repo mnt  # did not work
borg mount --foreground repo mnt  # did work
borg mount /abs/path/repo mnt  # did work
2015-09-06 23:26:47 +02:00
Thomas Waldmann
e244fe2f69 change 2 more chunker vars to off_t
so they get 64bit on 32bit platforms.
2015-09-06 22:06:52 +02:00
Thomas Waldmann
32e276c526 Merge branch 'chunker_small_fixes' of https://github.com/sourcejedi/borg into chunker_small_fixes 2015-09-06 22:03:42 +02:00
TW
947fc095d8 Merge pull request #183 from ThomasWaldmann/borg-repo-envvar
BORG_REPO env var support
2015-09-06 21:51:24 +02:00
TW
70d97c4467 Merge pull request #180 from ThomasWaldmann/read-device
read special files as if they were regular files, update docs, closes #79
2015-09-06 21:38:31 +02:00
TW
3ab068b834 Merge pull request #181 from ThomasWaldmann/hash-collision
detect inconsistency / corruption / hash collision, closes #170
2015-09-06 21:35:53 +02:00
Thomas Waldmann
f5069c4e81 fix reaction to "no" answer at delete repo prompt, fixes #182 2015-09-06 21:11:52 +02:00
Thomas Waldmann
817ce18bc6 fix repository arg default 2015-09-06 20:19:28 +02:00
Thomas Waldmann
b3f5231bac BORG_REPO env var support
sets the default repository to use, e.g. like:

export BORG_REPO=/mnt/backup/repo
borg init
borg create ::archive
borg list
borg mount :: /mnt
fusermount -u /mnt
borg delete ::archive
2015-09-06 18:18:24 +02:00
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
Thomas Waldmann
0b1035746e read special files as if they were regular files, update docs, closes #79
do not use the files cache for such special files
2015-09-06 00:29:46 +02:00
Thomas Waldmann
54ccbc5ae2 chunks index resync: do all in one pass
if we do not have a cached archive index: fetch and build and merge it
if we have one: merge it
2015-08-30 15:15:15 +02:00
Thomas Waldmann
22dd925986 chunks index archive: remove all tar and compression related stuff and just use separate files in a directory
the compression was quite cpu intensive and didn't work that great anyway.
now the disk space usage is a bit higher, but it is much faster and less hard on the cpu.

disk space needs grow linearly with the amount and size of the archives, this
is a problem esp. if one has many and/or big archives (but this problem existed
before also because compression was not as effective as I believed).

the tar archive always needed a complete rebuild (and thus: decompression
and recompression) because deleting outdated archive indexes was not
possible in the tar file.

now we just have a directory chunks.archive.d and keep archive index files
there for all archives we already know.
if an archive does not exist any more in the repo, we just delete its index file.
if an archive is unknown still, we fetch the infos and build a new index file.

when merging, we avoid growing the hash table from zero, but just start
with the first archive's index as basis for merging.
2015-08-30 03:03:48 +02:00
Thomas Waldmann
f7210c749f remove cpu intensive compression methods for the chunks.archive
also remove the comment about how good xz compresses - while that was true for smaller index files,
it seems to be less effective with bigger ones. maybe just an issue with compression dict size.
2015-08-29 23:42:28 +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
Alan Jenkins
59a44296e4 chunker - cast from size_t to off_t can now be removed
Sorry, this should really have been part of the previous commit -
it's why I noticed a problem.
2015-08-20 17:48:59 +01:00
Thomas Waldmann
0a2bd8dad5 lock roster: catch file not found in remove() method and ignore it 2015-08-20 18:40:24 +02:00
Alan Jenkins
ce3e67cb96 chunker - fix 4GB files on 32-bit systems
From code inspection - effect not actually tested.
2015-08-20 17:23:50 +01:00
Alan Jenkins
7c6f3ece66 Initialize chunker fd to -1, so it's not equal to STDIN_FILENO (0) 2015-08-20 17:23:41 +01: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