Commit graph

572 commits

Author SHA1 Message Date
Thomas Waldmann
4ed71e2cf5 add some error handling/fallback for C library loading, fixes #494 2015-12-27 14:10:41 +01:00
Thomas Waldmann
c9afa2b27b output progress indication from inner loop, fixes #500
- so it shows progress while it backups a bigger file
- so it announces the filename earlier

also: move rate limiting code to show_progress()
2015-12-27 11:06:03 +01:00
Thomas Waldmann
57b913bc88 fix badly named environment variable, fixes #503
added: BORG_DELETE_I_KNOW_WHAT_I_AM_DOING for the check in "borg delete"
2015-12-20 02:03:33 +01:00
Thomas Waldmann
95f6cd4a4e Merge branch 'master' of github.com:borgbackup/borg 2015-12-13 14:26:49 +01:00
Thomas Waldmann
0c166898bf fix python 3.2 str.splitlines() compatibility issue 2015-12-13 00:51:39 +01:00
Thomas Waldmann
aa97724c0c add --prefix to check to check only some specific archives, fixes #206 2015-12-13 00:39:52 +01:00
Thomas Waldmann
942120997e log remote exceptions, add remote sysinfo 2015-12-12 22:45:29 +01:00
Thomas Waldmann
2df0bb1f83 remote stderr: keep line endings as is
so even the \r trick works for overwriting the same line.
2015-12-12 22:15:08 +01:00
Thomas Waldmann
2e2e145372 sane remote logging, remote stderr, fixes #461 2015-12-12 22:15:08 +01:00
Thomas Waldmann
229512b6f5 determine log level from the logger, so it works with logging.conf also 2015-12-12 22:15:08 +01:00
Thomas Waldmann
f59db03c60 ProgressIndicator: flush the output file or it won't work correctly via ssh
likely due to buffering, the progress indication was not visible.
2015-12-12 22:15:08 +01:00
Thomas Waldmann
eab60cce99 pass through some global options from client to server
new: logging level options
refactored:
- umask option and remote_path
- cleanly separated ssh command from borg command
2015-12-12 22:15:08 +01:00
Thomas Waldmann
c194f3ca1c give (all) args to open_repository 2015-12-12 22:15:08 +01:00
Thomas Waldmann
9c271afefa unify repo/archive parameter name to "location" 2015-12-12 22:15:08 +01:00
Thomas Waldmann
e3d5898add borg upgrade - use inplace parameter, fixes #466
i checked it: copying the index.* and hints.* files in advance is not needed, open() and close() do not modify them.

also: fix unicode exception with encoded filename
2015-12-11 22:18:18 +01:00
TW
bbeda1f743 Merge pull request #481 from ThomasWaldmann/fix-progress
remove --progress magic, fixes #476
2015-12-10 13:34:02 +01:00
Thomas Waldmann
60babd14c3 borg upgrade - do not overwrite backup_repo/index.*, fixes #466
the code obviously wrote to both index.* files as they were hardlinked.
now we make a normal copy of index (and also hints) to avoid this.
2015-12-10 11:59:13 +01:00
Thomas Waldmann
cd804e72b7 borg upgrade - move some code to convert_repo_index
it was a bit confusing to have repo-related code in a method called "convert_cache".
also fixed a typo "index index".
2015-12-10 11:35:48 +01:00
Thomas Waldmann
7acda553ff borg upgrade - fix locking
because Repository.__init__ normally opens and locks the repo, and the upgrader just
inherited from (borg) Repository, it created a lock file there before the "backup copy"
was made.

No big problem, but a bit unclean.

Fixed it to not lock at the beginning, then make the copy, then lock.
2015-12-10 11:11:06 +01:00
Thomas Waldmann
e9ab11be49 borg upgrade - fix README contents 2015-12-10 10:51:56 +01:00
Thomas Waldmann
34b35761dd remove --progress magic, fixes #476
For 0.29 we worked towards a "silent by default" behaviour, so interactive usage will include -v more frequently in future.

But I noticed that this conflicts with the progress display. This would be no problem if users willingly decide which one
of --verbose or --progress they want to see, but before this fix, the progress display was activated magically when
a tty was detected. So, to counteract this magic, users would need to use --no-progress.

