Commit graph

133 commits

Author SHA1 Message Date
Thomas Waldmann
10b8cd9218 use stat with follow_symlinks=False
should be equivalent to using os.lstat() before.

(cherry picked from commit efec00b39c)
2017-06-21 15:16:43 +02:00
Thomas Waldmann
2b3932cac6 require and use chown with follow_symlinks=False
should be equivalent to using os.lchown() before.

(cherry picked from commit 094376a8ad)
2017-06-21 14:58:17 +02:00
Martin Hostettler
8783460fc3 Add minimal version of in repository mandatory feature flags.
This should allow us to make sure older borg versions can be cleanly
prevented from doing operations that are no longer safe because of
repository format evolution. This allows more fine grained control than
just incrementing the manifest version. So for example a change that
still allows new archives to be created but would corrupt the repository
when an old version tries to delete an archive or check the repository
would add the new feature to the check and delete set but leave it out
of the write set.

This is somewhat inspired by ext{2,3,4} which uses sets for
compat (everything except fsck), ro-compat (may only be accessed
read-only by older versions) and features (refuse all access).
2017-06-08 20:36:54 +02:00
enkore
f2b222b2c2 Archive: allocate zeros when needed (#2308)
fixes huge memory usage of mount (8 MiB × number of archives)
(cherry picked from commit 883a7eefb2)
2017-04-03 21:28:23 +02:00
Thomas Waldmann
f1bc2076a7 extract: remove duplicate code
anything at <path> gets nuked already a few lines above, if possible.
2017-04-01 20:14:15 +02:00
Thomas Waldmann
ff4f04e5f1 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.

(cherry picked from commit d4e27e2952)
2017-04-01 20:14:15 +02:00
Thomas Waldmann
07bcd29144 clamp (nano)second values to unproblematic range, fixes #2304
filesystem -> clamp -> archive (create)

(cherry picked from commit b7a17a6db7)
2017-03-16 20:54:33 +01:00
Thomas Waldmann
be1227fd1c borg delete --force --force to delete severely corrupted archives, fixes #1975
(cherry picked from commit 4d81b186ec)
2017-03-10 23:03:25 +01:00
Abdel-Rahman
bfc745237a 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

(cherry picked from commit 63b5cbfc99)
2017-03-10 22:44:27 +01:00
Abogical
d11137dd37 Print a warning for too big extended attributes 2017-03-10 18:57:15 +01:00
Marian Beermann
6e27c8b6cf archive check: detect and fix missing all-zero replacement chunks, fixes #2180
# Conflicts:
#	borg/archive.py
2017-03-10 18:54:01 +01:00
Marian Beermann
29613938d5 borg rpc: use limited msgpack.Unpacker, fixes #2139
we do not trust the remote, so we are careful unpacking its responses.

the remote could return manipulated msgpack data that announces e.g.
a huge array or map or string. the local would then need to allocate huge
amounts of RAM in expectation of that data (no matter whether really
that much is coming or not).

by using limits in the Unpacker, a ValueError will be raised if unexpected
amounts of data shall get unpacked. memory DoS will be avoided.

# Conflicts:
#	borg/archiver.py
#	src/borg/archive.py
#	src/borg/remote.py
#	src/borg/repository.py
2017-03-10 18:49:41 +01:00
Marian Beermann
d350e3a2e1 create: don't create hard link refs to failed files 2017-01-22 02:21:26 +01:00
Marian Beermann
fe6b03a72d check: print non-exit-code warning if --last or --prefix aren't fulfilled 2017-01-12 02:04:44 +01:00
Marian Beermann
be8e0c89b3 check: fail if single archive does not exist 2017-01-04 19:25:03 +01:00
Marian Beermann
f2f50efc28 check: handle duplicate archive items neatly
Signed-off-by: Thomas Waldmann <tw@waldmann-edv.de>
2016-12-17 20:06:41 +01:00
Marian Beermann
28ad779a6f Add tertiary authentication for metadata (TAM)
Signed-off-by: Thomas Waldmann <tw@waldmann-edv.de>
2016-12-17 20:06:41 +01:00
Marian Beermann
baa8baafdb create: fix duration if --timestamp is given 2016-12-17 12:55:16 +01:00
Marian Beermann
f5d6093ccc fix checkpoints when clock jumps 2016-12-17 11:58:26 +01:00
Marian Beermann
a8d921a54c base archive timestamps on end time
The assumption is that if the clock jumps during the Borg run that it
was jump-corrected and is now correct, while the start timestamp would
be wrong.
2016-12-17 11:58:26 +01:00
Marian Beermann
420c984f05 fix wrong duration if clock jumps during create 2016-12-17 11:58:25 +01:00
Marian Beermann
146d586b3b check: skip corrupted chunks during manifest rebuild 2016-11-30 01:43:01 +01:00
Marian Beermann
71775bac97
check: rebuild manifest if it's corrupted 2016-11-30 01:06:23 +01:00
Thomas Waldmann
9451ab6534 implement noatime / noctime, fixes #1853 2016-11-26 21:24:07 +01:00
Marian Beermann
a898297669
check: improve "did not get expected metadata dict" diagnostic 2016-11-13 15:25:40 +01:00
Marian Beermann
639eba1635 Fix check incorrectly reporting attic 0.13 and earlier archives as corrupt 2016-11-13 15:25:10 +01:00
Marian Beermann
2261709e78
check: handle repo w/o objects gracefully
normal check would complete, --repair would crash when trying
to write the rebuilt (empty) manifest out, since self.key was None
2016-11-13 11:45:42 +01:00
Thomas Waldmann
67aafec195 backport bin_to_hex and use it
simplifies code and also porting and merging between 1.0 and 1.1/master.
2016-10-06 05:15:01 +02:00
Thomas Waldmann
34ec344e9d trivial code optimization 2016-09-17 17:19:26 +02:00
enkore
3714be0d79 Merge pull request #1581 from enkore/issue/1580
hashindex: export max load factor to Python-space
2016-09-09 19:31:22 +02:00
Marian Beermann
be3616b6b3 ArchiveChecker: use MAX_LOAD_FACTOR constant 2016-09-09 16:11:06 +02:00
Marian Beermann
f1cf7bc322 process_symlink: fix missing backup_io()
Fixes a chmod/chown/chgrp/unlink/rename/... crash race between getting dirents
and dispatching to process_symlink.
2016-09-08 16:43:48 +02:00
Marian Beermann
b46713224b Document DownloadPipeline.unpack_many precautions 2016-08-18 16:23:36 +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
Thomas Waldmann
97383e9e60 transform unpacker exception only at 1 place 2016-07-28 22:23:38 +02:00
Thomas Waldmann
852c583076 handle unpacker exception with tighter scope 2016-07-28 22:12:34 +02:00
Thomas Waldmann
edea587f35 catch unpacker exceptions, resync, fixes #1351 2016-07-28 22:10:29 +02:00
enkore
73e46358c3 Merge pull request #1300 from ThomasWaldmann/heal-items
heal items
2016-07-10 00:09:42 +02:00
enkore
ad1be9dcd4 Merge pull request #1301 from ThomasWaldmann/warn-extract-damaged
warn if a file with damaged chunks is extracted, fixes #1299
2016-07-09 21:18:10 +02:00
Thomas Waldmann
48f112e885 warn if a file with damaged chunks is extracted, fixes #1299
before 1.0.4/1.0.5 we had no means to tell if a file has been "repaired" with all-zero
chunks, but now we can see it if chunks_healthy key is present.
2016-07-09 18:19:25 +02:00
Thomas Waldmann
85fe7d7f4c heal files if missing chunks re-appear, fixes #148
also: improve logging for archive check
2016-07-09 17:25:25 +02:00
Thomas Waldmann
409ab9f612 fix/optimize initial hash table size for borg check
initial size should be so that the hash table does not need resizing -
it must always stay below the MAX_LOAD_FACTOR.
2016-07-09 14:36:09 +02:00
Thomas Waldmann
b0b2ebb6ed fixup: only create chunks_healthy if we actually replaced chunks 2016-07-06 23:10:04 +02:00
Thomas Waldmann
5105a0a5a6 repair: remember the good chunks
if we do not lose the original chunk ids list when "repairing" a file (replacing missing
chunks with all-zero chunks), we have a chance to heal the file back into its original
state later, in case the chunks re-appear (e.g. in a fresh backup).
2016-07-06 22:42:18 +02:00
Thomas Waldmann
07d0a61e46 forced archive deletion, fixes #1139 2016-07-04 23:13:11 +02:00
Thomas Waldmann
00a5470125 symlink processing for --read-special mode
processing depends on symlink target:
- if target is a special file: process the symlink as a regular file
- if target is anything else: process the symlink as symlink

refactor code a little to avoid duplication.
2016-07-04 14:02:05 +02:00
Thomas Waldmann
5476ece81e fake regular file mode for --read-special mode, fixes #1214 2016-07-04 14:02:05 +02:00
Thomas Waldmann
a3ef692132 reimplement --read-special, fixes #1241 2016-07-04 13:54:31 +02:00
Marian Beermann
93f4b09d41
BackupOSError documentation 2016-07-03 23:58:14 +02:00
Marian Beermann
7db952ab7f fixup rename 2016-07-03 23:57:55 +02:00