Commit Graph

976 Commits

Author SHA1 Message Date
Antti Aalto f3543c28fd Minor Windows fixes. 2017-10-31 17:20:25 +02:00
Antti Aalto 38d2f1efd6 Fix windows absolute paths. 2017-10-30 17:21:44 +02:00
Antti Aalto 9fe09c831f Fix windows build after merge with master. 2017-10-30 14:11:06 +02:00
Antti Aalto 583d51785e Merge windows branch with master 2017-10-30 12:08:11 +02:00
TW 926b1c6374
Merge pull request #3212 from ThomasWaldmann/stat-after-match
don't do stat() when not recursing into excluded dir, fixes #3209
2017-10-28 13:31:47 +02:00
TW c0b9058759 Merge pull request #3217 from narendravardi/add_borg_config_dir
add BORG_CONFIG_DIR env, fixes #3083
2017-10-27 11:34:29 +02:00
Narendra Vardi a3f1e6e250 added unittest for get_config_dir function 2017-10-25 23:07:45 +05:30
Narendra Vardi 56fed4f964 add BORG_CONFIG_DIR env (#3083) 2017-10-24 08:34:35 +05:30
Thomas Waldmann 36f2a4e1dc mention "!" (exclude-norecurse) type in patterns help 2017-10-24 03:18:40 +02:00
Thomas Waldmann 0c410e84fe don't do stat() when not recursing into excluded dir, fixes #3209
also: fix exception handling for the stat() calls

just moving all these lines into the "try"-block below (like it was in 1.0).
2017-10-24 03:17:41 +02:00
Thomas Waldmann ae91aff681 arg parsing: fix fallback function, refactor, fixes #3205
This is a fixup for #3155, which was broken on at least python <= 3.4.2.

Also clarify when to use which *func in set_defaults.

(cherry picked from commit 5ce4fa9704)
2017-10-22 23:45:04 +02:00
TW 152bb27663 Merge pull request #3193 from ThomasWaldmann/fix-4args-open
fix server-side IndexError for 4-arg open() of old clients, fixes #3192
2017-10-22 00:45:35 +02:00
TW 1d6ed506f1 Merge pull request #3198 from ThomasWaldmann/keyfile-abspath
fix crash with relative BORG_KEY_FILE, fixes #3197
2017-10-20 23:41:04 +02:00
Thomas Waldmann 7136e2c93c fix crash with relative BORG_KEY_FILE, fixes #3197 2017-10-20 21:13:11 +02:00
Thomas Waldmann dbcc870489 fix server-side IndexError for 4-arg open() of old clients, fixes #3192
borg 1.1(.0) server didn't support the 4 argument open() calls made
by < 1.0.7 clients.
2017-10-20 16:47:32 +02:00
Thomas Waldmann 93de42bb25 show excluded dir with "x" for tagged dirs / caches, fixes #3189 2017-10-20 04:54:09 +02:00
TW 38dd1f11ac Merge pull request #3181 from ThomasWaldmann/hardlinked-symlink-warning
remove hardlinked symlink warning, update docs
2017-10-17 21:30:53 +02:00
Thomas Waldmann 10adadf685 implement --nobsdflags and --exclude-nodump, fixes #3160
do no read/archive bsdflags: borg create --nobsdflags ...
do not extract/set bsdflags: borg extract --nobsdflags ...

use cases:

- fs shows wrong / random bsdflags (bug in filesystem)
- fs does not support bsdflags anyway
- already archived bsdflags are wrong / unwanted
- borg shows any sort of unwanted effect due to get_flags, esp. on Linux

the nodump flag ("do not backup this file") is not honoured any more by
default because this functionality (esp. if it happened by error or
unexpected) was rather confusing and unexplainable at first to users.

if you want that "do not backup NODUMP-flagged files" behaviour, use:
borg create --exclude-nodump ...
2017-10-17 18:45:32 +02:00
Thomas Waldmann e674822888 remove hardlinked symlinks warning, update docs, fixes #3175
the warning was annoying for people with a lot of such items and
they can not do anything about it anyway.

thus, just document this as a limitation.
2017-10-17 18:34:32 +02:00
Thomas Waldmann 0190abff81 cache: use SaveFile for more safety, fixes #3158
Looks like under unfortunate circumstances, these files could become
0 byte files (see #3158). SaveFile usage should prevent that.
2017-10-15 00:39:39 +02:00
Thomas Waldmann 9d6b125e98 borg recreate: correctly compute part file sizes, fixes #3157
when doing in-file checkpointing, borg creates *.borg_part_N files.
complete_file = part_1 + part_2 + ... + part_N

the source item for recreate already has a precomputed (total) size
member, thus we must force recomputation from the (partial) chunks
list to correct the size to be the part's size only.

borg create avoided this problem by computing the size member after
writing all the parts. this is now not required any more.

the bug is mostly cosmetic, borg check will complain, borg extract on
a part file would also complain. but all the complaints only refer to
the wrong metadata of the part files, the part files' contents are
correct.

usually you will never extract or look at part files, but only deal
with the full file, which will be completely valid, all metadata and
content.

you can get rid of the archives with these cosmetic errors by running
borg recreate on them with a fixed borg version. the old part files
will get dropped (because they are usually ignored) and any new part
file created due to checkpointing will be correct.
2017-10-14 04:24:26 +02:00
Thomas Waldmann a6ee4e9aed bsdflags support: do not open BLK/CHR/LNK files, fixes #3130
opening a device file for a non-existing device can be very slow.
symlinks will make the open() call fail as it is using O_NOFOLLOW.

also: lstat -> stat(..., follow_symlinks=False) like everywhere else.
2017-10-13 23:53:22 +02:00
TW 19ed725a58 move files-cache related options to borg create, fixes #3146 (#3147)
move --no-files-cache from common to borg create options, fixes #3146

for borg prune, just use do_files=False (it only needs the chunks
cache, not the files cache).
2017-10-13 20:16:30 +02:00
Thomas Waldmann 3be328ed70 don't crash if only a global option is given, show help, fixes #3142 2017-10-12 05:40:52 +02:00
TW c8bf9dba4a Merge pull request #3122 from ThomasWaldmann/logging-config-fix
logging with fileConfig: set json attr on "borg" logger, fixes #3114
2017-10-11 01:08:31 +02:00
TW 13a4439bb8 Merge pull request #3120 from ThomasWaldmann/fix-nonlocal-path-detection
fix detection of non-local path, fixes #3108
2017-10-11 01:01:17 +02:00
TW 0bddbb32b4 Merge pull request #3119 from ThomasWaldmann/no-time-end
recreate: don't crash on attic archives w/o time_end, fixes #3109
2017-10-11 00:55:22 +02:00
TW 8455ab3ff2 Merge pull request #3121 from ThomasWaldmann/support-no-hardlinks
catch ENOTSUP for os.link, fixes #3107
2017-10-11 00:32:37 +02:00
Thomas Waldmann afba813706 logging with fileConfig: set json attr on "borg" logger, fixes #3114 2017-10-10 02:18:13 +02:00
Thomas Waldmann 203a5c8f19 catch ENOTSUP for os.link, fixes #3107 2017-10-10 01:57:58 +02:00
Thomas Waldmann 60e9249100 fix detection of non-local path, fixes #3108
filenames like ..foobar are valid, so, to detect stuff in upper dirs,
we need to include the path separator and check if it starts with '../'.
2017-10-10 01:36:44 +02:00
Thomas Waldmann 7a689b1295 don't crash in first part of truncate_and_unlink, fixes #3117 2017-10-10 01:25:19 +02:00
Thomas Waldmann 9d3daebd5f recreate: don't crash on attic archives w/o time_end, fixes #3109 2017-10-10 01:17:56 +02:00
Marian Beermann b00179ff78 init: fix wrong encryption choices in command line parser 2017-10-08 12:29:03 +02:00
Thomas Waldmann 011e0fd3fa auto compression: make sure expensive compression is actually better
if it is not significantly better compressed, we just store lz4
compressed data (which we already have computed anyway), because
that at least decompressed super fast.
2017-10-03 21:11:43 +02:00
Thomas Waldmann b5069770b7 fix LDLP restoration for subprocesses, fixes #3077 2017-10-01 19:17:23 +02:00
Thomas Waldmann 5e2de8ba67 implement files cache mode control, fixes #911
You can now control the files cache mode using this option:

--files-cache={ctime,mtime,size,inode,rechunk,disabled}*

(only some combinations are supported)

Previously, only these modes were supported:
- mtime,size,inode (default of borg < 1.1.0rc4)
- mtime,size (by using --ignore-inode)
- disabled (by using --no-files-cache)

Now, you additionally get:
- ctime alternatively to mtime (more safe), e.g.:
  ctime,size,inode (this is the new default of borg >= 1.1.0rc4)
- rechunk (consider all files as changed, rechunk them)

Deprecated:
- --ignore-inodes (use modes without "inode")
- --no-files-cache (use "disabled" mode)

The tests needed some changes:
- previously, we use os.utime() to set a files mtime (atime) to specific
  values, but that does not work for ctime.
- now use time.sleep() to create the "latest file" that usually does
  not end up in the files cache (see FAQ)
2017-10-01 00:52:32 +02:00
TW e8e204833c Merge pull request #3058 from ThomasWaldmann/fix-partial-json
remote: deal with partial lines, fixes #2637
2017-09-26 22:03:26 +02:00
Thomas Waldmann a57e23fdb3 use prepared env for xattr module's fakeroot version check 2017-09-25 04:36:07 +02:00
Thomas Waldmann cf59f653e5 use prepared env for borg export-tar --tar-filter subprocess 2017-09-25 04:36:07 +02:00
Thomas Waldmann b88da10641 use prepared env for borg umount 2017-09-25 04:36:07 +02:00
Thomas Waldmann 6da5bf4b85 use prepared env for borg with-lock 2017-09-25 04:36:07 +02:00
Thomas Waldmann 6a6fd31804 use prepared env for calling BORG_PASSCOMMAND, fixes #3050 2017-09-25 04:36:06 +02:00
Thomas Waldmann ba941b0801 refactor/fix subprocess env preparation
refactor: make a generally usable function

fix: remove support code for ancient pyinstaller

the "else" branch was needed for pyinstaller < 20160820 because it did
not have the LD_LIBRARY_PATH_ORIG env var, so we just killed LDLP
because we had no better way.

but with borg tests running under fakeroot, this is troublesome as
fakeroot uses this also and can't find its library without it.

so, just remove it, we do not need to support old pyinstaller.
2017-09-25 04:34:58 +02:00
Thomas Waldmann 8646216a06 remote: deal with partial lines, fixes #2637
due to block buffering (in borg, pipes, sshd, ssh) partial lines might
be received. for plain text, this causes cosmetic issues, for json it
causes tracebacks due to parse errors.

the code now makes sure handle_remote_line() only gets called with a
complete line (which is terminated by any universal newline char, a
pure \r seems to be needed for remote progress displays).

it also fixes a yet undiscovered partial utf-8-sequence decoding issue
that might occur for the same reason.
2017-09-25 02:44:54 +02:00
TW d719c1eb70 Merge pull request #3037 from ThomasWaldmann/remove-110b-logger
remove client_supports_log_v3 flag, fixes #3033
2017-09-25 00:50:36 +02:00
Thomas Waldmann 713be765d1 docs: change-passphrase only changes the passphrase, fixes #2990 2017-09-22 22:53:55 +02:00
Thomas Waldmann 54c5049fb9 remove client_supports_log_v3 flag, fixes #3033
the client_supports_log_v3 flag was added to differentiate 1.1.0 beta3
to beta5 clients (which did not support parsing json log format from
server) from >= 1.1.0beta6 clients (which support it).
for clients older than 1.1.0b3, no json log format will be negotiated
anyway.

by removing the client_supports_log_v3 flag support, we drop support for
clients using 1.1.0beta3..5.

thus, a client is now expected to either support old log format (like
borg 1.0.x) or new json format (like borg 1.1.0 >= beta6).

client     server comment
===========================================
any        0.29+  uses $LOG plain remote log format
any        1.0.x  uses $LOG plain remote log format
1.0.x      1.1.0  uses $LOG plain remote log format
1.1.0b1/b2 1.1.0  (uses $LOG plain remote log format)
1.1.0b3-b5 1.1.0  (malfunction)
1.1.0b6    1.1.0  (uses json remote log format)
1.1.0rc    1.1.0  uses json remote log format
1.1.x      1.1.0  uses json remote log format

(beta testing is over and betas are unsupported now)

Note: client_supports_log_v3 flag was added in changeset
      18a2902c9c
2017-09-21 04:11:59 +02:00
Thomas Waldmann 2b75b278da flush json mode progress stderr output
if borg stderr is not connected to a tty, but to ssh (when using
borg client/server), sys.stderr is block buffered (tty: line buffered).

thus we better flush explicitly after emitting a line as the receiving
side can not handle partial json at the end of the block.

also, it might solve some delays, when output didn't arrive at
receiving side in time.
2017-09-18 04:42:30 +02:00
enkore 7c5a9d89b2 delete: support naming multiple archives (#3017)
delete: support naming multiple archives
2017-09-09 23:08:23 +02:00