That's backwards imho, so I removed the magic again and users have to give --progress when they want
to see a progress indicator. Or (alternatively) they give --verbose when they want to see the long file list.
2015-12-10 10:28:43 +01:00
Thomas Waldmann
8671be1ef2 Increase FUSE read_size to 1024.
From https://github.com/borgbackup/borg/pull/480 discussion:

Did you try 1024 (linux cache block size) or 4096 (internal sector size of bigger
hdds, also used in msgpack fallback.py as lower bound, see link)?

I've tested different values - 512 and 1024 are slightly better than 4096 in my case.

read_size = 1    ls -laR: 75.57 sec
read_size = 64   ls -laR: 27.81 sec
read_size = 512          ls -laR: 27.40 sec
read_size = 1024         ls -laR: 27.20 sec
read_size = 4096         ls -laR: 30.15 sec
read_size = 0    ls -laR: 442.96 sec (default)

OK, maybe we should go for 1024 then. That happens to be < MTU size, so in case someone works on NFS
(or other network FS) we will have less reads, less network packets, less latency.
2015-12-10 10:09:06 +01:00
TW
c4588e4eb4 Merge pull request #480 from alex3d/patch-1
Optimized fuse inode cache
2015-12-10 10:05:09 +01:00
alex3d
3256f22c74 Optimized fuse inode cache
Single-shot unpacker read buffer decreased from (default) 1Mb to 512b.
"ls -alR" on ~100k files backup mounted with fuse went from ~7min to 30 seconds.
2015-12-09 00:34:25 +03:00
Thomas Waldmann
499b6f7313 add a test that invokes borg prune --save-space 2015-12-08 18:36:41 +01:00
Thomas Waldmann
0c076ad114 compact_segments: save_space -> free unused segments quickly
as soon as one target segment is full, it is a good time to commit it and remove the source segments
that are already completely unused (because they were transferred int the target segment).

so, for compact_segments(save_space=True), the additional space needed should be about 1 segment size.

note: we can't just do that at the end of one source segment as this might create very small
target segments, which is not wanted.
2015-12-08 18:36:41 +01:00
Thomas Waldmann
b41f6dfbbf Merge branch 'silent' of https://github.com/ThomasWaldmann/borg into ThomasWaldmann-silent 2015-12-08 01:56:44 +01:00
Thomas Waldmann
cb821b119b remove --log-level, add --debug and --info option, update docs
removed --log-level due to overlap with how --verbose works now.

for consistency, added --info as alias to --verbose (as the effect is
setting INFO log level).

also added --debug which sets DEBUG log level.
note: there are no messages emitted at DEBUG level yet.

WARNING is the default (because we want mostly silent behaviour,
except if something serious happens), so we don't need --warning
as an option.
2015-12-08 01:37:34 +01:00
Thomas Waldmann
68225af449 archive checker: remove report_progress, fix log levels 2015-12-08 00:59:41 +01:00
TW
d05b9b8ac9 Merge pull request #473 from ThomasWaldmann/hashindex-add
hashindex_add C implementation
2015-12-07 22:32:55 +01:00
Thomas Waldmann
720fc49498 hashindex_add C implementation
this was also the loop contents of hashindex_merge, but we also need it callable from Cython/Python code.

this saves some cycles, esp. if the key is already present in the index.
2015-12-07 19:13:58 +01:00
Jakob Schnitzer
3ca1d33d5c fix format of umask in help pages
fixes #463
2015-12-07 18:42:50 +01:00
Jakob Schnitzer
17952dff48 helpers: remove functions that are only used once
The read_msgpack and write_msgpack functions were only used in one place
each.  Since msgpack is read and written in lots of places, having
functions with these generic names is confusing. Also, the helpers
module is quite a mess, so reducing its size seems to be a good idea.
2015-12-07 14:29:01 +01:00
Thomas Waldmann
6d083c0695 increase rpc protocol version to 2
this is needed because due to the locking improvements, some rpc calls' signature changed slightly.
2015-12-03 17:50:37 +01:00
TW
f5634092a2 Merge pull request #455 from ThomasWaldmann/add-progress-indication
Add progress indication, fixes #394
2015-12-03 15:04:44 +01:00
Thomas Waldmann
df24ce5acd progress indicators: add tests 2015-12-03 14:45:16 +01:00
Thomas Waldmann
887196b00e progress indicators: better docstring, minor code improvement 2015-12-03 14:14:28 +01:00
TW
9005586ca4 Merge pull request #452 from ThomasWaldmann/hashtable
misc. hash table tuning
2015-12-02 16:45:39 +01:00
Stavros Korokithakis
d572ceaca2 Display proper repo URL. 2015-12-02 16:51:49 +02:00
Thomas Waldmann
21bd01ef16 add a --filter option replacing --changed/--unchanged
the problem here was that we do not just have changed and unchanged items,
but also a lot of items besides regular files which we just back up "as is" without
determining whether they are changed or not. thus, we can't support changed/unchanged
in a way users would expect them to work.

the A/M/U status only applies to the data content of regular files (compared to the index).
for all items, we ALWAYS save the metadata, there is no changed / not changed detection there.

thus, I replaced this with a --filter option where you can just specify which
status chars you want to see listed in the output.

E.g. --filter AM will only show regular files with A(dded) or M(odified) state, but nothing else.
Not giving --filter defaults to showing all items no matter what status they have.

Output is emitted via logger at info level, so it won't show up except if the logger is at that level.
2015-12-02 03:29:20 +01:00
Thomas Waldmann
fe6916bd22 refactor upgrade progress indication code to use ProgressIndicatorPercent 2015-12-02 01:26:26 +01:00
Thomas Waldmann
7a1316cb79 implement ProgressIndicators, use it for repo check and segment replay, fixes #195, fixes #188 2015-12-02 01:06:07 +01:00
Thomas Waldmann
610300c1ce misc. hash table tuning
BUCKET_UPPER_LIMIT: 90% load degrades hash table performance severely,
so I lowered that to 75% (which is a usual value - java uses 75%, python uses 66%).
I chose the higher value of both because we also should not consume too much
memory, considering the RAM usage already is rather high.

MIN_BUCKETS: I can't explain why, but benchmarks showed that choosing 2^N as
table size severely degrades performance (by 3 orders of magnitude!). So a prime
start value improves this a lot, even if we later still use the grow-by-2x algorithm.

hashindex_resize: removed the hashindex_get() call as we already know that the values
come at key + key_size address.

hashindex_init: do not calloc X*Y elements of size 1, but rather X elements of size Y.
Makes the code simpler, not sure if it affects performance.

The tests needed fixing as the resulting hashtable blob is now of course different due
to the above changes, so its sha hash changed.
2015-12-01 21:18:58 +01:00
Antoine Beaupré
b09643e14f change file status test and cleanup last ref to --verbose
this ports the changes here to #445
2015-11-24 12:11:43 -05:00
Antoine Beaupré
1785ca54ba do not display unchanged files by default
add a --unchanged topical file to display those files
2015-11-24 12:07:57 -05:00
Antoine Beaupré
fce5aed5bb move changed with other topical flags
we need to have a sane default there otherwise the option may not be defined in some sub-commands and will crash
2015-11-24 12:07:57 -05:00
Antoine Beaupré
8d3d1c22d6 silence borg by default
this also prints file status on stderr directly, bypassing the logger
as we do with other topical flags (like progress and status)
2015-11-24 12:07:56 -05:00
Antoine Beaupré
9899eaf241 silence file listing unless --changed is present 2015-11-24 12:07:56 -05:00
Antoine Beaupré
6b265f2a53 alias --verbose to --log-level=info
print_verbose is now simply logger.info() and is always displayed if
log level allows it. this affects only the `prune` and `mount`
commands which were the only users of the --verbose option. the
additional display is which archives are kept and pruned and a single
message when the fileystem is mounted.

files iteration in create and extract is now printed through a
separate function which will be later controled through a topical
flag.
2015-11-24 12:07:03 -05:00
Antoine Beaupré
a75d77226b add test for the weird unchanged file status
this tests the behaviour found in #403 and documented in #418, but doesn't fail on the unexpected A
2015-11-23 19:44:54 -05:00
TW
f834e335f9 Merge pull request #437 from anarcat/no-progress
fix --no-progress
2015-11-23 18:48:45 +01:00
anarcat
2ac515a5f7 fix typos 2015-11-23 12:41:20 -05:00
Antoine Beaupré
0196d80b28 fix progress tests on travis
we now check if we really have a terminal before doing the fancy auto-detection testing
2015-11-22 21:24:37 -05:00
TW
04f081fea7 Merge pull request #442 from ThomasWaldmann/fix-compiler-warnings
get rid of C compiler warnings, fixes #391
2015-11-22 14:15:24 +01:00
TW
faacd18244 Merge pull request #443 from ThomasWaldmann/tb-add-sysinfo
include system info below traceback, fixes #324
2015-11-22 14:09:07 +01:00
Thomas Waldmann
adb35ab07f include system info below traceback, fixes #324 2015-11-21 22:51:59 +01:00
Thomas Waldmann
7247043db0 get rid of C compiler warnings, fixes #391 2015-11-21 22:08:30 +01:00
Thomas Waldmann
38994c78fc implement borg break-lock REPO command, fixes #157
due to borg's architecture, breaking the repo lock needs first creating a repository object.
this would usually try to get a lock and then block if there already is one.
thus I added a flag to open without trying to create a lock.
2015-11-21 20:50:53 +01:00
Thomas Waldmann
1093894be8 UpgradableLock: release exclusive lock in case of exceptions
also: add some comments about how to use the locks in the safest way
2015-11-21 16:53:33 +01:00
Thomas Waldmann
f19e95fcf7 implement --lock-wait, support timeout for UpgradableLock, fixes #210
also: simplify exceptions / exception handling
2015-11-21 15:34:51 +01:00
Thomas Waldmann
b3b4db427c rename print_info to print_verbose
better name as it is only outputting if verbose flag is set.
2015-11-21 02:26:50 +01:00
Thomas Waldmann
6abf7621c1 remove rarely used print_status method 2015-11-21 02:22:26 +01:00
Thomas Waldmann
25140e8c82 add --log-level to set the level of the builtin logging configuration, fixes #426 2015-11-21 02:09:16 +01:00
Thomas Waldmann
c4dae52ca4 configure logging via env var, use LazyLogger
logging.raiseExceptions not needed any more for py >= 3.2
2015-11-21 01:14:07 +01:00
Antoine Beaupré
a6f8436ceb move toggle action to beginning of class so it can be reused 2015-11-20 15:03:46 -05:00
Antoine Beaupré
a40729f4f3 --progress option was backwards
adds unit tests and ensures we detect --progress correctly in all cases
2015-11-20 15:03:39 -05:00
TW
a7eb83efa5 Merge pull request #419 from anarcat/no-progress
add a --no-progress flag to forcibly disable progress info
2015-11-20 20:08:39 +01:00
Thomas Waldmann
b1ba7a84f0 --keep-tag-files: fix file status, fix multiple tag files in one directory, fixes #432 2015-11-19 20:03:50 +01:00
Thomas Waldmann
2e64c29e01 use ISO-8601 date and time format, fixes #375 2015-11-16 23:51:21 +01:00
Antoine Beaupré
9b1ca5c1eb force --no to be at the start of option 2015-11-16 15:26:50 -05:00
Antoine Beaupré
5be060d1f1 add a --no-progress flag to forcibly disable progress info
--progress isn't a "toggle" anymore, in that it will never disable progress information: always enable it.

example:

$ borg create ~/test/borg2::test$(date +%s) . ; echo ^shows progress
reading files cache
processing files
^shows progress
$ borg create ~/test/borg2::test$(date +%s) . < /dev/null; echo ^no progress
reading files cache
processing files
^no progress
$ borg create --progress ~/test/borg2::test$(date +%s) . < /dev/null; echo ^progress forced
reading files cache
processing files
^progress forced
$ borg create --no-progress ~/test/borg2::test$(date +%s) . ; echo ^no progress
reading files cache
processing files
^no progress

we introduce a ToggleAction that can be used for other options, but
right now is just slapped in there near the code, which isn't that
elegant. inspired by:

http://stackoverflow.com/questions/11507756/python-argparse-toggle-flags

note that this is supported out of the box by click:
http://click.pocoo.org/5/options/#boolean-flags

fixes #398
2015-11-16 11:27:27 -05:00
Thomas Waldmann
234a88bec6 avoid hidden import, make it easy for pyinstaller
this fixes #218 in an easier way so one doesn't have to type
--hidden-import=logging.config all the time when using pyinstaller.
2015-11-15 15:52:02 +01:00
Thomas Waldmann
d6b8de943b add docs for item flags / status output, fixes #402 2015-11-15 14:32:19 +01:00
Antoine Beaupré
f13dd6e579 completely remove have_cython() hack
this was making us require mock, which is really a test component and
shouldn't be part of the runtime dependencies. furthermore, it was
making the imports and the code more brittle: it may have been
possible that, through an environment variable, backups could be
corrupted because mock libraries would be configured instead of real
once, which is a risk we shouldn't be taking.

finally, this was used only to build docs, which we will build and
commit to git by hand with a fully working borg when relevant.

see #384.
2015-11-13 10:40:53 -05:00
Thomas Waldmann
7d178e09b0 Implement --keep-tag-files to preserve directory roots/tag-files
We also add --keep-tag-files to keep in the archive the root directory and the
tag/exclusion file in the archive.

This is taken from a attic PR (and adapted for borg):
    commit f61e22cacc90e76e6c8f4b23677eee62c09e97ac
    Author: Yuri D'Elia <yuri.delia@eurac.edu>
    Date:   Mon Dec 15 12:27:43 2014 +0100
2015-11-09 04:08:49 +01:00
Thomas Waldmann
a6a8a4ebd9 Implement --exclude-if-present
Add a new --exclude-if-present command-line flag to ``borg create``.  If
specified, directories containing the specified tag file will be excluded from
the backup. The flag can be repeated to ignore more than a single tag file,
irregardless of the contents.

This is taken from a attic PR (and adapted for borg):
    commit 3462a9ca90388dc5d8b4fa4218a32769676b3623
    Author: Yuri D'Elia <yuri.delia@eurac.edu>
    Date:   Sun Dec 7 19:15:17 2014 +0100
2015-11-09 03:41:06 +01:00
Björn Ketelaars
e6911b2f25 Avoid using msgpack.packb at import time.
move item_keys = ... to __init__ (self.item_keys = ...)

Solution from/discussed with TW.
2015-11-08 15:23:09 +01:00
Thomas Waldmann
007572594f try to fix build on readthedocs 2015-11-08 02:00:51 +01:00
Thomas Waldmann
5595d56ecf deal with unicode errors for symlinks in same way as for regular files, fixes #382 2015-11-08 01:05:55 +01:00
Thomas Waldmann
ba67b96434 have a helpful warning message about how to fix wrong locale setup, fixes #382 2015-11-08 00:57:02 +01:00
Thomas Waldmann
244303ac66 add ACL keys the RobustUnpacker must know about 2015-11-07 19:55:17 +01:00
Thomas Waldmann
c9090fc3c2 helper: minor style fix 2015-11-07 15:37:05 +01:00
Thomas Waldmann
8cc726a107 make basic test more robust, try 2
check if we have all expected files in list output (but ignore extra lines,
like "can't load libfakeroot" or so).
2015-11-07 00:30:02 +01:00
Thomas Waldmann
eb3bc1023b make basic test more robust
counting lines is a bad idea. just one unrelated output line and the test fails.
thus we rather check if what we expect is in the output.
2015-11-07 00:11:36 +01:00
TW
1a20d3d5ae Merge pull request #366 from ThomasWaldmann/fix-364
Fix borg check crashing on some repos, issue #364
2015-11-06 21:05:30 +01:00
Thomas Waldmann
c01efa4666 repository: refactor some duplicate code 2015-11-06 19:37:39 +01:00
TW
864fa9ae2d Merge pull request #370 from ThomasWaldmann/debug-helpers
Debug helpers
2015-11-06 18:08:05 +01:00
Thomas Waldmann
37c8aa2d42 debug-get-obj command 2015-11-06 17:45:30 +01:00
Thomas Waldmann
a2fc479da3 debug-put-obj command 2015-11-06 17:31:05 +01:00
Thomas Waldmann
9986705760 add some tests for the debug commands 2015-11-06 16:51:39 +01:00
Thomas Waldmann
7da730a8d7 borg list --prefix=thishostname- REPO, fixes #205
lists only archives with names starting with the given prefix.
2015-11-06 15:45:49 +01:00
Thomas Waldmann
a4bb85970d do not mention the deprecated passphrase mode 2015-11-06 15:01:37 +01:00
Thomas Waldmann
4c6be00d65 remove some superfluous / duplicate log messages 2015-11-06 14:58:12 +01:00
Thomas Waldmann
39b5734b31 debugging helper: borg debug-delete-obj 2015-11-04 01:05:21 +01:00
Thomas Waldmann
47813f6f6a archiver checker: better error logging, give chunk_id and sequence numbers
can be used together with borg debug-dump-archive-items.
2015-11-04 00:20:12 +01:00
Thomas Waldmann
d2b7dbc0a8 debugging helper: borg debug-dump-archive-items 2015-11-03 23:42:58 +01:00
Thomas Waldmann
12b5d07e55 fix RobustUnpacker, it missed some metadata keys. add check for unknown metadata keys.
not just the new atime and ctime keys were missing, but also bsdflags.
2015-11-03 20:21:52 +01:00
Thomas Waldmann
fa35525b58 create from stdin: also save atime, ctime
cosmetic, just for completeness.
2015-11-03 19:52:49 +01:00
Thomas Waldmann
f28d5d1f96 disk full test: some improvements
- can create 0-byte files now
- frees space early (avoids running out of disk space at repo init time)
- creates multiple reserve files, so we do not only reserve some space,
  but also some inodes
 - only print output if there is an error RC
 - if make_files makes us run out of space, that is not interesting, just start
   a new iteration from scratch
2015-11-03 19:39:05 +01:00
Thomas Waldmann
f804c6fb1c repository check code: added some comments 2015-11-03 15:41:02 +01:00
Thomas Waldmann
98f3b8d937 fix "check" for repos that have incomplete chunks, fixes #364
added try/finally (the code in between was just indented, no
other code changes) to make sure it sets self.index back to None,
even if the code crashes e.g. due to an IntegrityError caused
by an incomplete segment caused by a disk full condition.

also, in prepare_txn, create an empty in-memory index if transaction_id
is None, which is required by the Repository.check code to work correctly.
If the index is not empty there, it will miscalculate segment usage
(self.segments).
2015-11-03 15:30:33 +01:00
Thomas Waldmann
22262e3fb7 add a test to find disk-full issues, #327 2015-11-03 00:41:20 +01:00
Thomas Waldmann
6d5cc06cf6 remove unused imports, add missing imports 2015-11-02 20:36:13 +01:00
Thomas Waldmann
36cc377329 use default_notty=False for confirmations, fixes #345
this is so that e.g. cron jobs do not hang indefinitely if yes() is called,
but it will just default to "no" if not tty is connected.

if you need to enforce a "yes" answer (which is not recommended for
the security critical questions), you can use the environment:

BORG_CHECK_I_KNOW_WHAT_I_AM_DOING=Y
2015-11-02 01:59:22 +01:00
Thomas Waldmann
e6231896cd emit a deprecation warning for --compression N
deprecating it in the source is not enough, we also need to tell the users to fix their scripts.
2015-11-02 00:14:01 +01:00
Thomas Waldmann
35280e9a65 label platform code, exclude freebsd and unknown platform from coverage measurement
this coverage configuration is mostly for travis and there we only can test linux and darwin.
2015-11-01 23:06:52 +01:00
Thomas Waldmann
0a6e6cfe2e refactor confirmation code, reduce code duplication, add tests 2015-11-01 19:18:29 +01:00
Thomas Waldmann
36900051c5 move test utilities to testsuite package, add FakeInputs utility 2015-11-01 19:13:45 +01:00
Thomas Waldmann
4a1c995244 add --show-rc option enable "terminating with X status, rc N" output, fixes #351
this is needed for tools like borgweb (or in general: when the rc value / exit status should
be logged for later review or directly seen on screen).

this is off by default, so the output is less verbose (and also does not fail tests which
counts lines).
2015-11-01 00:53:55 +01:00
Thomas Waldmann
4bf8c8a6f8 separate parse_args() from run()
parse_args concentrates on only processing arguments, including pre and post processing.
this needs to be called before run(), which is now receiving the return value of parse_args.

this was done so we can have the parsed args outside of the run function, e.g. in main().
2015-11-01 00:40:32 +01:00
Thomas Waldmann
7ea701f6f7 fix test failure for borg.exe
fatal error is rc 2 now (EXIT_ERROR)
2015-11-01 00:01:23 +01:00
TW
f651b014e6 Merge pull request #350 from ThomasWaldmann/fix-307
prettier connection closed message, fixes #307
2015-10-31 23:19:26 +01:00
TW
5f86959762 Merge pull request #349 from ThomasWaldmann/pretty-errors
prettier error messages, fixes #57
2015-10-31 22:44:04 +01:00
TW
39e4f344bd Merge pull request #348 from ThomasWaldmann/warn-slow-msgpack
emit a warning if we have a slow msgpack installed
2015-10-31 22:43:36 +01:00
Thomas Waldmann
1740384763 prettier connection closed message, fixes #307 2015-10-31 22:41:08 +01:00
Thomas Waldmann
762fdaadd8 prettier error messages, fixes #57
subclasses of "Error": do not show traceback
(this is used when a failure is expected and has rather trivial reasons and usually
does not need debugging)

subclasses of "ErrorWithTraceback": show a traceback
(this is for severe and rather unexpected stuff, like consistency / corruption issues
or stuff that might need debugging)

I reviewed all the Error subclasses whether they fit into the one or other class.

Also: fixed docstring typo, docstring formatting
2015-10-31 22:23:32 +01:00
Thomas Waldmann
3490469734 emit a warning if we have a slow msgpack installed
the reason for a slow msgpack can be:
- pip install: missing compiler (gcc)
- pip install: missing compiler parts (e.g. gcc-c++)
- pip install: cached wheel package that was built while the compiler wasn't present
- distribution package: badly built msgpack package
2015-10-31 20:37:21 +01:00
Thomas Waldmann
ad4594a39c Fix some breakage from the merge 2015-10-31 19:39:20 +01:00
Thomas Waldmann
f4b0f57618 Merge branch 'master' into multithreading
Some tests are failing, some block, one new test needed skipping.
2015-10-31 19:36:33 +01:00
Radek Podgorny
5cc25d986a move away from RawConfigParser to ConfigParser
this is a recommended thing since direct use of RawConfigParser
is not deprecated according to python docs.
2015-10-29 02:37:43 +01:00
Thomas Waldmann
5992d4be58 Merge branch 'review-logging-levels' 2015-10-28 02:02:33 +01:00
Thomas Waldmann
dd577bf4ac fuse mount: fix unlocking of repository at umount time, fixes #331
there were 2 issues:
lock used another pid and tid than release because daemonize() made it different processes/threads.
solved by just determining PID only once and not using TID any more.

the other issue was that the repo needed and explicit closing.
2015-10-27 22:37:36 +01:00
Thomas Waldmann
92d31be087 atime unit test: test adapts to O_NOATIME support on platform 2015-10-26 23:16:41 +01:00
Thomas Waldmann
3e73998710 atime unit test: do not compare input file's current atime
and explain why (missing O_NOATIME open mode modified the atime at backup time).
2015-10-26 23:08:37 +01:00
Thomas Waldmann
765999195d atime unit test: hardcode "round" timestamps
just to avoid rounding / precision issues with floating point computations on py < 3.3
I used 2 hardcoded "full second" values on the input file and check if they get restored
correctly.
2015-10-26 22:34:08 +01:00
Thomas Waldmann
c492011a92 backup atime and ctime additionally to mtime, fixes #317
restore: mtime and atime
FUSE: support ctime and atime additionally to mtime
2015-10-26 02:07:55 +01:00
Thomas Waldmann
0942bc010e fix reading files without touching their atime 2015-10-26 01:43:58 +01:00
Thomas Waldmann
f7d724ce33 tests: only use mtime once in directory comparison tuples 2015-10-26 01:37:28 +01:00
Thomas Waldmann
f285e90912 archiver: add E status as error indication
E means that an error occured when processing this (single) item
2015-10-25 02:53:36 +02:00
Thomas Waldmann
7b73abdcda archiver: rename print_x methods so they correspond to log levels
also:

remove some "Warning: " msg prefixes - if we emit at WARNING level,
it is obviously a warning.

remove some "borg: " msg prefixes.
2015-10-25 02:35:42 +02:00
Thomas Waldmann
d8d3c8521b fix logging levels
All normal informational output is now logged at INFO level.
To actually see normal output, the logger is configured to level INFO also.

Log levels:
WARNING is for warnings, ERROR is for (fatal) errors, DEBUG is for debugging.

logging levels must only be used according to this semantics and must not be
(ab)used to let something show up (although the logger would usually hide it)
or hide something (although the logger would usually show it).

Controlling the amount of output shown on INFO level:
--verbose, --progress, --stats are currently used for this.
more such flags might be added later as needed.

if they are set, more output is logged (at INFO level).

also: change strange setup_logging return value
2015-10-23 02:29:41 +02:00
TW
52fd2ad3da Merge pull request #320 from ThomasWaldmann/final-status
Final status
2015-10-22 01:04:36 +02:00
Thomas Waldmann
5bcd4835e6 add tests for return codes 2015-10-22 00:45:29 +02:00
Antoine Beaupré
bfaa046a31 add standard --version argument
this way the version can be discovered by scripts without having to
part the output of 'help'.

it is removed from the 'help' output itself because it is prettier
without the complete version number, and then the description can be
reused elsewhere as well without needing the version number
2015-10-21 09:58:28 -04:00
TW
557d8c7e03 Merge pull request #318 from anarcat/flake8
small flake8 changes
2015-10-21 02:15:22 +02:00
Antoine Beaupré
05c4255620 flake8 cleanup broke the upgrader, re-import Repository 2015-10-20 19:54:57 -04:00
Thomas Waldmann
72c984891c refactor return codes, fixes #61
0 = success (logged as INFO)
1 = warning (logged as WARNING)
2 = (fatal and abrupt) error (logged as ERROR)

please use the EXIT_(SUCCESS,WARNING,ERROR) constants from helpers module.
2015-10-21 01:11:51 +02:00
Thomas Waldmann
1439f3be60 give a final status into the log output, including exit code, fixes #58 2015-10-20 23:57:56 +02:00
Thomas Waldmann
af2366693a tests: catch stderr also, some tests expect stderr contents in "output"
weird: the remote archive fuse tests deadlock, that's why I replaced them by dummies
2015-10-20 22:46:47 +02:00
Antoine Beaupré
8651f87fa1 fix flake8 warnings in my recent PRs 2015-10-20 14:43:49 -04:00
Antoine Beaupré
aad6afb3e0 pep8 the whole darn helpers module 2015-10-20 13:39:21 -04:00
Antoine Beaupré
21fdc91995 clarify size tests 2015-10-20 13:04:01 -04:00
Antoine Beaupré
416e42335c introduce variable precision 2015-10-20 13:01:39 -04:00
Antoine Beaupré
c7c1b9222b convert to more flexible size formatters
those can now support both file sizes (in SI/decimal format, powers of 10) and memory sizes (in binary format, powers of 2)

tests still fail because the result is always displayed as floats
2015-10-20 13:01:14 -04:00
Antoine Beaupré
de390b1ca6 add file size tests, failing
the tests are failing because 1KB gets displayed as 1000 bytes, but also because higher prefixes are missing
2015-10-20 13:01:14 -04:00
TW
21f26988cc Merge pull request #303 from anarcat/verbosity
Verbosity
2015-10-19 22:25:46 +02:00
Antoine Beaupré
38bde26673 remove needless double type conversion
i got confused and thought i was setting the environment (in which case you need to cast to str anyways, so this was wrong even then)
2015-10-19 15:47:05 -04:00
Antoine Beaupré
a3084b7174 try to fix build on py32 again 2015-10-19 14:41:02 -04:00
Antoine Beaupré
12d22d5940 try to fix build on py32 2015-10-19 09:10:45 -04:00
Antoine Beaupré
f9bccd1987 revert policy decision of showing all files listing only on debug 2015-10-19 09:10:19 -04:00