Compare commits

...

775 Commits

Author SHA1 Message Date
Alexander Neumann
40832b2927 Add version for 0.10.0 2020-09-19 17:38:26 +02:00
Alexander Neumann
c8a94eced7 Update manpages and auto-completion 2020-09-19 17:38:26 +02:00
Alexander Neumann
ee6e981b4e Generate CHANGELOG.md for 0.10.0 2020-09-19 17:38:10 +02:00
Alexander Neumann
96fd982f6a Prepare changelog for 0.10.0 2020-09-19 17:37:59 +02:00
Alexander Neumann
6ff0082c02 Merge pull request #2928 from MichaelEischer/init-copy-chunker
init: Add `--copy-chunker-parameters` option
2020-09-19 17:32:13 +02:00
Alexander Neumann
95c1d7d959 Merge pull request #2927 from restic/update-deps
Update dependencies
2020-09-19 17:29:35 +02:00
Michael Eischer
f003410402 init: Add --copy-chunker-params option
This allows creating multiple repositories with identical chunker
parameters which is required for working deduplication when copying
snapshots between different repositories.
2020-09-19 16:53:05 +02:00
Michael Eischer
655430550b Extract parameters for second repository from copy command 2020-09-19 16:07:55 +02:00
MichaelEischer
1823b8195c Merge pull request #2930 from rawtaz/password-file-text
Improve wording for --password-file and related options
2020-09-19 16:06:15 +02:00
Leo R. Lundgren
311ad2d2d0 Improve wording for --password-file and related options 2020-09-19 15:47:32 +02:00
Alexander Neumann
a10b44a265 Add note about fuse 2020-09-19 14:35:55 +02:00
Alexander Neumann
baf3a9aa3b Merge pull request #2929 from rawtaz/password-command-text
Improve wording for --password-command and --password-command2 options
2020-09-19 14:30:39 +02:00
Leo R. Lundgren
ffe6dce7e7 Improve wording for --password-command and --password-command2 options 2020-09-19 14:23:25 +02:00
Alexander Neumann
8ce0ce387f Add changelog 2020-09-19 14:22:31 +02:00
Alexander Neumann
3c44598bf6 Drop Go 1.12, require at least 1.13 2020-09-19 14:20:04 +02:00
Alexander Neumann
3bb55fd6bf Merge pull request #2914 from YoshieraHuang/max-file-size
Support excluding files by size
2020-09-19 14:12:15 +02:00
Alexander Neumann
36efefa7bd Update dependencies, pin fuse library
This updates all dependencies which causes the following changes:
 * The fuse library is set to the last version supporting macOS
 * The minimal version of Go required to build restic is now 1.13
2020-09-19 14:06:37 +02:00
yoshiera
ac4b8c98ac Support excluding files by size 2020-09-19 19:52:09 +08:00
MichaelEischer
4dcd6abf37 Merge pull request #2616 from greatroar/no-cache-interface
Remove practically unused cache interface
2020-09-18 19:50:47 +02:00
greatroar
cb3f531050 Make Cache.Path private
It's only used inside the package.
2020-09-18 11:17:29 +02:00
greatroar
23fcbb275a Remove restic.Cache interface
It was used in one code path, which then asserted its concrete type as
*cache.Cache.

Privatised some of the interface methods.
2020-09-18 10:48:13 +02:00
greatroar
6e3215a80d Remove unused error type from internal/cache 2020-09-18 10:38:14 +02:00
Alexander Neumann
b10dce541e Merge pull request #2598 from MichaelEischer/diff-speedup
Diff speedup
2020-09-13 16:42:05 +02:00
Michael Eischer
4f221c4022 Add changelog entry 2020-09-13 16:28:46 +02:00
Michael Eischer
f5c448aa65 diff: Optimize diff calculation for shared subtrees
When the diff calculation compares two trees with identical id then no
differences between them can ever show up. Optimize for that case by
simply traversing the tree only once to collect all referenced blobs for
a proper calculation of added and removed blobs.

Just skipping the common subtrees is not possible as this would skew the
results if the added or removed blobs are shared with one of the
subtrees.
2020-09-13 16:28:46 +02:00
Michael Eischer
c0fc85d303 diff: Add integration test 2020-09-13 16:28:46 +02:00
Alexander Neumann
0c48e515f0 Merge pull request #2630 from MichaelEischer/fix-staticcheck
Fix lots of small issues reported by staticcheck
2020-09-13 16:19:22 +02:00
Alexander Neumann
97950ab81a options: Fix test for Go >= 1.15 2020-09-12 17:36:44 +02:00
Alexander Neumann
59fca85844 Remove darwin/386 from integration tests 2020-09-12 17:09:33 +02:00
Alexander Neumann
e207257714 Fix Appveyor 2020-09-12 16:59:03 +02:00
Alexander Neumann
82e1cbed4f Update Go versions 2020-09-12 16:52:21 +02:00
Alexander Neumann
8903b6c88a helpers: Rework list of architectures
This also removes darwin/386 which is not supported on Go 1.15 any more.
2020-09-12 16:39:41 +02:00
Alexander Neumann
93583c01b1 helpers: Fetch modules for release binaries 2020-09-12 16:25:36 +02:00
MichaelEischer
88664ba222 Merge pull request #2893 from MichaelEischer/restore-preallocate
restorer: Preallocate files
2020-09-08 22:43:05 +02:00
Michael Eischer
121233e1b3 Add preallocate tests 2020-09-07 21:41:47 +02:00
Michael Eischer
8cc9514879 restorer: pre-allocate files before loading chunks 2020-09-07 21:41:47 +02:00
Michael Eischer
2e7d475029 Process packs in order of first appearance 2020-09-06 21:25:35 +02:00
rawtaz
d3a286928a Merge pull request #2905 from MichaelEischer/fix-ls-help
ls: Explicitly enforce that the user specifies a snapshot ID
2020-09-05 10:44:01 +02:00
Michael Eischer
c46edcd9d6 error strings should not end with punctuation 2020-09-05 10:07:17 +02:00
Michael Eischer
1ede018ea6 error variable names should start with 'Err' 2020-09-05 10:07:17 +02:00
Michael Eischer
b77e933d80 Convert underscore variable names to camelCase 2020-09-05 10:07:16 +02:00
Michael Eischer
d0329cf3eb Adjust comments to match name of exported methods 2020-09-05 10:07:16 +02:00
Michael Eischer
dc31529fc3 Unindent else block after if block ending with a return statement 2020-09-05 10:07:16 +02:00
Michael Eischer
4784540f04 repository: Simplify worker group code 2020-09-05 10:07:16 +02:00
Michael Eischer
84ea2389ae archiver_test: Only skip symlinks on windows 2020-09-05 10:07:16 +02:00
Michael Eischer
b4a7ce86cf uint cannot be less than zero 2020-09-05 10:07:16 +02:00
Michael Eischer
7ee0964880 crypto: Remove unused error 2020-09-05 10:07:16 +02:00
Michael Eischer
f6f11400c2 restic: Remove unused variable value 2020-09-05 10:07:16 +02:00
Michael Eischer
e2dc5034d3 restic/file: Use FileType for all File constants
The data type of a variable is only carried on when using iota.
2020-09-05 10:07:16 +02:00
Michael Eischer
9a1b3cb5d9 restorer: Remove unused treeID struct member from test 2020-09-05 10:07:16 +02:00
Michael Eischer
b22655367c integration_test: Replace fprintf without format string 2020-09-05 10:07:16 +02:00
Michael Eischer
068a3ce23f Remove redundant return 2020-09-05 10:07:16 +02:00
Michael Eischer
ee05501ce7 archiver: Remove unused chmod function 2020-09-05 10:07:16 +02:00
Michael Eischer
014600bee6 archiver: Remove unused variable from test 2020-09-05 10:07:16 +02:00
Michael Eischer
d9a80e07b9 repository: Simplify index age calculation 2020-09-05 10:07:16 +02:00
Michael Eischer
d19f05c960 Use buf.String() instead of string(buf.Bytes()) 2020-09-05 10:07:16 +02:00
Michael Eischer
460e2ffbf6 Collapse a few boolean operations 2020-09-05 10:07:14 +02:00
Michael Eischer
49b6aac3fa Use !bytes.Equal instead of bytes.Compare !=0 to check for inequality 2020-09-05 10:06:23 +02:00
Michael Eischer
2f8335554c Remove a few unused variables 2020-09-05 10:06:23 +02:00
Michael Eischer
37113282ca Merge a few variable declaration and initializations 2020-09-05 10:05:34 +02:00
Michael Eischer
337725c354 Use sort.Strings 2020-09-05 10:05:34 +02:00
MichaelEischer
2ddb7ffb7e Merge pull request #2255 from Kidswiss/tar
Fix dumping issues with / and the first sub level
2020-09-01 21:52:17 +02:00
Michael Eischer
81dcfea11a dump: Mention tar output in command help text 2020-08-31 22:43:10 +02:00
MichaelEischer
55071ee367 Merge pull request #2859 from buschjost/stats-filter-by-tag-and-path
Add filter by tag and path to stats command
2020-08-31 22:11:01 +02:00
Michael Eischer
dcf9ded977 dump: Use slashes as path separators in tar on windows
This conversion is necessary as paths returned by filepath.Rel use the
operating-system native path separator
2020-08-30 18:26:50 +02:00
Michael Eischer
bcf44a9c3f dump: Properly handle file paths without / prefix
filepath.Rel failed if the requested path did not start with a `/` e.g.
`restic` instead of `/restic`.
2020-08-30 18:25:42 +02:00
Oliver Buschjost
a7b4c19abf Fix display of warning about ignored filters 2020-08-30 17:14:56 +02:00
Oliver Buschjost
d3fcfeba3a Add filter by tag and path to stats command 2020-08-30 17:14:48 +02:00
Michael Eischer
e69449bf2c dump: Add test for splitPath 2020-08-30 16:00:48 +02:00
Simon Beck
da4193c3ef Add changelog 2020-08-30 16:00:48 +02:00
Simon Beck
fe6445e0f4 dump: Added unit tests for tar output 2020-08-30 16:00:48 +02:00
MichaelEischer
ea81a0e282 Merge pull request #2606 from middelink/fix-323
Add copy functionality.
2020-08-30 10:18:24 +02:00
Simon Beck
80a11960dd dump: Always dump relative paths into tarballs
Tarballs should only contain relative paths.
2020-08-29 21:14:34 +02:00
Simon Beck
d6f739ec22 dump: Extract tar code to internal/dump 2020-08-29 21:14:34 +02:00
Simon Beck
b98598e55f dump: Fix dumping issues with / and the first sub level
There was an issue that prevented the dump command from working
correctly when either:

* `/` contained multiple nodes (e.g. `restic backup /`)
* dumping a file in the first sublevel was attempted (e.g. `/foo`)
2020-08-29 21:14:29 +02:00
Michael Eischer
d5f86effa1 ls: Explicitly enforce that the user specifies a snapshot ID
The help messages suggested that the `ls` command work without
explicitly passing a snapshot ID. However, this was never the case:
without a snapshot ID the command just failed with the error
`Ignoring "", it is not a snapshot id`.

Fixes #2299
2020-08-29 14:28:53 +02:00
MichaelEischer
c34c731698 Merge pull request #2702 from MichaelEischer/fix-backup-dir-count
backup: Fix reporting of directory count in summary
2020-08-29 11:29:21 +02:00
Michael Eischer
412623b848 copy: Reuse buffer for downloaded blobs 2020-08-29 10:48:44 +02:00
Michael Eischer
bbe8b73f03 Update help text of backup command in docs 2020-08-29 10:48:44 +02:00
Michael Eischer
91e8d998cd Add documentation for copy command 2020-08-29 10:48:44 +02:00
Michael Eischer
9a4796594a integration tests: Fix checking of wrong snapshot 2020-08-29 10:48:44 +02:00
Michael Eischer
15374d22e9 integration tests: Add basic tests for copy command 2020-08-29 10:48:44 +02:00
Michael Eischer
88ad58d6cd integration tests: Redirect directory diff into intermediate buffer 2020-08-29 10:48:44 +02:00
Michael Eischer
591a8c4cdf integration tests: Deduplicate backup test-data setup code 2020-08-29 10:48:44 +02:00
Michael Eischer
ec9a53b7e8 copy: Mark and skip previously copied snapshots
Use the `Original` field of the copied snapshot to store a persistent
snapshot ID. This can either be the ID of the source snapshot if
`Original` was not yet set or the previous value stored in the
`Original` field. In order to still copy snapshots modified using the
tags command the source snapshot is compared to all snapshots in the
destination repository which have the same persistent ID. Snapshots are
only considered equal if all fields except `Original` and `Parent`
match. That way modified snapshots are still copied while avoiding
duplicate copies at the same time.
2020-08-29 10:48:44 +02:00
MichaelEischer
34a3adfd8d Merge pull request #2898 from aawsome/add-iexclude-file
backup: Add --iexclude-file option
2020-08-28 21:59:16 +02:00
Alexander Weiss
9867c4bbb4 Add flag --iexclude-file to backup 2020-08-28 21:04:41 +02:00
MichaelEischer
efb4a981cf Merge pull request #2904 from jasonccox/consistent-usage-strings
Update usage strings to put flags before args
2020-08-28 20:39:14 +02:00
Jason Cox
2447f3f110 Update usage strings to put flags before args
The standard UNIX-style ordering of command-line arguments places
optional flags before other positional arguments. All of restic's
commands support this ordering, but some of the usage strings showed the
flags after the positional arguments (which restic also parses just
fine). This change updates the doc strings to reflect the standard
ordering.

Because the `restic help` command comes directly from Cobra, there does
not appear to be a way to update the argument ordering in its usage
string, so it maintains the non-standard ordering (positional arguments
before optional flags).
2020-08-28 02:16:22 +00:00
Michael Eischer
b25978a53c backup: Fix reporting of directory count in summary
Previously the directory stats were reported immediately after calling
`SaveDir`. However, as the latter method saves the tree asynchronously
the stats were still initialized to their nil value. The stats are now
reported via a callback similar to the one used for the fileSaver.
2020-08-27 22:43:51 +02:00
Michael Eischer
b0a8c4ad6c copy: Only process each tree once
This speeds up copying multiple overlapping snapshots from one
repository to another, as we only have to copy the changed parts of
later snapshots.
2020-08-26 22:17:52 +02:00
Michael Eischer
908b23fda0 copy: Update for modernized repository interface 2020-08-26 22:17:52 +02:00
greatroar
4508d406ef copy: Remove separate SaveIndex in restic copy
Flush does this now.
2020-08-26 22:17:52 +02:00
Pauline Middelink
7048cc3e58 Add copy functionality
Add a copy command to copy snapshots between repositories. It allows the user
to specify a destination repository, password, password-file, password-command
or key-hint to supply the necessary details to open the destination repository.

You need to supply a list of snapshots to copy, snapshots which already exist
in the destination repository will be skipped.

Note, when using the network this becomes rather slow, as it needs to read the
blocks, decrypt them using the source key, then encrypt them again using the
destination key before finally writing them out to the destination repository.
2020-08-26 22:17:52 +02:00
MichaelEischer
eb7c00387c Merge pull request #2899 from MichaelEischer/fix-check-progress-crash
Unify progress bar of check and prune commands
2020-08-26 00:00:50 +02:00
Michael Eischer
bc0501d72c Add changelog 2020-08-25 23:33:10 +02:00
Michael Eischer
17995dec7a Unify progress bar of check and prune commands 2020-08-25 22:47:38 +02:00
MichaelEischer
e915cedc3d Merge pull request #2897 from restic/rawtaz-github-issue-feature
github: Add question to feature issue template
2020-08-24 23:52:38 +02:00
MichaelEischer
cdcaecd27d Merge pull request #2896 from restic/rawtaz-key-hint
doc: Add missing environment variables
2020-08-24 23:51:05 +02:00
rawtaz
b43ab67a22 doc: Add missing environment variables 2020-08-24 00:49:34 +02:00
rawtaz
7ddfd6cabe github: Add question to feature issue template 2020-08-24 00:22:44 +02:00
Alexander Neumann
b1b3f1ecb6 Merge pull request #2674 from MichaelEischer/prune-strict-checks
prune: Stricter error checks
2020-08-23 10:30:41 +02:00
rawtaz
fa135f72bf Merge pull request #2439 from htrendev/ignore-sync-on-macos
Ignore not supported error on sync() when using local backend
2020-08-22 01:38:49 +02:00
Hristo Trendev
51c22f4223 local backend: ignore not supported error on sync()
Closes #2395
2020-08-22 01:27:07 +02:00
rawtaz
1a5b66f33b Merge pull request #2879 from 0xMH/master
Added more explantation for --one-file-system option
2020-08-21 19:21:01 +02:00
NoNE
da6a34e044 doc: Add more explanation for --one-file-system option 2020-08-21 19:19:13 +02:00
Bruce Dillahunty
fe69b83074 Update key password prompt (#2847) 2020-08-19 21:42:08 +02:00
Michael Eischer
08d24ff99e prune: Include ID of all missing blobs in error message 2020-08-16 11:36:14 +02:00
Michael Eischer
d8b80e9862 Add changelog 2020-08-16 11:36:14 +02:00
Michael Eischer
1c84aceb39 prune: Test for abort on damaged repositories 2020-08-16 11:36:12 +02:00
Michael Eischer
575ed9a47e Test that rebuild-index errors when old index cannot be removed 2020-08-16 11:34:01 +02:00
Michael Eischer
8f811642c3 Add support for integration tests to wrap the backend 2020-08-16 11:34:01 +02:00
Michael Eischer
f4b9544ab2 prune: Add test that repack aborts on wrong blob 2020-08-16 11:34:01 +02:00
Michael Eischer
367449dede prune: Reduce memory allocations while repacking
The slicing operator `slice[low:high]` default to 0 for the lower bound and
len(slice) for the upper bound when either or both are not specified.
Fix the code to use `cap(slice)` to check for the slice capacity.
2020-08-16 11:34:01 +02:00
Michael Eischer
7042bafea5 prune: Abort repacking when a pack contains a wrong blob
If a blob in a pack file can be decrypted successfully but contains data
that results in a different hash than stated in the header pack, then
abort repacking. As both the pack header and the blob are
cryptographically verified this either means than a malicious entity
tampered with the backup or indicates hardware problems on the client.
prune should fail with an error in both cases.
2020-08-16 11:34:01 +02:00
Michael Eischer
744a15247d prune/rebuild-index: Fail if an old index cannot be removed
The old behavior was problematic in the context of rebuild-index as it
could leave old, possibly invalid index files behind without returning a
fatal error.

Prune calls rebuildIndex before removing any data from the repository.
For this use case failing to delete an old index MUST be treated as a
fatal error. Otherwise the index could still contain an old index file
that refers to blobs/packs that were later on deleted by prune. Later
backup runs will assume that the affected blobs already exist in the
repository which results in a backup which misses data.
2020-08-16 11:34:01 +02:00
Michael Eischer
3ba19869be prune: Abort if any used blobs are missing
The previous check only approximately verified whether all required
blobs were found. However, after forgetting a few snapshots the
repository contains lots of unused blobs whose number can be sufficient
to make up for missing packs.

When coupled with a malfunctioning backend that temporarily returns broken
data this could cause restic to regard the corresponding packs as
invalid and thereby delete data that's still in use. This change lets
restic play it safe and refuse to delete anything if data is missing.
2020-08-16 11:34:01 +02:00
aawsome
0fed6a8dfc Use "pack file" instead of "data file" (#2885)
- changed variable names, especially changed DataFile into PackFile
- changed in some comments
- always use "pack file" in docu
2020-08-16 11:16:38 +02:00
rawtaz
643bbbe156 doc: Correct wording for repository (#2884)
Replaces "backend" with "repository" to match restic output.
2020-08-11 22:30:17 +02:00
MichaelEischer
eca0f0ad24 Merge pull request #2863 from aawsome/index-no-duplicates
Don't save exact duplicates in merged index
2020-08-08 18:24:14 +02:00
MichaelEischer
08dee8a52b Merge pull request #2865 from greatroar/unused
Dead code removal
2020-08-08 16:15:28 +02:00
Alexander Weiss
b112533812 Don't save exact duplicates when merging indexes 2020-08-05 06:32:02 +02:00
Alexander Weiss
5e63294355 Add benchmark MasterIndexAlloc 2020-08-05 06:32:02 +02:00
MichaelEischer
84b6f1ec53 Merge pull request #2874 from MichaelEischer/fix-verbose
Adjust description of --verbose=n parameter
2020-08-04 23:21:05 +02:00
MichaelEischer
06fb4ea3f0 Merge pull request #2805 from jwilk-forks/verbose
Fix examples of --verbose with argument
2020-08-04 23:11:35 +02:00
Michael Eischer
e38d415173 Adjust description of --verbose=n parameter 2020-08-04 23:07:53 +02:00
greatroar
d81a396944 Dead code removal
Found by running golangci-lint on the entire code base.
2020-08-04 08:38:57 +02:00
rawtaz
0b21ec44b7 Merge pull request #2869 from josephrocca/patch-1
doc: --verbose 2 to --verbose=2
2020-08-04 01:06:58 +02:00
josephrocca
bd36731119 --verbose 2 to --verbose=2
`--verbose 2` seems to be incorrect here (gives an error/warning that "the `2` directory does not exist, skipping")
2020-08-04 08:39:43 +10:00
MichaelEischer
38a2f9c07b Merge pull request #2864 from greatroar/dump-error
Fix error handling in dump (err != err)
2020-08-03 20:09:42 +02:00
rawtaz
5af2815627 Merge pull request #2821 from renard/mount-nolock
cmd/mount: honur --no-lock flag
2020-08-03 20:09:26 +02:00
MichaelEischer
b55de2260d Merge pull request #2868 from MichaelEischer/fix-getusedblobs
prune: Stop progress bar after searching used blobs
2020-08-03 19:58:59 +02:00
Sébastien Gross
9be4fe3e84 cmd/mount: honour --no-lock flag
Do not lock the repository if --no-lock global flag is set. This allows
to mount repositories which are archived on a read only system.

Signed-off-by: Sébastien Gross <seb•ɑƬ•chezwam•ɖɵʈ•org>
2020-08-03 19:45:39 +02:00
Michael Eischer
05116e4787 prune: Cleanup progress bar handling while repacking 2020-08-03 19:32:46 +02:00
Michael Eischer
04f79b9642 prune: Stop progress bar after searching used blobs 2020-08-03 19:31:49 +02:00
greatroar
8b358935a0 Fix error handling in dump (err != err) 2020-08-03 09:43:44 +02:00
MichaelEischer
66d089e239 Merge pull request #2841 from aawsome/optimize-getUsedBlobs
Extract get used blobs in prune as separate function
2020-08-01 22:40:33 +02:00
MichaelEischer
49d3efe547 Merge pull request #2840 from aawsome/delete-parallel
Make delete parallel
2020-08-01 22:26:15 +02:00
Alexander Weiss
9762bec091 Use optimized getUsedBlobs in prune 2020-08-01 21:07:31 +02:00
Alexander Weiss
0eb8553c87 add changelog for #2840 2020-08-01 20:43:18 +02:00
Alexander Weiss
d3692f5b81 Delete files in parallel in rebuild-index 2020-08-01 20:43:18 +02:00
Alexander Weiss
1c0b61204b Delete files in parallel in forget 2020-08-01 20:43:18 +02:00
Alexander Weiss
2ee654763b Delete files in parallel 2020-08-01 20:39:24 +02:00
Alexander Neumann
b7b479b668 Merge pull request #2599 from MichaelEischer/tweak-mem-usage
Reduce memory usage when searching for used blobs
2020-08-01 13:49:02 +02:00
Alexander Neumann
4cf9656f12 Merge pull request #2861 from MichaelEischer/fix-rclone-crash
rclone: Don't panic after unexpected subprocess exit
2020-08-01 13:08:50 +02:00
Alexander Neumann
2580eef2aa Merge pull request #2318 from classmarkets/2175-named-keys
Allow specifying user and host when adding keys
2020-08-01 13:06:31 +02:00
Michael Eischer
2d7ab9115f Add changelog entry 2020-08-01 12:29:16 +02:00
Michael Eischer
a178e5628e Remove duplicate TreeLoader interface 2020-08-01 12:29:16 +02:00
Michael Eischer
af66a62c04 FindUsedBlobs: Test that seen blobs are skipped
This also copies the TreeLoader interface from internal/walker to allow
stubbing the repository in the call to `FindUsedBlobs`.
2020-08-01 12:29:16 +02:00
Michael Eischer
9ea1a78bd4 FindUsedBlobs: Check for seen blobs before loading trees
The only effective change in behavior is that that toplevel nodes can
also be skipped.
2020-08-01 12:29:16 +02:00
Michael Eischer
184103647a FindUsedBlobs: merge seen into blobs BlobSet
The seen BlobSet always contained a subset of the entries in blobs.
Thus use blobs instead and avoid the memory overhead of the second set.

Suggested-by: Alexander Weiss <alex@weissfam.de>
2020-08-01 12:29:16 +02:00
Michael Eischer
c81b122374 rclone: Don't panic after unexpected subprocess exit
As the connection to the rclone child process is now closed after an
unexpected subprocess exit, later requests will cause the http2
transport to try to reestablish a new connection. As previously this never
should have happened, the connection called panic in that case. This
panic is now replaced with a simple error message, as it no longer
indicates an internal problem.
2020-08-01 12:17:40 +02:00
rawtaz
48f97f3567 Merge pull request #2857 from MichaelEischer/incomplete-backup-error
Don't print a stacktrace if some files could not be read
2020-07-29 00:06:25 +02:00
Michael Eischer
3ce9893e0b Don't print a stacktrace if some files could not be read 2020-07-28 23:52:48 +02:00
MichaelEischer
248c7c3828 Merge pull request #2587 from aawsome/optimize-fuse
Make `restic mount` faster and consume less memory
2020-07-28 23:19:17 +02:00
Alexander Weiss
f8316948d1 Optimize FUSE - make command restic mount faster and consume less memory
- Add Open() functionality to dir
- only access index for blobs when file is read
- Implement NodeOpener and put one-time file stuff there
- Add comment about locking as suggested by bazil.org/fuse

=> Thanks at Michael Eischer for suggesting the last two improvements
2020-07-28 23:01:18 +02:00
MichaelEischer
be54ceff66 Merge pull request #2855 from MichaelEischer/rclone-exit
Fix rclone subprocess handling
2020-07-26 22:55:25 +02:00
Michael Eischer
ea97ff1ba4 rclone: Skip crash test when rclone is not found 2020-07-26 12:06:18 +02:00
Michael Eischer
01b9581453 rclone: Better field names for stdio conn 2020-07-26 00:29:25 +02:00
Michael Eischer
3cd927d180 rclone: Give rclone time to finish before closing stdin pipe
Calling `Close()` on the rclone backend sometimes failed during test
execution with 'signal: Broken pipe'. The stdio connection closed both
the stdin and stdout file descriptors at the same moment, therefore
giving rclone no chance to properly send any final http2 data frames.

Now the stdin connection to rclone is closed first and will only be
forcefully closed after a timeout. In case rclone exits before the
timeout then the stdio connection will be closed normally.
2020-07-26 00:29:25 +02:00
greatroar
bf7b1f12ea rclone: Add test for pipe handling when rclone exits 2020-07-26 00:29:25 +02:00
Michael Eischer
8554332894 rclone: Close rclone side of stdio_conn pipes
restic did not notice when the rclone subprocess exited unexpectedly.

restic manually created pipes for stdin and stdout and used these for the
connection to the rclone subprocess. The process creating a pipe gets
file descriptors for the sender and receiver side of a pipe and passes
them on to the subprocess. The expected behavior would be that reads or
writes in the parent process fail / return once the child process dies
as a pipe would now just have a reader or writer but not both.

However, this never happened as restic kept the reader and writer
file descriptors of the pipes. `cmd.StdinPipe` and `cmd.StdoutPipe`
close the subprocess side of pipes once the child process was started
and close the parent process side of pipes once wait has finished. We
can't use these functions as we need access to the raw `os.File` so just
replicate that behavior.
2020-07-26 00:29:25 +02:00
greatroar
3e93b36ca4 Make rclone.New private 2020-07-26 00:28:45 +02:00
MichaelEischer
573a2fb240 Merge pull request #2789 from aawsome/fix-lookup
make Lookup() return all blobs
2020-07-25 21:32:23 +02:00
Michael Eischer
c847aace35 Rename Index interface to MasterIndex
The interface is now only implemented by repository.MasterIndex.
2020-07-25 21:19:46 +02:00
Alexander Weiss
9d1fb94c6c make Lookup() return all blobs
+ simplify syntax
2020-07-25 21:18:34 +02:00
MichaelEischer
020cab8e08 Merge pull request #2787 from greatroar/no-blobsize-cache
Remove blob size cache from restic mount
2020-07-25 20:46:35 +02:00
greatroar
07da61baee Remove blob size cache from restic mount 2020-07-25 19:39:14 +02:00
MichaelEischer
37c95bf5da Merge pull request #2835 from J0WI/patch-1
Update Go version to 1.14.6 in Docker build script
2020-07-25 17:23:54 +02:00
rawtaz
c86d2f23aa Merge pull request #2854 from restic/rawtaz-patch-1
Clarify questions and text in PR template
2020-07-25 15:41:27 +02:00
rawtaz
96ec04d74d Clarify questions and text in PR template 2020-07-25 15:38:00 +02:00
J0WI
9c3414374a Update Go version to 1.14.6 in Docker build script 2020-07-25 14:45:36 +02:00
MichaelEischer
3d530dfc91 Merge pull request #2827 from aawsome/archiver-test-contents
Make self-healing work when backing up with parent snapshot
2020-07-25 13:13:18 +02:00
MichaelEischer
c43f5b2664 Merge pull request #2733 from hibbert/support_irsa
Enable support for EKS IRSA
2020-07-25 12:58:43 +02:00
Andy Hibbert
38087e40d9 Update minio-go version so it supports EKS IRSA 2020-07-25 12:41:18 +02:00
MichaelEischer
bbc960f957 Merge pull request #2635 from greatroar/optimize-sortbycached
Optimize sorting blobs by cache status
2020-07-25 12:35:42 +02:00
greatroar
309598c237 Simplify sortCachedPacksFirst test in internal/repository
The test now uses the fact that the sort is stable. It's not guaranteed
to be, but the test is cleaner and more exhaustive. sortCachedPacksFirst
no longer needs a return value.
2020-07-25 12:12:59 +02:00
greatroar
03d23e6faa Speed up blob sorting in internal/repository
name                    old time/op    new time/op    delta
SortCachedPacksFirst-8     208µs ± 3%     186µs ± 3%  -10.74%  (p=0.000 n=10+8)

name                    old alloc/op   new alloc/op   delta
SortCachedPacksFirst-8     213kB ± 0%     139kB ± 0%  -34.62%  (p=0.000 n=10+10)

name                    old allocs/op  new allocs/op  delta
SortCachedPacksFirst-8     1.03k ± 0%     1.03k ± 0%   -0.19%  (p=0.000 n=10+10)
2020-07-25 12:12:59 +02:00
greatroar
b10acd2af7 Test and benchmark blob sorting in internal/repository 2020-07-25 12:12:58 +02:00
Alexander Weiss
9175795fdb Check contents in archiver
When backing up with a parent snapshot and the file is not changed, also
check if contents are still available in index.
2020-07-25 08:18:28 +02:00
rawtaz
5d8d70542f Merge pull request #2852 from MichaelEischer/drop-go-1.11
Drop support for Go version 1.11
2020-07-25 01:17:36 +02:00
Michael Eischer
7c23381a2b Drop support for Go version 1.11 2020-07-24 18:52:39 +02:00
MichaelEischer
34181b13a2 Merge pull request #2328 from MichaelEischer/no-repeated-checks
Fix duplicate tree checks within `restic check`
2020-07-22 22:08:02 +02:00
MichaelEischer
bcd47ec3a2 Merge pull request #2818 from aawsome/merge-index-chaining
Merge index (based on chaining index implementation)
2020-07-22 22:05:36 +02:00
Alexander Weiss
a666a6d576 Add tests and merge indexes in index benchmarks 2020-07-22 21:54:02 +02:00
Alexander Weiss
e388d962a5 Merge final indexes together for faster index access 2020-07-22 21:54:02 +02:00
Alexander Weiss
3b7a3711e6 Add more realistic index benchmarks
+ reduce test size of BenchmarkMasterIndexLookupParallel
2020-07-21 07:18:20 +02:00
Michael Eischer
9b0e718852 checker: Test that blob types are not confused 2020-07-20 23:43:47 +02:00
MichaelEischer
82c908871d Merge pull request #2812 from greatroar/chaining
Chaining hash table for repository.Index
2020-07-20 23:29:36 +02:00
Michael Eischer
ddf0b8cd0b checker: Properly distinguish between data and tree blobs
If a data blob and a tree blob with the same ID (= same content) exist,
then the checker did not report a data or tree blob as unused when the
blob of the other type was still in use.
2020-07-20 22:58:39 +02:00
Michael Eischer
2d0c138c9b checker: Test that check only decodes trees once
The `DuplicateTree` flag is necessary to ensure that failures cannot be
swallowed. The old checker implementation ignores errors from LoadTree
if the corresponding tree was already checked.
2020-07-20 22:51:53 +02:00
Michael Eischer
ef325ffc02 checker: Cleanup error handling code
This change only moves code around but does not result in any change in
behavior.
2020-07-20 22:51:53 +02:00
Michael Eischer
0f67ae813a Add changelog 2020-07-20 22:51:53 +02:00
Michael Eischer
7a165f32a9 checker: Traverse trees in depth-first order
Backups traverse the file tree in depth-first order and saves trees on
the way back up. This results in tree packs filled in a way comparable
to the reverse Polish notation.  In order to check tree blobs in that
order, the treeFilter would have to delay the forwarding of tree nodes
until all children of it are processed which would complicate the
implementation.

Therefore do the next similar thing and traverse the tree in depth-first
order, but process trees already on the way down. The tree blob ids are
added in reverse order to the backlog, which is once again reverted when
removing the ids from the back of the backlog.
2020-07-20 22:51:53 +02:00
Michael Eischer
36c69e3ca7 checker: Unify blobs, processed trees and referenced blobs map
The blobRefs map and the processedTrees IDSet are merged to reduce the
memory usage. The blobRefs map now uses separate flags to track blob
usage as data or tree blob. This prevents skipping of trees whose
content is identical to an already processed data blob. A third flag
tracks whether a blob exists or not, which removes the need for the
blobs IDSet.
2020-07-20 22:51:47 +02:00
Michael Eischer
35d8413639 checker: Remove dead index map 2020-07-20 22:37:31 +02:00
Michael Eischer
c66a0e408c checker: Reduce cost of debug log
Avoid duplicate allocation of the Subtree list.
2020-07-20 22:37:31 +02:00
Michael Eischer
70f4c014ef checker: Decode identical tree nodes only once
Even though the checkTreeWorker skips already processed chunks,
filterTrees did queue the same tree blob on every occurence. This
becomes a serious performance bottleneck for larger number of snapshots
that cover mostly the same directories. Therefore decode a tree blob
exactly once.
2020-07-20 22:37:31 +02:00
Michael Eischer
f0d8710611 Add benchmark for checker scaling with snapshot count 2020-07-20 22:37:31 +02:00
MichaelEischer
bd3e280f6d Merge pull request #2546 from Summerdave/fix-backup-error-code
Return an error when errors occured during backup
2020-07-20 22:31:46 +02:00
MichaelEischer
2746dcdb5f Merge pull request #2845 from restic/update-chunker
Update chunker
2020-07-20 22:20:28 +02:00
David Sommer
5729d967f5 backup: Return exit status code 3 when failing to read source data
The backup command used to return a zero exit code as long as a snapshot
could be created successfully, even if some of the source files could not
be read (in which case the snapshot would contain the rest of the files).

This made it hard for automation/scripts to detect failures/incomplete
backups by looking at the exit code. Restic now returns the following exit
codes for the backup command:

 - 0 when the command was successful
 - 1 when there was a fatal error (no snapshot created)
 - 3 when some source data could not be read (incomplete snapshot created)
2020-07-20 22:19:01 +02:00
Alexander Neumann
f9f6124558 Update chunker 2020-07-20 22:07:02 +02:00
Alexander Neumann
8074879c5f Remove 'go generate' 2020-07-19 17:28:42 +02:00
greatroar
7bda28f31f Chaining hash table for repository.Index
These are faster to construct but slower to access. The allocation rate
is halved, the peak memory usage almost halved compared to standard map.

Benchmark results on linux/amd64, -benchtime=3s -count=20:

name                                            old time/op    new time/op    delta
PackerManager-8                                    178ms ± 0%     178ms ± 0%     ~     (p=0.231 n=20+20)
DecodeIndex-8                                      4.54s ± 0%     4.30s ± 0%   -5.20%  (p=0.000 n=18+17)
DecodeIndexParallel-8                              4.54s ± 0%     4.30s ± 0%   -5.22%  (p=0.000 n=19+18)
IndexHasUnknown-8                                 44.4ns ± 5%    50.5ns ±11%  +13.82%  (p=0.000 n=19+17)
IndexHasKnown-8                                   48.3ns ± 0%    51.5ns ±12%   +6.68%  (p=0.001 n=16+20)
IndexAlloc-8                                       758ms ± 1%     616ms ± 1%  -18.69%  (p=0.000 n=19+19)
IndexAllocParallel-8                               234ms ± 3%     204ms ± 2%  -12.60%  (p=0.000 n=20+18)
MasterIndexLookupSingleIndex-8                     122ns ± 0%     145ns ± 9%  +18.44%  (p=0.000 n=14+20)
MasterIndexLookupMultipleIndex-8                   369ns ± 2%     429ns ± 8%  +16.27%  (p=0.000 n=20+20)
MasterIndexLookupSingleIndexUnknown-8             68.4ns ± 5%    74.9ns ±13%   +9.47%  (p=0.000 n=20+20)
MasterIndexLookupMultipleIndexUnknown-8            315ns ± 3%     369ns ±11%  +17.14%  (p=0.000 n=20+20)
MasterIndexLookupParallel/known,indices=5-8        743ns ± 1%     816ns ± 2%   +9.87%  (p=0.000 n=17+17)
MasterIndexLookupParallel/unknown,indices=5-8      238ns ± 1%     260ns ± 2%   +9.14%  (p=0.000 n=19+20)
MasterIndexLookupParallel/known,indices=10-8      1.01µs ± 3%    1.11µs ± 2%   +9.79%  (p=0.000 n=19+20)
MasterIndexLookupParallel/unknown,indices=10-8     222ns ± 0%     269ns ± 2%  +20.83%  (p=0.000 n=16+20)
MasterIndexLookupParallel/known,indices=20-8      1.06µs ± 2%    1.19µs ± 2%  +12.95%  (p=0.000 n=19+18)
MasterIndexLookupParallel/unknown,indices=20-8     413ns ± 1%     530ns ± 1%  +28.19%  (p=0.000 n=18+20)
SaveAndEncrypt-8                                  30.2ms ± 1%    30.4ms ± 0%   +0.71%  (p=0.000 n=19+19)
LoadTree-8                                         540µs ± 1%     576µs ± 1%   +6.73%  (p=0.000 n=20+20)
LoadBlob-8                                        5.64ms ± 0%    5.64ms ± 0%     ~     (p=0.883 n=18+17)
LoadAndDecrypt-8                                  5.93ms ± 0%    5.95ms ± 1%     ~     (p=0.247 n=20+19)
LoadIndex-8                                       25.1ms ± 0%    24.5ms ± 1%   -2.54%  (p=0.000 n=18+17)

name                                            old speed      new speed      delta
PackerManager-8                                  296MB/s ± 0%   296MB/s ± 0%     ~     (p=0.229 n=20+20)
SaveAndEncrypt-8                                 139MB/s ± 1%   138MB/s ± 0%   -0.71%  (p=0.000 n=19+19)
LoadBlob-8                                       177MB/s ± 0%   177MB/s ± 0%     ~     (p=0.890 n=18+17)
LoadAndDecrypt-8                                 169MB/s ± 0%   168MB/s ± 1%     ~     (p=0.227 n=20+19)

name                                            old alloc/op   new alloc/op   delta
PackerManager-8                                   91.8kB ± 0%    91.8kB ± 0%     ~     (p=0.772 n=12+19)
IndexAlloc-8                                       786MB ± 0%     400MB ± 0%  -49.04%  (p=0.000 n=20+18)
IndexAllocParallel-8                               786MB ± 0%     401MB ± 0%  -49.04%  (p=0.000 n=19+15)
SaveAndEncrypt-8                                  21.0MB ± 0%    21.0MB ± 0%   +0.00%  (p=0.000 n=19+19)

name                                            old allocs/op  new allocs/op  delta
PackerManager-8                                    1.41k ± 0%     1.41k ± 0%     ~     (all equal)
IndexAlloc-8                                        977k ± 0%      907k ± 0%   -7.18%  (p=0.000 n=20+20)
IndexAllocParallel-8                                977k ± 0%      907k ± 0%   -7.17%  (p=0.000 n=19+15)
SaveAndEncrypt-8                                    73.0 ± 0%      73.0 ± 0%     ~     (all equal)
2020-07-19 13:58:22 +02:00
greatroar
255ba83c4b Parallel index benchmarks + benchmark optimizations
createRandomIndex was using the global RNG, which locks on every call
It was also using twice as many random numbers as necessary and doing
a float division in every iteration of the inner loop.

BenchmarkDecodeIndex was using too short an input, especially for a
parallel version. (It may now be using one that is a bit large.)

Results on linux/amd64, -benchtime=3s -count=20:

name                                     old time/op    new time/op       delta
PackerManager-8                             178ms ± 0%        178ms ± 0%           ~     (p=0.165 n=20+20)
DecodeIndex-8                              13.6µs ± 2%  4539886.8µs ± 0%  +33293901.38%  (p=0.000 n=20+18)
IndexHasUnknown-8                          44.4ns ± 7%       44.4ns ± 5%           ~     (p=0.873 n=20+19)
IndexHasKnown-8                            49.2ns ± 3%       48.3ns ± 0%         -1.86%  (p=0.000 n=20+16)
IndexAlloc-8                                802ms ± 1%        758ms ± 1%         -5.51%  (p=0.000 n=20+19)
MasterIndexLookupSingleIndex-8              124ns ± 1%        122ns ± 0%         -1.41%  (p=0.000 n=20+14)
MasterIndexLookupMultipleIndex-8            373ns ± 2%        369ns ± 2%         -1.13%  (p=0.001 n=20+20)
MasterIndexLookupSingleIndexUnknown-8      67.8ns ± 3%       68.4ns ± 5%           ~     (p=0.753 n=20+20)
MasterIndexLookupMultipleIndexUnknown-8     316ns ± 3%        315ns ± 3%           ~     (p=0.846 n=20+20)
SaveAndEncrypt-8                           30.5ms ± 1%       30.2ms ± 1%         -1.09%  (p=0.000 n=19+19)
LoadTree-8                                  527µs ± 1%        540µs ± 1%         +2.37%  (p=0.000 n=19+20)
LoadBlob-8                                 5.65ms ± 0%       5.64ms ± 0%         -0.21%  (p=0.000 n=19+18)
LoadAndDecrypt-8                           7.07ms ± 2%       5.93ms ± 0%        -16.15%  (p=0.000 n=19+20)
LoadIndex-8                                32.1ms ± 2%       25.1ms ± 0%        -21.64%  (p=0.000 n=20+18)

name                                     old speed      new speed         delta
PackerManager-8                           296MB/s ± 0%      296MB/s ± 0%           ~     (p=0.159 n=20+20)
SaveAndEncrypt-8                          138MB/s ± 1%      139MB/s ± 1%         +1.10%  (p=0.000 n=19+19)
LoadBlob-8                                177MB/s ± 0%      177MB/s ± 0%         +0.21%  (p=0.000 n=19+18)
LoadAndDecrypt-8                          141MB/s ± 2%      169MB/s ± 0%        +19.24%  (p=0.000 n=19+20)

name                                     old alloc/op   new alloc/op      delta
PackerManager-8                            91.8kB ± 0%       91.8kB ± 0%           ~     (p=0.826 n=19+12)
IndexAlloc-8                                786MB ± 0%        786MB ± 0%         +0.01%  (p=0.000 n=20+20)
SaveAndEncrypt-8                           21.0MB ± 0%       21.0MB ± 0%         -0.00%  (p=0.012 n=20+19)

name                                     old allocs/op  new allocs/op     delta
PackerManager-8                             1.41k ± 0%        1.41k ± 0%           ~     (all equal)
IndexAlloc-8                                 977k ± 0%         977k ± 0%         +0.01%  (p=0.022 n=20+20)
SaveAndEncrypt-8                             73.0 ± 0%         73.0 ± 0%           ~     (all equal)
2020-07-19 13:58:05 +02:00
MichaelEischer
7dc200c593 Merge pull request #2832 from alrs/fix-fuse-test-err
internal/fuse: fix dropped test error
2020-07-16 22:28:20 +02:00
Lars Lehtonen
9ac90cf5cd internal/fuse: fix dropped test error 2020-07-12 21:42:31 -07:00
MichaelEischer
b84f5177cb Merge pull request #2790 from greatroar/fix-quadratic-read
Fix quadratic file reading in restic mount
2020-07-12 18:42:14 +02:00
greatroar
4cf1c8e8da Changelog entry for subquadratic reading in mount 2020-07-12 18:27:16 +02:00
greatroar
58719e1f47 Replace mount's per-file cache by a global LRU cache 2020-07-12 18:27:16 +02:00
greatroar
d42c169458 Fix quadratic file reading in restic mount 2020-07-12 18:27:16 +02:00
rawtaz
8598bb042b Merge pull request #2769 from darkdragon-001/patch-1
Update documentation for environment variables
2020-07-12 00:40:21 +02:00
darkdragon-001
c6b74962df Update 040_backup.rst
Changes proposed in #2763:

- Adding `RESTIC_CACHE_DIR` environment variables (introduced in #2425 for Unix and #2607 for Mac, Win).
- Adding used system-wide environment variables with links to the corresponding section.
2020-07-12 00:31:56 +02:00
MichaelEischer
2c72924ffb Merge pull request #2813 from greatroar/encrypt-benchmark
Fix repository_test.BenchmarkSaveAndEncrypt
2020-07-05 17:52:10 +02:00
greatroar
02bec13ef2 Fix repository_test.BenchmarkSaveAndEncrypt
The benchmark was actually testing the speed of index lookups.

name              old time/op    new time/op        delta
SaveAndEncrypt-8     101ns ± 2%    31505824ns ± 1%    +31311591.31%  (p=0.000 n=10+10)

name              old speed      new speed          delta
SaveAndEncrypt-8  41.7TB/s ± 2%       0.0TB/s ± 1%         -100.00%  (p=0.000 n=10+10)

name              old alloc/op   new alloc/op       delta
SaveAndEncrypt-8     1.00B ± 0%  20989508.40B ± 0%  +2098950740.00%  (p=0.000 n=10+10)

name              old allocs/op  new allocs/op      delta
SaveAndEncrypt-8      0.00             123.00 ± 0%            +Inf%  (p=0.000 n=10+9)

(The actual speed is ca. 131MiB/s.)
2020-07-05 17:41:42 +02:00
MichaelEischer
64976b1a4d Merge pull request #2815 from scelfo/patch-1
--hostname flag is deprecated
2020-06-29 22:04:56 +02:00
Tony Scelfo
6a607d6ded --hostname flag is deprecated
Update documentation to follow the deprecation warning "Flag --hostname has been deprecated, use --host" that is given on the latest build(s).
2020-06-29 12:53:57 -06:00
rawtaz
6fedf1a7f4 Merge pull request #2809 from lessfoobar/patch-2
Update 080_examples.rst
2020-06-26 00:12:05 +02:00
@lessfoobar
df946fd9f8 Update 080_examples.rst 2020-06-26 00:01:30 +02:00
Jakub Wilk
4e6a9767de Fix examples of --verbose with argument 2020-06-23 20:22:14 +02:00
rawtaz
1bc80c3c8d Merge pull request #2802 from andreaso/cachedir-https-links
Use https:// for linking CACHEDIR.TAG specs
2020-06-21 20:01:42 +02:00
Andreas Olsson
0fcef2ec23 Use https:// for linking CACHEDIR.TAG specs
That site might not have supported https:// when those links were
originally added. It does now.

Also dropping the _spec.html_ ending of the url, there being a `<link
rel="canonical" ...>` tag suggesting that that no longer being the
preferred address.
2020-06-21 19:36:26 +02:00
MichaelEischer
212607dc8a Merge pull request #2760 from greatroar/backend-benchmark
Fix backend benchmarks + a micro-optimization
2020-06-17 23:17:05 +02:00
greatroar
190d8e2f51 Flatten backend.LimitedReadCloser structure
This inlines the io.LimitedReader into the LimitedReadCloser body to
achieve fewer allocations. Results on linux/amd64:

name                                      old time/op    new time/op    delta
Backend/BenchmarkLoadPartialFile-8           412µs ± 4%     413µs ± 4%    ~     (p=0.634 n=17+17)
Backend/BenchmarkLoadPartialFileOffset-8     455µs ±13%     441µs ±10%    ~     (p=0.072 n=20+18)

name                                      old speed      new speed      delta
Backend/BenchmarkLoadPartialFile-8        10.2GB/s ± 3%  10.2GB/s ± 4%    ~     (p=0.817 n=16+17)
Backend/BenchmarkLoadPartialFileOffset-8  9.25GB/s ±12%  9.54GB/s ± 9%    ~     (p=0.072 n=20+18)

name                                      old alloc/op   new alloc/op   delta
Backend/BenchmarkLoadPartialFile-8            888B ± 0%      872B ± 0%  -1.80%  (p=0.000 n=15+15)
Backend/BenchmarkLoadPartialFileOffset-8      888B ± 0%      872B ± 0%  -1.80%  (p=0.000 n=15+15)

name                                      old allocs/op  new allocs/op  delta
Backend/BenchmarkLoadPartialFile-8            18.0 ± 0%      17.0 ± 0%  -5.56%  (p=0.000 n=15+15)
Backend/BenchmarkLoadPartialFileOffset-8      18.0 ± 0%      17.0 ± 0%  -5.56%  (p=0.000 n=15+15)
2020-06-17 13:11:45 +02:00
greatroar
f4cd2a7120 Make backend benchmarks fairer by removing checks
Checking whether the right data is returned takes up half the time in
some benchmarks. Results for local backend benchmarks on linux/amd64:

name                                      old time/op    new time/op    delta
Backend/BenchmarkLoadFile-8                 4.89ms ± 0%    2.72ms ± 1%   -44.26%  (p=0.008 n=5+5)
Backend/BenchmarkLoadPartialFile-8           936µs ± 6%     439µs ±15%   -53.07%  (p=0.008 n=5+5)
Backend/BenchmarkLoadPartialFileOffset-8     940µs ± 1%     456µs ±10%   -51.50%  (p=0.008 n=5+5)
Backend/BenchmarkSave-8                     23.9ms ±14%    24.8ms ±41%      ~     (p=0.690 n=5+5)

name                                      old speed      new speed      delta
Backend/BenchmarkLoadFile-8               3.43GB/s ± 0%  6.16GB/s ± 1%   +79.40%  (p=0.008 n=5+5)
Backend/BenchmarkLoadPartialFile-8        4.48GB/s ± 6%  9.63GB/s ±14%  +114.78%  (p=0.008 n=5+5)
Backend/BenchmarkLoadPartialFileOffset-8  4.46GB/s ± 1%  9.22GB/s ±10%  +106.74%  (p=0.008 n=5+5)
Backend/BenchmarkSave-8                    706MB/s ±13%   698MB/s ±31%      ~     (p=0.690 n=5+5)
2020-06-17 13:11:45 +02:00
MichaelEischer
aba270df7e Merge pull request #2786 from aawsome/memory-list-blobs
Loop over index files for 'list blobs'
2020-06-15 22:27:29 +02:00
Alexander Weiss
b5543cff5d Loop over index files for 'list blobs'
=> reduces memory consumption a lot!
2020-06-14 17:25:34 +02:00
Alexander Neumann
285b5236c2 Merge pull request #2684 from MichaelEischer/cleanup-output
Cleanup command output code
2020-06-14 11:25:40 +02:00
Michael Eischer
bb1e258bb7 cat/stats: Get stdout from globalOptions 2020-06-14 11:08:11 +02:00
Michael Eischer
182655bc88 Replace fmt.Printf/Println/Fprintf with wrapper functions
cmd/restic/globals.go already provides Printf, Println and Warnf wrapper
which get their output streams from the globalOptions object. This
allows for stream replacements when testing.
2020-06-14 11:08:11 +02:00
MichaelEischer
74bc7141c1 Merge pull request #2781 from aawsome/reduce-index-memory
Reduce index memory
2020-06-14 10:58:28 +02:00
Alexander Weiss
1361341c58 don't save duplicate packIDs when using internal/repository/Index.Store 2020-06-14 07:56:24 +02:00
Alexander Weiss
ce4a2f4ca6 save packIDs and duplicates separately
A side remark to the definition of Index.blob:

Another possibility would have been to use:
blob       map[restic.BlobHandle]*indexEntry

This would have led to the following sizes:
key: 32 + 1 = 33 bytes
value: 8 bytes
indexEntry:  8 + 4 + 4 = 16 bytes
each packID: 32 bytes

To save N index entries, we would therefore have needed:
N * OF * (33 + 8) bytes + N * 16 + N * 32 bytes / BP = N * 82 bytes

More precicely, using a pointer instead of a direct entry is the better memory choice if:
OF * 8 bytes + entrysize < OF * entrysize <=> entrysize > 8 bytes * OF/(OF-1)
Under the assumption of OF=1.5, this means using pointers would have been the better choice
if sizeof(indexEntry) > 24 bytes.
2020-06-14 07:56:21 +02:00
Alexander Weiss
cf979e2b81 make offset and length uint32 2020-06-14 07:50:19 +02:00
Michael Eischer
d92e2c5769 simplify index code 2020-06-14 07:50:19 +02:00
Alexander Weiss
7419844885 add changelog, benchmark, memory calculation 2020-06-14 07:50:15 +02:00
rawtaz
1d66bb9e62 Merge pull request #2784 from MichaelEischer/minio-sha256-changelog
Add changelog for #2709
2020-06-13 18:33:54 +02:00
Michael Eischer
0b2c31b05b Add changelog for #2709 2020-06-13 18:13:36 +02:00
MichaelEischer
dd7b4f54f5 Merge pull request #2709 from greatroar/minio-sha256
Use Minio's optimized SHA-256
2020-06-12 23:32:58 +02:00
MichaelEischer
6896c6449b Merge pull request #2779 from greatroar/archiver-comment
Fix up comment on archiver.BlobSaver.Save
2020-06-12 23:04:21 +02:00
MichaelEischer
735a8074d5 Merge pull request #2773 from aawsome/index-uploads+knownblobs
Fix non-intuitive repo behavior
2020-06-12 22:41:04 +02:00
Alexander Weiss
70347e95d5 disable index uploads for prune command
+ modifications of changelog
2020-06-12 09:24:38 +02:00
greatroar
0fa3091c78 Fix up comment on archiver.BlobSaver.Save 2020-06-11 13:40:30 +02:00
Alexander Weiss
91906911b0 Fix non-intuitive repository behavior
- The SaveBlob method now checks for duplicates.
- Moves handling of pending blobs to MasterIndex.
  -> also cleans up pending index entries when they are saved in the index
  -> when using SaveBlob no need to care about index any longer
- Always check for full index and save it when storing packs.
  -> removes the need of an index uploader
  -> also removes the verbose "uploaded intermediate index" messages
- The Flush method now also saves the index
- Fix race condition when checking and saving full/non-finalized indexes
2020-06-11 13:05:23 +02:00
MichaelEischer
fae7f78057 Merge pull request #2755 from greatroar/solaris-workaround
Remove Solaris build workaround in integration tests
2020-06-10 23:30:51 +02:00
MichaelEischer
ac9ec4b990 Merge pull request #2778 from MichaelEischer/fix-unlock-hint
Revive hint to the unlock command if a repository is locked
2020-06-10 21:26:38 +02:00
Michael Eischer
087c770161 Revive hint to the unlock command if a repository is locked
errors.Fatalf wraps a error and just keeps an error message as a string.
This prevents the `restic.IsAlreadyLocked(err)` check from working as
the error is no longer an ErrAlreadyLocked.

Just add an additional remark to the error using `errors.WithMessage`.
2020-06-10 20:58:56 +02:00
MichaelEischer
6856d1e422 Merge pull request #2749 from aawsome/fix-fullindex
Change condition for full index
2020-06-10 20:40:19 +02:00
Alexander Weiss
8c1261ff02 changed condition for full index 2020-06-07 22:00:49 +02:00
rawtaz
26704be17f Merge pull request #2776 from nunoperalta/patch-1
Fix #2774 - make unable to umount message clearer
2020-06-07 17:19:50 +02:00
nunoperalta
2c3360db98 Fix #2774 - make unable to umount message clearer 2020-06-07 15:57:39 +01:00
MichaelEischer
cba6ad8d8e Merge pull request #2711 from greatroar/update-x-net
Update golang.org/x/net for fewer allocations in http2
2020-05-25 20:43:29 +02:00
greatroar
2a3312ac35 Remove Solaris build workaround in integration tests
This was introduced in #1821 because of issues with Go 1.9, but that
compiler version is no longer supported.
2020-05-25 10:33:36 +02:00
greatroar
c35c4e0cbf Update golang.org/x/net for fewer allocations in http2
name                                          old allocs/op  new allocs/op  delta
BackendREST/BenchmarkLoadFile-8                  2.15k ± 0%     2.14k ± 0%  -0.27%  (p=0.002 n=20+20)
BackendREST/BenchmarkLoadPartialFile-8             587 ± 0%       582 ± 0%  -0.88%  (p=0.000 n=20+20)
BackendREST/BenchmarkLoadPartialFileOffset-8       584 ± 0%       579 ± 0%  -0.90%  (p=0.000 n=19+16)

The throughput isn't significantly higher or lower.
2020-05-24 16:39:17 +02:00
MichaelEischer
84475aa3a8 Merge pull request #2730 from greatroar/mount-build-tags
Simplify build tags for restic mount
2020-05-23 20:33:43 +02:00
MichaelEischer
f12f9ae240 Merge pull request #2741 from tbm/typos
Fix typos
2020-05-21 23:40:12 +02:00
Martin Michlmayr
5cc1760fdf Fix typos 2020-05-16 14:05:26 +08:00
MichaelEischer
32ac5486e9 Merge pull request #2732 from restic/rawtaz-update-contributing
Reword parts of Providing Patches in CONTRIBUTING.md
2020-05-12 21:37:08 +02:00
rawtaz
c4336978eb Reword parts of Providing Patches in CONTRIBUTION.md
Primarily makes the request that contributors create a new branch for their changes stand out more.
2020-05-12 14:03:57 +02:00
greatroar
649cbec6c5 Simplify build tags for restic mount
This command can only be built on Darwin, FreeBSD and Linux
(and if we upgrade bazil.org/fuse, only FreeBSD and Linux:
https://github.com/bazil/fuse/issues/224).

Listing the few supported operating systems explicitly here makes
porting restic to new platforms easier.
2020-05-12 11:30:41 +02:00
MichaelEischer
b17bd7f860 Merge pull request #2719 from greatroar/update-x-crypto
Update x/crypto to stop poly1305 segfaulting on ARM
2020-05-09 00:02:18 +02:00
greatroar
68f1e9c524 Update x/crypto to fix poly1305 on ARM
The broken poly1305 implementation for arm64 was removed, fixing the
segfault issue on arm64 (gh-2618). The version for amd64 has improved
performance, which shows up in the internal/repository benchmark:

name              old speed      new speed      delta
SaveAndEncrypt-8   110MB/s ± 2%   113MB/s ± 1%  +2.24%  (p=0.000 n=20+20)
2020-05-05 11:05:35 +02:00
MichaelEischer
1ee2306033 Merge pull request #2717 from MichaelEischer/fix-flaky-password-prompt
backup: Avoid race between password prompt and open repository message
2020-05-01 23:58:55 +02:00
Michael Eischer
c882a92cd6 backup: Avoid race between password prompt and open repository message
`term.Print` sends the output via a channel to a goroutine which
actually prints the message. This may race with the password prompt
printed by `OpenRepository` resulting in a missing prompt.
2020-05-01 23:42:16 +02:00
MichaelEischer
f54db5d796 Merge pull request #2713 from greatroar/unused
Move Index.FindBlob to tests
2020-05-01 20:41:59 +02:00
MichaelEischer
843e7f404e Merge pull request #2716 from MichaelEischer/revert-apfs-test-workaround
Revert "Darwin test fix: allow 1μs timestamp difference"
2020-05-01 18:13:38 +02:00
Michael Eischer
d465b5b9ad Revert "Darwin test fix: allow 1μs timestamp difference"
This reverts commit f3016a9096.
2020-05-01 17:11:30 +02:00
greatroar
9f7cd69f13 Move Index.FindBlob to tests 2020-04-29 10:57:01 +02:00
greatroar
f97a680887 Fix repository benchmarks
BenchmarkLoad{AndDecrypt,Blob} were spending between 38% and 50% of
their time measuring SHA-256 performance in their checks.
2020-04-28 07:57:29 +02:00
greatroar
42a3db05b0 Use Minio's optimized SHA-256
internal/repository benchmarks on an Intel i7-3770k:

name               old speed      new speed       delta
PackerManager-8     209MB/s ± 1%    291MB/s ± 1%  +38.94%  (p=0.008 n=5+5)
SaveAndEncrypt-8    112MB/s ± 1%    135MB/s ± 1%  +20.25%  (p=0.008 n=5+5)
2020-04-28 07:57:18 +02:00
MichaelEischer
070d43e290 Merge pull request #2704 from azak-azkaran/patch-1
Update 030_preparing_a_new_repo.rst
2020-04-23 20:48:34 +02:00
MichaelEischer
d4bd32a37e Merge pull request #2640 from greatroar/simplify-loadblob-usage
Simplify Repository.LoadBlob usage
2020-04-23 20:23:35 +02:00
greatroar
e7d7b85d59 Merge Repository.{LoadBlob,loadBlob}
Pushing the allocation logic down into the former loadBlob body means
that fewer allocations have to be performed:

name              old time/op    new time/op    delta
LoadTree-8           478µs ± 1%     481µs ± 2%    ~     (p=0.315 n=9+10)
LoadBlob-8          11.6ms ± 1%    11.6ms ± 2%    ~     (p=0.393 n=10+10)
LoadAndDecrypt-8    13.3ms ± 3%    13.3ms ± 3%    ~     (p=0.905 n=10+9)
LoadIndex-8         33.6ms ± 2%    33.2ms ± 1%  -1.15%  (p=0.028 n=10+9)

name              old alloc/op   new alloc/op   delta
LoadTree-8          41.2kB ± 0%    41.1kB ± 0%  -0.23%  (p=0.000 n=10+10)
LoadBlob-8          2.28kB ± 0%    2.18kB ± 0%  -4.21%  (p=0.000 n=10+10)
LoadAndDecrypt-8    2.10MB ± 0%    2.10MB ± 0%    ~     (all equal)
LoadIndex-8         5.22MB ± 0%    5.22MB ± 0%    ~     (p=0.631 n=10+10)

name              old allocs/op  new allocs/op  delta
LoadTree-8             652 ± 0%       651 ± 0%  -0.15%  (p=0.000 n=10+10)
LoadBlob-8            24.0 ± 0%      23.0 ± 0%  -4.17%  (p=0.000 n=10+10)
LoadAndDecrypt-8      30.0 ± 0%      30.0 ± 0%    ~     (all equal)
LoadIndex-8          30.2k ± 0%     30.2k ± 0%    ~     (p=0.610 n=10+10)

name              old speed      new speed      delta
LoadBlob-8        86.4MB/s ± 1%  85.9MB/s ± 2%    ~     (p=0.393 n=10+10)
LoadAndDecrypt-8  75.4MB/s ± 3%  75.4MB/s ± 3%    ~     (p=0.858 n=10+9)
2020-04-23 10:04:20 +02:00
greatroar
be5a0ff59f Centralize buffer allocation and size checking in Repository.LoadBlob
Benchmark results for internal/repository:

name              old time/op    new time/op    delta
LoadTree-8           479µs ± 2%     478µs ± 1%   ~     (p=0.780 n=10+9)
LoadBlob-8          11.6ms ± 2%    11.6ms ± 1%   ~     (p=0.631 n=10+10)
LoadAndDecrypt-8    13.2ms ± 2%    13.3ms ± 3%   ~     (p=0.631 n=10+10)

name              old alloc/op   new alloc/op   delta
LoadTree-8          41.2kB ± 0%    41.2kB ± 0%   ~     (all equal)
LoadBlob-8          2.28kB ± 0%    2.28kB ± 0%   ~     (all equal)
LoadAndDecrypt-8    2.10MB ± 0%    2.10MB ± 0%   ~     (all equal)

name              old allocs/op  new allocs/op  delta
LoadTree-8             652 ± 0%       652 ± 0%   ~     (all equal)
LoadBlob-8            24.0 ± 0%      24.0 ± 0%   ~     (all equal)
LoadAndDecrypt-8      30.0 ± 0%      30.0 ± 0%   ~     (all equal)

name              old speed      new speed      delta
LoadBlob-8        86.2MB/s ± 2%  86.4MB/s ± 1%   ~     (p=0.594 n=10+10)
LoadAndDecrypt-8  75.7MB/s ± 2%  75.4MB/s ± 3%   ~     (p=0.617 n=10+10)
2020-04-23 10:04:20 +02:00
azak-azkaran
c5100d5632 Update 030_preparing_a_new_repo.rst
fixed markdown for wasabi region link
2020-04-23 09:24:19 +02:00
MichaelEischer
956a1b0f96 Merge pull request #2294 from BenWiederhake/debugsyms
build: Preserve debug symbols in debug build
2020-04-19 17:26:03 +02:00
Ben Wiederhake
fab626a3df build: Preserve debug symbols in debug and profile build
Signed-off-by: Ben Wiederhake <BenWiederhake.GitHub@gmx.de>
2020-04-19 14:48:40 +02:00
MichaelEischer
4f00564574 Merge pull request #2621 from greatroar/fixes
Some small fixes
2020-04-18 18:07:08 +02:00
MichaelEischer
f77477129f Merge pull request #2584 from greatroar/mount-cache-uid-gid
Cache uid and gid for top directories in internal/fuse
2020-04-18 17:45:14 +02:00
greatroar
2e31120f89 Remove unused argument to restic.fakeFile 2020-04-18 17:40:13 +02:00
greatroar
8fb2c0d3c1 Typo in crypto test name 2020-04-18 17:39:06 +02:00
greatroar
072cf7b02d Fix debug messages in internal/fuse 2020-04-18 17:39:06 +02:00
greatroar
df66daa5c9 Fix context usage in backend tests
Found by go vet. This is also the only complaint is has.
2020-04-18 17:39:06 +02:00
MichaelEischer
9790d8ce1c Merge pull request #2668 from MichaelEischer/fix-stats-blobs-crash
stats: Fix crash in blobs-per-file mode on missing blob
2020-04-18 17:21:26 +02:00
MichaelEischer
16710454f4 Merge pull request #2628 from MichaelEischer/one-element-pack-lists
cache: Don't sort one element pack lists
2020-04-18 17:09:06 +02:00
MichaelEischer
08ec6c9f17 Merge pull request #2677 from MichaelEischer/complain-about-invalid-indexes
rebuild_index: Report invalid packs that were ignored
2020-04-18 16:57:50 +02:00
MichaelEischer
7910ff4c0e Merge pull request #2648 from nairb774/iowritestring
termstatus: Use io.WriteString to output messages.
2020-04-18 13:48:42 +02:00
MichaelEischer
c4da9d1e90 Merge pull request #2638 from greatroar/no-close-in-packer
Don't Close in Packer.Finalize
2020-04-18 13:07:21 +02:00
rawtaz
3ed61987a2 Merge pull request #2695 from restic/rawtaz-doc-exclude-file-tilde
doc: Add note on tilde expansion in exclude files
2020-04-18 13:01:17 +02:00
rawtaz
9dba7a2577 doc: Add note on tilde expansion in exclude files
Explains to the reader that tilde expansion does not work in exclude files, and that they should instead use the $HOME variable.
2020-04-18 12:47:47 +02:00
MichaelEischer
a1352906e2 Merge pull request #2622 from greatroar/optimize-packer-manager
Fix PackerManager benchmark and optimize hashing.Writer
2020-04-18 12:46:34 +02:00
MichaelEischer
b7c0d4d8bf Merge pull request #2644 from greatroar/signal-notify-buffered
Make all signal.Notify channels buffered
2020-04-18 11:31:02 +02:00
MichaelEischer
f033850aa0 Merge pull request #2692 from MichaelEischer/fix-archiveraborttest
archiver: Fix race condition triggered by TestArchiverAbortEarlyOnError
2020-04-13 18:36:48 +02:00
Michael Eischer
bdf7ba20cb archiver: Fix race condition triggered by TestArchiverAbortEarlyOnError
The Save methods of the BlobSaver, FileSaver and TreeSaver return early
on when the archiver is stopped due to an error. For that they select on
both the tomb.Dying() and context.Done() channels, which can lead to a
race condition when the tomb is killed due to an error: The tomb first
closes its Dying channel before canceling all child contexts.
Archiver.SaveDir only aborts its execution once the context was
canceled. When the tomb killing is paused between closing its Dying
channel and canceling the child contexts, this lets the
FileSaver/TreeSaver.Save methods return immediately, however, ScanDir
still reads further files causing the test case to fail.

As a killed tomb always cancels all child contexts and as the Savers
always use a context bound to the tomb, it is sufficient to just use
context.Done() as escape hatch in the Save functions. This fixes the
mismatch between SaveDir and Save.

Adjust the tests to use contexts bound to the tomb for all interactions
with the Savers.
2020-04-13 18:23:17 +02:00
rawtaz
3ee6b8ec63 Merge pull request #2689 from MichaelEischer/fix-background-hang
Fix shutdown hang when restic is started as background job
2020-04-12 22:39:44 +02:00
Michael Eischer
4a400f94bb Add changelog 2020-04-12 22:27:09 +02:00
Michael Eischer
1a1c572bac Fix shutdown hang when restic is started as background job
restic uses a cleanup hook to ensure that it restores the terminal
configuration to a sane state, when restic is interrupted while reading
a password from the terminal. However, this causes a problem, when
restic runs in a background job, as reconfiguring a terminal will cause
a SIGTTOU to be sent to restic pausing it. Therefore, restic seems to
hang on shutdown when it was running in the background.

This commit changes the behavior to only restore the terminal
configuration if restic was interrupted while reading a password from
the terminal. As reading a password from the terminal requires that
restic is in the foreground, this should avoid restic getting stopped.

Fixes #2298
Issue introduced in #402
2020-04-12 22:27:09 +02:00
rawtaz
5a7c27ddb6 Merge pull request #2681 from MichaelEischer/optimize-debug
Reduce memory usage and startup time of debug command
2020-04-04 00:08:14 +02:00
Michael Eischer
fb842759fc debug: don't load the repository index
The existing commands don't need a loaded repository index which can
take several minutes to load on larger repositories.
2020-04-04 00:01:01 +02:00
Michael Eischer
7aa2f8a61e debug: get stdout/stderr from gopts/globalOptions 2020-04-04 00:01:01 +02:00
Michael Eischer
08bf3bae79 debug: explicitly pass stdout to dump functions 2020-04-03 23:32:44 +02:00
rawtaz
e7b741b2d7 Merge pull request #2682 from MichaelEischer/cleanup-cli-paramter-names
Cleanup CLI parameter names for backup / global flags
2020-04-03 21:35:34 +02:00
Michael Eischer
6bee62e346 Update doc excerpts for --help
This adds some previously missing changes and the new paramters names
from the previous commit.
2020-04-03 19:49:06 +02:00
Michael Eischer
bc74cd3ae5 backup/global: Use proper name for command line argument parameters
Several paramters printed a generic "string" or "stringArray" name.
2020-04-03 19:49:04 +02:00
Michael Eischer
90243ed1c4 rebuild_index: Report invalid packs that were ignored 2020-04-02 22:38:31 +02:00
Michael Eischer
0ce81d88b6 stats: Fix crash in blobs-per-file mode on missing blob
In a damaged repository with a missing blob, the error message tried to
dereference the subtreeID field of the current node, which is a file
however. Said field is set to nil for a file thus causing a segfault
when dereferenced.

Fix this by using the actual parentTreeID.
2020-03-27 22:17:54 +01:00
rawtaz
c03bc88b29 Merge pull request #2669 from MichaelEischer/doc-cifs-linux-bug
doc: Warn about compatibility issues with CIFS and restic
2020-03-26 23:01:06 +01:00
Brian Atkinson
b8da7b1f4d termstatus: Use io.WriteString to output messages.
The previous implementation was repeating the implementation that is
found inside of io.WriteString. Simplify by making use of the stdlib's
implementation.
2020-03-26 14:55:00 -07:00
Michael Eischer
f1b4d97945 doc: Warn about compatibility issues with CIFS and restic
On Linux CIFS (SMB) seems to be incompatible with the async preemption
implementation of Go 1.14. CIFS seems not to restart syscalls (open,
read, chmod, readdir, ...) as expected by Go, which sets SA_RESTART for
its signal handler to have syscalls restarted automatically. This leads
to Go passing up lots of EINTR return codes to restic.

See https://github.com/restic/restic/issues/2659 for a detailed explanation.
2020-03-26 21:52:37 +01:00
Peter Schultz
90fc639a67 Allow specifying user and host when adding keys
The username and hostname for new keys can be specified with the new
--user and --host flags, respectively. The flags are used only by the
`key add` command and are otherwise ignored.

This allows adding keys with for a desired user and host without having
to run restic as that particular user on that particular host, making
automated key management easier.

Co-authored-by: James TD Smith <ahktenzero@mohorovi.cc>
2020-03-23 13:11:10 +01:00
rawtaz
2b5a6d255a Merge pull request #2660 from restic/rawtaz-delete-old-issue-template
Delete ISSUE_TEMPLATE.md (not used anymore)
2020-03-21 20:48:39 +01:00
rawtaz
f004dbe605 Delete ISSUE_TEMPLATE.md (not used anymore)
Nowadays the ISSUE_TEMPLATE/ directory and its files are used for this feature.
2020-03-21 20:30:19 +01:00
rawtaz
9efbe98879 Merge pull request #2623 from alrs/internal-restic-err-before-close
internal/restic: close os.File after checking for error
2020-03-18 22:23:20 +01:00
rawtaz
7d9300efca Merge pull request #2637 from greatroar/unused
Remove Go 1.5 compatibility code
2020-03-18 22:22:15 +01:00
rawtaz
c38aaaa768 Merge pull request #2652 from greatroar/upgrade-fuse
Upgrade bazil.org/fuse and remove restic mount --allow-root
2020-03-18 22:21:50 +01:00
greatroar
8941041355 Upgrade bazil.org/fuse to version that fixes FreeBSD opBmap bug 2020-03-18 10:00:39 +01:00
greatroar
18fee4806f Remove broken --allow-root from restic mount 2020-03-17 23:35:06 +01:00
greatroar
47d4d5bf1b Make all signal.Notify channels buffered 2020-03-12 20:59:39 +01:00
greatroar
74a64c47e4 Move testing logic to test file in internal/pack 2020-03-09 14:32:28 +01:00
greatroar
a23e9c86ba Remove closing logic from Packer.Finalize
The method only ever receives *hashing.Writers, which don't implement
io.Closer. These come from packerManager.findPacker and have their
actual writers closed in Repository.savePacker. Moving the closing logic
to hashing.Writer results in "file already closed" errors.
2020-03-09 14:31:45 +01:00
greatroar
4de12bf593 Remove restic.RandReader
math/rand.Rand has implemented Reader since Go 1.6. The repacking tests
are not deterministic, but they weren't before, either.
2020-03-09 10:00:28 +01:00
rawtaz
c542a509f0 Merge pull request #2633 from greatroar/fix-ssh-commandline
Revert "Put host last in SSH command line"
2020-03-08 17:29:41 +01:00
greatroar
8cf3bb8737 Revert "Put host last in SSH command line"
This reverts commit e1969d1e33.
2020-03-08 16:45:33 +01:00
Michael Eischer
b46cc6d57e repository: Don't sort one element pack lists
When loading a blob, restic first looks up pack files containing the
blob. To avoid unnecessary work an already cached pack file is preferred.
However, if there is only a single pack file to choose from (which is
the normal case) sorting the one-element list won't change anything.
Therefore avoid the unnecessary cache check in that case.
2020-03-07 10:26:06 +01:00
Lars Lehtonen
4a2156d3f0 internal/restic: close os.File after checking for error 2020-03-05 16:22:46 -08:00
greatroar
41fee11f66 Micro-optimization for hashing.Writer/PackerManager
name             old time/op    new time/op    delta
PackerManager-8     247ms ± 1%     246ms ± 1%  -0.43%  (p=0.001 n=18+18)

name             old speed      new speed      delta
PackerManager-8   213MB/s ± 1%   214MB/s ± 1%  +0.43%  (p=0.001 n=18+18)

name             old alloc/op   new alloc/op   delta
PackerManager-8    92.2kB ± 0%    91.5kB ± 0%  -0.82%  (p=0.000 n=19+20)

name             old allocs/op  new allocs/op  delta
PackerManager-8     1.43k ± 0%     1.41k ± 0%  -1.67%  (p=0.000 n=20+20)
2020-03-05 22:30:04 +01:00
greatroar
b592614061 Improve PackerManager benchmark
The previous benchmark spent much of its time allocating RNGs and
generating too many random numbers. It now spends 90% of its time
hashing and half of the rest writing to files.

name             old time/op    new time/op    delta
PackerManager-8     319ms ± 1%     247ms ± 1%  -22.48%  (p=0.000 n=20+18)

name             old speed      new speed      delta
PackerManager-8   143MB/s ± 1%   213MB/s ± 1%  +48.63%  (p=0.000 n=10+18)

name             old alloc/op   new alloc/op   delta
PackerManager-8     635kB ± 0%      92kB ± 0%  -85.48%  (p=0.000 n=10+19)

name             old allocs/op  new allocs/op  delta
PackerManager-8     1.64k ± 0%     1.43k ± 0%  -12.76%  (p=0.000 n=10+20)
2020-03-05 22:30:03 +01:00
greatroar
b7c3039eb2 Remove Go 1.5 compatibility code from PackerManager benchmark
This alone is enough to speed up the benchmark by ~10%.
2020-03-05 22:29:06 +01:00
Alexander Neumann
a307797c11 Merge pull request #2612 from restic/rawtaz-maintainer-pr
Add notes about maintainer edit access in PRs
2020-03-01 21:24:34 +01:00
rawtaz
a03f107144 Add note about allowing maintainers edits in PRs. 2020-03-01 21:12:11 +01:00
rawtaz
a141ab1bda Add maintaner edit checkbox to PR template 2020-03-01 21:05:52 +01:00
Alexander Neumann
52abec967f Merge pull request #2605 from middelink/fix-2604
Fix running tests on a SELinux enabled system
2020-03-01 20:25:28 +01:00
Pauline Middelink
2828a9c2b0 Fix running tests on a SELinux enabled system
Archivers TestMetadataChanged incorrectly clears the Extended Attributes
from the expected metadata of the temporary file. This is incorrect as on
SELinux enabled filesystem, as the kernel will automaticly add a SElinux
label. However, since ExtendedAttributes{} != ExtendedAttributes{nil} we
still need to clear them if there are no attributes found.
2020-03-01 20:23:22 +01:00
rawtaz
cec7d581f3 Merge pull request #2610 from restic/remove-vendor
Remove vendored dependencies
2020-03-01 20:22:45 +01:00
Alexander Neumann
12aa1e61da CI: Enable Go Module Proxy 2020-03-01 19:58:20 +01:00
Alexander Neumann
95da6c1c1d Merge pull request #2589 from greatroar/no-stable-sort
Replace sort.Stable by sort.Strings
2020-03-01 19:40:28 +01:00
Alexander Neumann
0c03a80fc4 Merge pull request #2592 from greatroar/sftp-ipv6
Support IPv6 in SFTP backend
2020-03-01 19:38:44 +01:00
Alexander Neumann
b1c77172c2 Add entry to changelog 2020-03-01 19:32:35 +01:00
Alexander Neumann
c0373cd307 Remove -mod=vendor from all documentation and code 2020-03-01 19:32:35 +01:00
Alexander Neumann
28121090c2 Remove vendor from CI tests 2020-03-01 19:32:35 +01:00
Alexander Neumann
44a57d66c3 Remove vendor from build scripts 2020-03-01 11:30:02 +01:00
Alexander Neumann
266f9dbe16 Remove vendor dir 2020-03-01 11:20:42 +01:00
greatroar
60e4a88f17 Changelog entry for SFTP w/ IPv6 addresses 2020-03-01 11:04:06 +01:00
Alexander Neumann
c50f91b7f9 Merge pull request #2602 from greatroar/no-bufpool
Remove sync.Pool from internal/repository
2020-03-01 10:50:57 +01:00
Alexander Neumann
e851d29565 Merge pull request #2608 from greatroar/simplify-termstatus
Simplify termstatus
2020-03-01 10:48:29 +01:00
Alexander Neumann
b67b7ebfe6 Merge pull request #2583 from greatroar/unused
Remove some unused or duplicated code
2020-03-01 10:46:17 +01:00
greatroar
751eba0e68 Remove unnecessary pipe checks in termstatus
canUpdateStatus has already determined that the file descriptor is not a
pipe.
2020-02-29 18:03:49 +01:00
greatroar
7447c44484 Use golang.org/x/sys/windows in termstatus
Some functionality is missing, but at least the types are all defined.
Replaced short, word, dword by their Go names to match the x/sys
convention.
2020-02-29 18:03:49 +01:00
greatroar
c8a672fa29 Remove code copy-pasted from x/crypto/ssh/terminal 2020-02-29 18:03:49 +01:00
greatroar
863ba76494 Drop mattn/go-isatty in favor of crypto/ssh/terminal 2020-02-29 18:03:47 +01:00
greatroar
8526cc6647 Remove sync.Pool from internal/repository
The pool was used improperly, causing more allocations to be
performed than without it.

name              old time/op    new time/op    delta
SaveAndEncrypt-8    36.8ms ± 2%    36.9ms ± 2%    ~     (p=0.218 n=10+10)

name              old speed      new speed      delta
SaveAndEncrypt-8   114MB/s ± 2%   114MB/s ± 2%    ~     (p=0.218 n=10+10)

name              old alloc/op   new alloc/op   delta
SaveAndEncrypt-8    21.1MB ± 0%    21.0MB ± 0%  -0.44%  (p=0.000 n=10+10)

name              old allocs/op  new allocs/op  delta
SaveAndEncrypt-8      79.0 ± 0%      77.0 ± 0%  -2.53%  (p=0.000 n=10+10)
2020-02-29 17:54:46 +01:00
rawtaz
694b7a17e7 Merge pull request #2607 from greatroar/cachedir
Honor RESTIC_CACHE_DIR on Mac and Windows
2020-02-28 20:41:32 +01:00
greatroar
5cd0bce452 Honor RESTIC_CACHE_DIR on Mac and Windows 2020-02-28 15:44:32 +01:00
rawtaz
58bd165253 Merge pull request #2581 from aawsome/multiple-hostnames
Allow multiple hostnames tags
2020-02-27 08:35:23 +01:00
rawtaz
65d3fb6b33 Merge pull request #2603 from greatroar/restorer-waitgroup
Fix unsafe sync.WaitGroup usage in restorer.fileRestorer
2020-02-27 00:30:59 +01:00
rawtaz
f165048172 Merge pull request #2582 from greatroar/no-go1.9
Remove Go 1.9 compatibility code
2020-02-27 00:15:06 +01:00
greatroar
de5516a90e Fix sync.WaitGroup usage in restorer.fileRestorer 2020-02-27 00:07:49 +01:00
greatroar
4f6fd9fb98 Remove remnant of Go 1.9 compatibility code from tests 2020-02-26 22:23:38 +01:00
Alexander Weiss
9a9101d144 Support specifying multiple host flags for various commands
The `dump`, `find`, `forget`, `ls`, `mount`, `restore`, `snapshots`,
`stats` and `tag` commands will now take into account multiple
`--host` and `-H` flags.
2020-02-26 22:17:59 +01:00
rawtaz
616f9499ae Merge pull request #2600 from restic/update-go
Update Go version to >= 1.11, add Go 1.14
2020-02-26 21:29:30 +01:00
Alexander Neumann
a40ac37550 Add changelog file 2020-02-26 20:55:12 +01:00
Alexander Neumann
99fd80a585 Remove all workarounds for Go < 1.11 2020-02-26 20:35:13 +01:00
Alexander Neumann
2464f7c4d1 Update Go versions, drop Go 1.10 2020-02-26 20:35:13 +01:00
rawtaz
b5c7778428 Merge pull request #2195 from ifedorenko/out-of-order-restore-no-progress
restorer: allow writing target file blobs out of order
2020-02-26 20:07:51 +01:00
Igor Fedorenko
c52198d12c restorer: go mod vendor; go mod tidy
Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>
2020-02-26 16:15:04 +01:00
Igor Fedorenko
f17ffa0283 restorer: Allow writing target file blobs out of order
Much simpler implementation that guarantees each required pack
is downloaded only once (and hence does not need to manage
pack cache). Also improves large file restore performance.

Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>
2020-02-26 16:14:45 +01:00
greatroar
5e2afd91e7 Assert that archiver.Tree implements fmt.Stringer 2020-02-26 11:05:38 +01:00
greatroar
79b882e901 Merge duplicated readdir functionality
internal/archiver.readdir and internal/fs.ReadDir were unused.

internal/fs.ReadDirNames and internal/archiver.readdirnames were doing
nearly the same thing, except one sorted its output and opened with
fs.O_NOFOLLOW. Both were only used in internal/archiver.
2020-02-26 11:05:38 +01:00
greatroar
1b502fa9ef Cache uid and gid for top directories in internal/fuse 2020-02-24 10:46:09 +01:00
greatroar
e1969d1e33 Put host last in SSH command line
This is how the SSH manpage says the command line should look, and the
"--" prevents mistakes in hostnames from being interpreted as options.
2020-02-19 15:53:20 +01:00
greatroar
6ac6bca7a1 Support IPv6 in SFTP backend
The previous code was doing its own hostname:port splitting, which
caused IPv6 addresses to be misinterpreted.
2020-02-19 15:42:12 +01:00
greatroar
3a6feb0596 Replace sort.Stable by sort.Strings
Calling the slow, O(n lg² n) sort.Stable is equivalent to sort.Strings
for a slice of unique strings.
2020-02-18 19:41:06 +01:00
greatroar
2f8aa2ce30 Remove unused fs.FS from archiver.FileSaver 2020-02-18 10:39:14 +01:00
rawtaz
f2bf06a419 Merge pull request #2540 from dp-github/issue-2531
Count hard-linked files correctly in stats command
2020-02-15 21:06:46 +01:00
David Potter
71900248ab Correct #2531 (stats restore-size calculates hard links incorrectly) 2020-02-15 19:34:22 +01:00
David Potter
23055aaadf Correct #2537 (cmd_stats file counting issue) 2020-02-15 19:34:16 +01:00
rawtaz
8bf6a3af97 Merge pull request #2285 from curiousleo/bugfix/2281-json-output
Fix JSON Printf issues with format verbs
2020-02-15 02:00:57 +01:00
curiousleo
27d6e5e186 Add changelog file. 2020-02-15 01:32:43 +01:00
curiousleo
4214b1746e Ensure Print{,f,ln} use global stdout 2020-02-15 01:32:43 +01:00
curiousleo
f6f240573a Don't Printf already formatted output
Fixes #2281.
2020-02-15 01:32:43 +01:00
rawtaz
ecdf49679e Merge pull request #2579 from MichaelEischer/fix-flaky-archiver-test
Fix flaky TestArchiverAbortEarlyOnError
2020-02-15 01:29:37 +01:00
Michael Eischer
e1f722d266 archiver: Fix flaky TestArchiverAbortEarlyOnError
Each of the random test files was split into the same five blobs. The
test fails once the fifth blob is passed on to `SaveBlob`. That is for
certain interleavings of goroutine execution it would be possible for
the test to trigger the testErr just after storing the first file.

The fixed test uses a different file content for each of the nine files
and fails after writing the fourth blob. The file content is also small
enough to ensure that for each file only a single blob is saved. This
guarantees that the test cannot fail before reading the first four
files. FileReadConcurrency = 2 allows up to two files queued for
processing. Therefore the test can at most open the sixth file before it
has to save the fourth file / blob which triggers the testErr.
2020-02-14 23:16:13 +01:00
rawtaz
2d47381b1d Merge pull request #2545 from MichaelEischer/fix-racy-backup-json
Fix racy json output for backup command
2020-02-13 22:33:17 +01:00
Michael Eischer
294ca55967 Add changelog entry 2020-02-13 21:14:20 +01:00
Michael Eischer
78c518ccac Print backup summary after status output is shutdown 2020-02-13 21:14:20 +01:00
Michael Eischer
42a3292bcf Better name for jsonstatus package
internal/ui/jsonstatus and termstatus sound similar but are not related
in any way. Instead `internal/ui/backup` and `internal/ui/jsonstatus/status`
are the counterparts. Rename the latter to `internal/ui/json/backup` to
make this clear.
2020-02-13 21:14:20 +01:00
Michael Eischer
ef70a2fcb3 Fix mangled JSON output by backup command
jsonstatus wrote the JSON output without synchronization to the
stdio_wrapper which caused mangling between different status lines.

Use the Print and Error methods of termstatus instead which use a
central goroutine to synchronize output.
2020-02-13 21:14:20 +01:00
rawtaz
af20015725 Merge pull request #2287 from benchti/patch-1
doc: Correct parameter order in dump example
2020-02-13 01:54:10 +01:00
rawtaz
680a14afa1 Merge pull request #2530 from restic/fix-sftp-mkdirall
sftp: Use MkdirAll provided by the client
2020-02-13 01:12:59 +01:00
rawtaz
bf199e5ca7 Minor speling corection. 2020-02-13 00:47:09 +01:00
rawtaz
ae127a412d Merge pull request #2337 from rfjakob/favicon
docs: switch to gopher favicon
2020-02-13 00:14:33 +01:00
Jakob Unterwurzacher
5ae7e6f945 docs: switch to gopher favicon
The favicon on restic.readthedocs.io still contained the old
superman-style logo.

This changes it to the 32x32 gopher icon also used on https://forum.restic.net/ ,
just converted to .ico using Gimp.

Tested by building the documentation and opening index.html in Chrome.
The new favicon looks fine.
2020-02-13 00:09:37 +01:00
rawtaz
d8da9c4401 Merge pull request #2577 from alrs/fix-internal-errs
internal: Fix code and test dropped errors
2020-02-12 23:41:54 +01:00
rawtaz
daf3bfc882 Merge pull request #2461 from rigtorp/man-exit-status
Add documentation on exit status codes to man pages
2020-02-12 23:17:49 +01:00
Erik Rigtorp
94f4f13388 Add documentation on exit status codes to man pages
This is step one to start defining useful exit codes for all the commands.
2020-02-12 23:09:26 +01:00
rawtaz
4615bdfd70 Merge pull request #2576 from restic/update-chunker
Update the chunker
2020-02-12 22:41:36 +01:00
rawtaz
299f5971f2 Merge pull request #2560 from brualan/master
Two small improvements to code quality
2020-02-12 22:40:20 +01:00
rawtaz
7a1352ae87 Merge pull request #2570 from MichaelEischer/close-file-on-type-change
Close file if file type has changed after initial stat
2020-02-12 22:39:22 +01:00
Lars Lehtonen
72734d59b5 internal/archiver: fix dropped error 2020-02-12 13:37:37 -08:00
rawtaz
3679669aae Merge pull request #2574 from alrs/fix-dropped-cmd-err
cmd/restic: fix dropped error
2020-02-12 22:36:45 +01:00
Lars Lehtonen
3ed54e762e internal/backend/sftp: fix dropped test error 2020-02-12 13:36:21 -08:00
Lars Lehtonen
fea835b4e2 internal/repository: fix dropped test error 2020-02-12 13:33:54 -08:00
Lars Lehtonen
16b321b140 internal/restic: fix dropped test error 2020-02-12 13:32:45 -08:00
Alexander Neumann
b58dfda212 Add entry to changelog 2020-02-12 21:29:26 +01:00
Alexander Neumann
b229aa5cf1 Update the chunker 2020-02-12 21:29:26 +01:00
Alexander Neumann
81c0b031f9 Add link to the forum in 'new issue' dialog 2020-02-12 21:25:48 +01:00
Michael Eischer
760863e7f9 archiver: Fix TestRacyFileSwap on windows 2020-02-11 21:09:47 +01:00
Michael Eischer
a135699397 Close file if file type has changed after initial stat 2020-02-11 21:09:47 +01:00
Lars Lehtonen
94a4d45dfb cmd/restic: fix a dropped error 2020-02-11 09:19:03 -08:00
rawtaz
4de384087d Merge pull request #2575 from alrs/fix-travis
restic/internal/ui: fix gofmt nit that popped up in Go 1.13
2020-02-11 13:49:13 +01:00
Lars Lehtonen
57815d9cd6 restic/internal/ui: fix gofmt nit that popped up in Go 1.13 2020-02-10 11:06:47 -08:00
rawtaz
644673bcf2 Merge pull request #2573 from dhoffend/fix-processed-bytes
fix backup --json total_bytes_processed output
2020-02-10 13:35:55 +01:00
Daniel Hoffend
e7cdf2acbb fix backup --json total_bytes_processed output
Closes #2429
2020-02-09 02:02:45 +01:00
rawtaz
0f22f008ed Merge pull request #2552 from iambryancs/update-to-go1.13
Update Go version to 1.13.6 in Docker build script
2020-02-07 15:24:37 +01:00
rawtaz
c184da21d0 Merge pull request #2568 from flofeld/patch-1
corrected option s3.storage-class in documentation
2020-02-06 23:34:36 +01:00
Florian Feldmann
ef5efc6a82 corrected option s3.storage-class
Took me some time to figure it out
2020-02-06 22:53:47 +01:00
Alexander Bruyako
688014487b avoid "index out of range" error
in case of len(format) == 0, we will get an
"index out of range" error
Usage of strings.HasSuffix is allowing to avoid that
2020-01-27 19:24:42 +03:00
Alexander Bruyako
38ddfbc4d3 simpler error return 2020-01-27 18:41:46 +03:00
Alexander Bruyako
da48b925ff remove unnecessary error return
I was running "golangci-lint" and found this two warnings

internal/checker/checker.go:135:18: (*Checker).LoadIndex$3 - result 0 (error) is always nil (unparam)
        final := func() error {
                        ^
internal/repository/repository.go:457:18: (*Repository).LoadIndex$3 - result 0 (error) is always nil (unparam)
        final := func() error {
                        ^

It turns out that these functions are used only in "RunWorkers(...)",
which is used only two times in whole project right after this "final"
functions.
And because these "final" functions always return "nil", I've
descided, that it would be better to remove requriments for "final" func
to return error to avoid magick "return nil" at their end.
2020-01-27 18:28:21 +03:00
iambryancs
4bcd56fbae Update Go version to 1.13.6 in Docker build script 2020-01-17 02:13:11 +08:00
Alexander Neumann
6e9778ae0e Add changelog file 2020-01-06 21:46:22 +01:00
Alexander Neumann
63c67be908 Add hint abouth absolute sftp paths for Synology NAS 2020-01-06 21:37:57 +01:00
rawtaz
d70a4a9350 Merge pull request #2373 from vrusinov/issue-2372
Ignore username difference in TestMetadataChanged
2020-01-05 21:07:34 +01:00
Alexander Neumann
2cd9c7ef16 sftp: Use MkdirAll provided by the client
Closes #2518
2020-01-01 17:26:38 +01:00
Alexander Neumann
6ec5dc8016 Fix template for new version of calens
The `wrap` function has been renamed to `wrapIndent`
2020-01-01 11:58:21 +01:00
rawtaz
fe430a680a Merge pull request #2524 from cure/patch-1
Fix typos in documentation of FixTime
2019-12-22 16:36:23 +01:00
Ward Vandewege
69a0d0ee90 fix typos 2019-12-21 21:00:28 -05:00
rawtaz
4557881066 Merge pull request #2423 from streambinder/master
sftp: support user@domain parsing as user
2019-12-19 22:39:36 +01:00
streambinder
9b5d069ade doc: 030: sfpt: hint for domain-confined users 2019-12-19 13:15:37 +01:00
streambinder
c56cbfe95b changelog: add pull-2423 2019-12-19 13:15:37 +01:00
streambinder
97e5ce4344 internal: backend: sftp: support user@domain parsing as user 2019-12-19 13:15:37 +01:00
rawtaz
72bd467e23 Merge pull request #2271 from lorenzbausch/feature/find_timestamp
Display snapshot date when using `restic find`
2019-12-17 10:35:59 +01:00
Lorenz Bausch
d818b7618b Display respective snapshot date when using restic find 2019-12-17 07:51:12 +01:00
Matt Holt
1c3812a6f6 Merge pull request #2342 from rpsene/master
Add support for ppc64le
2019-12-16 11:50:52 -07:00
Rafael Peria de Sene
ec91b80f09 Add support for ppc64le
This commit adds support for cross-compiling Restic for ppc64le
as part of the release process.

Add a new file:   changelog/unreleased/issue-2277
Modifies:   helpers/build-release-binaries/main.go
Modifies:   run_integration_tests.go
2019-12-15 22:52:13 -03:00
rawtaz
18a336c154 Merge pull request #2510 from rawtaz/kastenhq-changelog-2390
Add changelog for #2390.
2019-12-10 23:31:20 +01:00
Eric Hamilton
d21a13f1ee Create issue-2390 2019-12-10 23:20:18 +01:00
rawtaz
e0eac30ee5 Merge pull request #2509 from restic/improve-check-docs
doc: Improve check documentation
2019-12-10 23:07:23 +01:00
rawtaz
fccb579471 doc: Improve check documentation
Make it clearer what the difference is between regular check and check with --read-data.
2019-12-10 21:15:59 +01:00
Alexander Neumann
6c700f95b5 Merge pull request #2358 from filippobottega/master 2019-11-29 20:27:30 +01:00
Filippo Bottega
95d070c147 FAQ: Add hint for antivirus setup
Add a tip to configure antivirus to exclude restic process.
2019-11-29 20:26:20 +01:00
rawtaz
da4473aba6 Merge pull request #2391 from kastenhq/refresh-lock-time
Update Lock.Time in lock.Refresh()
2019-11-26 21:44:29 +01:00
rawtaz
6e85a58045 Merge pull request #2465 from whs-dot-hk/fix-test-metadata-changed
Fix test metadata changed
2019-11-26 21:42:42 +01:00
rawtaz
476e2e8762 Merge pull request #2354 from HugoReeves/master
Doc Addition: Wasabi repo setup instructions
2019-11-25 13:56:49 +01:00
Alexander Neumann
246bb46e82 Correct CHANEGLOG.md 2019-11-24 15:18:25 +01:00
Alexander Neumann
fe0361ffcb Move changelog entry for #2179
For background on how this happened see
https://forum.restic.net/t/psa-attention-anyone-not-using-a-recent-master-ie-0-9-5-version-restic-will-not-detect-changed-files-if-mtime-is-reset-by-the-application-eg-ms-excel-and-xls-xlsx-files-on-macos/1772/8?u=fd0
2019-11-24 15:15:19 +01:00
rawtaz
952469473f Merge pull request #2486 from rawtaz/changelog-gitkeep
changelog: Add .gitkeep to persist unreleased/ folder
2019-11-24 14:59:39 +01:00
rawtaz
02108f202e Merge pull request #2487 from rawtaz/2469-fix-diff-stats
diff: Fix wrong bytes reported in diff stats (#2469)
2019-11-23 12:15:28 +01:00
Alexander Neumann
b02357f542 Fix message 2019-11-23 10:31:40 +01:00
Alexander Neumann
f2aeaef8f1 Improve questions 2019-11-23 10:19:08 +01:00
Alexander Neumann
547702d285 Remove coverage badge 2019-11-23 10:19:08 +01:00
rawtaz
599831f874 Merge pull request #2489 from restic/improve-forget-docs
Improve example for forget --keep-daily
2019-11-22 21:20:35 +01:00
Alexander Neumann
14c90d9e85 Improve example for forget --keep-daily
Following up on https://github.com/restic/restic/pull/2406
2019-11-22 20:44:50 +01:00
Alexander Neumann
c41bbb3761 Re-formulate the question in the issue template
Closes #2410
2019-11-22 20:39:47 +01:00
rawtaz
8a54a0f5ac Merge pull request #2488 from rawtaz/changelog-template
changelog: Fix typo in TEMPLATE
2019-11-22 18:23:02 +01:00
Leo R. Lundgren
c0a5530950 changelog: Fix typo in TEMPLATE. 2019-11-22 17:32:56 +01:00
Leo R. Lundgren
77ef92b95c diff: Fix wrong bytes reported in diff stats (#2469) 2019-11-22 17:26:01 +01:00
Leo R. Lundgren
69f75bbf70 changelog: Add .gitkeep to persist the unreleased/ folder. 2019-11-22 17:14:17 +01:00
Alexander Neumann
30519f01ff Set development version for 0.9.6 2019-11-22 16:19:03 +01:00
Alexander Neumann
b723ca3de5 Add version for 0.9.6 2019-11-22 16:18:59 +01:00
Alexander Neumann
f5084d70d7 Generate CHANGELOG.md for 0.9.6 2019-11-22 16:18:55 +01:00
Alexander Neumann
29b7b17491 Prepare changelog files for 0.9.6 2019-11-22 16:18:33 +01:00
rawtaz
e14c4b1737 Merge pull request #2484 from restic/add-s3-region
s3: Allow specifying region
2019-11-22 15:51:17 +01:00
Alexander Neumann
745d79fe5f Merge pull request #2483 from restic/update-minio-go
Update minio-go
2019-11-22 15:31:12 +01:00
Alexander Neumann
fb95426f64 Rename environment variable to AWS_DEFAULT_REGION
This seems to be the correct name, at least the AWS cli uses it:
https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html
2019-11-22 15:24:42 +01:00
Alexander Neumann
4cadc89ad3 Add documentation and changelog 2019-11-22 15:16:59 +01:00
Alexander Neumann
409909a7f5 Add option description for Region 2019-11-22 15:09:09 +01:00
mdauphin
df500a372d Add AWS_REGION env var to specify s3 region 2019-11-22 15:04:48 +01:00
Alexander Neumann
a444731dc0 Update vendored dependencies 2019-11-22 14:57:56 +01:00
Alexander Neumann
a6e8af7e0f Update minio-go 2019-11-22 14:50:46 +01:00
Alexander Neumann
aa5af8af0e Merge pull request #2478 from restic/update-ci
Update Go version for Appveyor/Travis
2019-11-22 14:36:38 +01:00
Alexander Neumann
4e3353109d Reset changes by 'go get' 2019-11-22 13:17:52 +01:00
Alexander Neumann
02c8d38095 Fix error check for findGoFiles 2019-11-22 12:20:27 +01:00
Alexander Neumann
fd6211653c More debug for findImports 2019-11-22 12:16:46 +01:00
rawtaz
3d4f2dd6b4 Merge pull request #2368 from rlue/doc/backblaze
Clarify docs for Backblaze B2 support
2019-11-22 11:10:22 +01:00
Ryan Lue
c1ddc0c18b Clarify docs for Backblaze B2 support 2019-11-22 18:07:29 +08:00
rawtaz
c95f032a9c Merge pull request #2310 from vincentbernat/fix/doc-contributing
Update documentation for contributing
2019-11-21 20:30:49 +01:00
Vincent Bernat
3087776135 Update documentation for contributing
- No need to checkout into `GOPATH` anymore
 - `CHANGELOG.md` shouldn't be updated directly
2019-11-21 20:27:48 +01:00
rawtaz
b6f01ffbe6 Merge pull request #2394 from bugvillage/doc-backup-passwd
add description env var RESTIC_PASSWORD_COMMAND
2019-11-20 23:26:55 +01:00
rawtaz
41fe9318b1 Merge pull request #2425 from thiell/restic_cache_dir_env
Add support for $RESTIC_CACHE_DIR
2019-11-20 21:18:57 +01:00
Alexander Neumann
8387d18d4d Update Go version used for CI tests 2019-11-20 21:13:56 +01:00
rawtaz
929d2b8df3 Merge pull request #2479 from rawtaz/sing-pulitzer-group
Accept both singular and plural for --group-by (#2330)
2019-11-20 21:03:05 +01:00
Leo R. Lundgren
4f0682d730 Correct name of changelog file for #2321 2019-11-20 21:01:10 +01:00
Alexander Neumann
967d1bbf0c Run 'go mod tidy' 2019-11-20 20:54:43 +01:00
Alexander Neumann
2f80b37b93 Update go-autorest so restic builds with Go 1.13 2019-11-20 20:53:57 +01:00
Leo R. Lundgren
4d2aa18273 Accept both singular and plural for --group-by (#2330) 2019-11-20 19:25:48 +01:00
Alexander Neumann
6b1e5d4e18 Update Go version for Appveyor/Travis 2019-11-20 18:32:58 +01:00
rawtaz
26d1f9f4ba Merge pull request #2307 from gary-kim/fix-2306-password-retries
Allow multiple retries for interactive password input
2019-11-20 18:30:20 +01:00
rawtaz
6a89c0f0ef Merge pull request #2476 from rawtaz/update-doc
doc: Simplify wording for check's --read-data-subset parameter.
2019-11-19 03:38:37 +01:00
rawtaz
b87230b93d Merge pull request #2456 from jenting/installation-opensuse
Docs: add installation guide for openSUSE
2019-11-19 02:15:19 +01:00
JenTing Hsiao
6f2b8d622a Add installation guide for openSUSE
Signed-off-by: JenTing Hsiao <jenting.hsiao@suse.com>
2019-11-19 09:08:18 +08:00
Leo R. Lundgren
90440212f2 doc: Simplify wording for check's --read-data-subset parameter. 2019-11-19 00:43:41 +01:00
rawtaz
3a5c9aadad Merge pull request #2444 from chanibal/patch-2
Docs: fixed escaping of argument in documentation
2019-11-18 21:45:00 +01:00
rawtaz
a78142c1bb Merge pull request #2450 from hallamjeff/patch-1
Update 080_examples.rst
2019-11-18 21:43:19 +01:00
rawtaz
07045c7e23 Merge pull request #2442 from lbausch/patch-1
Docs: Highlight option correctly
2019-11-18 21:39:07 +01:00
rawtaz
0a5d42db3f Merge pull request #2463 from whs-dot-hk/fix-ci-rclone
Update rclone repo
2019-11-18 21:37:02 +01:00
Jeff Hallam
67d99b8cfb Update 080_examples.rst
added backticks around the -o and --option text.
2019-11-18 16:36:20 -04:00
Alexander Neumann
1a0c0dc277 Remove codecov.io
While it was a nice idea, some tests like the backend integration tests
required credentials which were not available to third-party PRs. This
lead to a lot of uncovered code which confused people. So let's disable
codecov.io for now.
2019-11-18 21:21:40 +01:00
rawtaz
e86d9307d0 Merge pull request #2472 from rawtaz/update-backup-doc
doc: Improve exclude/include patterns info
2019-11-18 21:04:18 +01:00
rawtaz
923e681af3 Merge pull request #2471 from 8176135/patch-1
Small fix to the forget --tag command documentation
2019-11-18 20:40:24 +01:00
Leo R. Lundgren
37770b1d82 doc: Improve include patterns info
Clarifies and adds information on how to specify include patterns.
2019-11-18 02:23:01 +01:00
rawtaz
02fea4f76a doc: Improve exclude patterns info
Improves grammar, clarifies and adds information on how to specify exclude patterns.
2019-11-18 01:59:50 +01:00
whs
7cacba0394 Assume WithAtime default to false 2019-11-06 16:38:46 +08:00
whs
e6db3596f1 Update rclone repo 2019-11-06 11:59:48 +08:00
8176135
3acc7af310 Small fix to the forget --tag command
As described in #2460
2019-11-03 11:48:56 +13:00
Jeff Hallam
5c4653f427 Update 080_examples.rst
Added an explanation of how to specify the AWS S3 storage classes and what the default value is.
2019-10-21 19:24:50 -03:00
Krzysztof Bociurko
f7317a9287 Docs: fixed escaping of argument in documentation
Issue was visible as `foo`` in https://restic.readthedocs.io/en/latest/040_backup.html
2019-10-16 19:03:40 +02:00
lbausch
30db8057e4 Docs: Highlight option correctly 2019-10-13 21:19:03 +02:00
Stephane Thiell
0e897ef7b8 Add support for $RESTIC_CACHE_DIR
Add support for restic-specific $RESTIC_CACHE_DIR environment variable
to override the cache directory like --cache-dir would have.
2019-09-26 15:59:56 -07:00
bugvillage
b3e727f40d fixing typo/align around RESTIC_PASSWORD_COMMAND 2019-09-07 15:30:23 +02:00
bugvillage
17feccd998 add description env var RESTIC_PASSWORD_COMMAND
The environment variable RESTIC_PASSWORD_COMMAND works but has
not been documented yet. e.g. it could contain a command that
would fetch the password from a local user keyring

enhances: https://github.com/restic/restic/pull/2094
2019-09-07 14:00:53 +02:00
Eric Hamilton
1596d06f8e Update Lock.Time in lock.Refresh() 2019-09-04 11:38:35 -07:00
Vladimir Rusinov
db20c0b8d0 Ignore username difference in TestMetadataChanged.
In some (rare) cases "fake" UID 51234 may exist in a system running a
test. When this is the case, `cmp.Equal(want, node3)` will fail based on
difference between empty string and an actual username present in a
system.

Fixes github issue #2372
2019-08-13 22:25:00 +01:00
Alexander Neumann
604b18aa74 build: Fix building in ~/go
Before, build.go only unset GO111MODULE and GOPATH, so the Go compiler
did not see either and worked in Module mode. But if the code is checked
out below ~/go (the default GOPATH), it will detect that the source is
within GOPATH and switch to non-Module mode. Now we're setting
GO111MODULE to "on" explicitly.
2019-07-29 09:22:22 +02:00
Alexander Neumann
01c51b3449 Merge pull request #2321 from restic/fix-index-error-handling
Check errors returned by LoadIndex()
2019-07-27 09:37:18 +02:00
Alexander Neumann
de8cf5e345 Merge pull request #2324 from jkahrs/fix/change-cleanup-cache-message
updade message that is shown when a cache cleanup is advised
2019-07-27 09:37:10 +02:00
Alexander Neumann
cfa2ac69e0 Merge pull request #2322 from brualan/master
minor refactoring
2019-07-27 09:37:06 +02:00
Hugo Reeves
3ca306d69a Doc Addition: Added Wasabi repo setup 2019-07-26 22:00:48 +12:00
Alexander Neumann
1e9eefa066 Debian stable has restic 0.9.4 (#2333)
Debian stable has restic 0.9.4
2019-07-11 08:17:40 +02:00
Michael M. Chang
e9af012229 Debian has updated restic
Debian now has restic 0.9.4+ds-2+b1 in stable (buster)
2019-07-10 11:53:17 -04:00
Jean Kahrs
8066e93f47 updade message that is shown when a cache cleanup is advised 2019-07-02 10:49:49 +02:00
Alexandr Bruyako
e19622e4b1 start using fileMode const 2019-07-01 00:26:00 +03:00
Alexandr Bruyako
38ea7ed4f6 remove unused code 2019-07-01 00:24:45 +03:00
Alexandr Bruyako
76d1866444 avoiding unnecessary type conversions 2019-06-30 23:58:00 +03:00
Alexandr Bruyako
8b22fe29cf improved slice copying 2019-06-30 23:56:36 +03:00
Alexandr Bruyako
02014be76c simplified prefix removal, removed unnecessary if-else statements 2019-06-30 23:34:47 +03:00
Alexandr Bruyako
16eeed2ad5 simplified string sorting by using a more suitable function 2019-06-30 23:20:32 +03:00
Alexander Neumann
3f94f63967 Add entry to changelog 2019-06-30 21:38:10 +02:00
Alexander Neumann
88716794e3 Check errors returned by LoadIndex()
Bug was reported in the forum here: https://forum.restic.net/t/check-rebuild-index-prune/1848/13
2019-06-30 21:34:53 +02:00
Fred Akalin
3ca424050f Add upper bound for t in --read-data-subset=n/t (#2304)
* Add upper bound for t in --read-data-subset=n/t

* Add changelog entry
2019-06-29 14:34:53 -04:00
Gary Kim
fea2464d4d Allow multiple retries for interactive password input
Restic used to quit if the repository password was typed incorrectly once.
Restic will now ask the user again for the repository password if typed incorrectly.
The user will now get three tries to input the correct password before restic quits.
2019-06-13 20:11:02 +08:00
Ben
5d272e5c08 Dump : parameter order in sample
Usage:
  restic dump [flags] snapshotID file
2019-05-28 18:20:52 +02:00
Alexander Neumann
5bd5db4294 Merge pull request #2206 from garrmcnu/fs-stdin-directory
fs: Handle absolute pathname for --stdin-filename
2019-05-08 16:05:37 +02:00
Garry McNulty
4429a66b5f backup: Convert relative pathname for --stdin-filename to absolute (#2063) 2019-05-08 15:21:27 +02:00
Garry McNulty
8066195e6e fs: Handle absolute pathname for --stdin-filename
Return valid directory info from Lstat() for parent directories of the
specified filename. Previously only "/" and "." were valid directories.

Also set directory mode as this is checked by archiver.

Closes #2063
2019-05-08 15:21:27 +02:00
Garry McNulty
f7f14cf8c9 fs: Add file info base name check in reader tests (#2063) 2019-05-08 15:21:27 +02:00
Garry McNulty
5096f3b491 fs: Update directory check in reader tests (#2063) 2019-05-08 15:21:27 +02:00
Alexander Neumann
cf3fc2a5b1 Merge pull request #2266 from restic/fix-windows-tests
Fix tests on Windows
2019-05-05 21:34:04 +02:00
Alexander Neumann
920d458a4a archiver: Use untyped constants for testing FileInfo 2019-05-05 14:57:38 +02:00
Alexander Neumann
b016dc2ff0 archiver/Windows: Skip test new-content-same-filestamp 2019-05-05 14:02:11 +02:00
Alexander Neumann
355db0bc29 windows: Use LastWriteTime for ctime and mtime
Windows does not have a concept of a `change time` in the sense as Unix
has it: the field `CreationTime` of the `Win32FileAttributeData` struct
is not updated when attributes or content is changed. So from now on
we're using the `LastWriteTime` as the `change time` on Windows.
2019-05-05 14:02:11 +02:00
Alexander Neumann
6e2fe73189 archiver: Move tests back into the same file
Move all Archiver tests back into `archiver_test.go` and add some tiny
helpers to mock what `lstat` returns (for Windows and Unix separately).
2019-05-05 14:02:11 +02:00
Alexander Neumann
303a5dab6a archiver: Clarify value in test struct
Since I could not remember what the value for `Check` means this commit
renames it to `SameFile`: when set to true, the test should make sure
that `FileChanged` should return false (=file is unmodified).
2019-05-05 12:57:00 +02:00
Alexander Neumann
7dcd2968b6 Merge pull request #2261 from lorenzbausch/patch-1
Fix typo
2019-05-04 10:23:49 +02:00
Lorenz Bausch
298f490195 Fix typo 2019-05-02 11:51:35 +02:00
Alexander Neumann
37cb82b28b Merge pull request #2257 from gliptak/windows1
Don't run TestMetadataChanged test on Windows
2019-04-28 08:39:00 +02:00
Gábor Lipták
bce6438d22 Don't run TestMetadataChanged test on Windows
Signed-off-by: Gábor Lipták <gliptak@gmail.com>
2019-04-27 21:23:47 -04:00
Alexander Neumann
919dd2ac84 Merge pull request #2252 from restic/fix-2249
Read fresh metadata for unmodified files
2019-04-25 09:15:50 +02:00
Alexander Neumann
870bc5108e Merge pull request #2253 from restic/fix-2174
Make sure timestamps are valid
2019-04-25 09:14:43 +02:00
Alexander Neumann
418296c5c9 Add hint for "closes" wording to PR template 2019-04-25 09:00:15 +02:00
Alexander Neumann
a6481b3707 Merge pull request #2212 from cbane/check-ctime
Examine file ctime when checking if files have changed.
2019-04-25 08:58:27 +02:00
Courtney Bane
00b527fb09 Update changelog text, and add pull request link. 2019-04-24 20:54:15 -05:00
Courtney Bane
0ebfc55ee3 Use existing setTimestamp function for ctime test and improve error checking. 2019-04-24 20:53:08 -05:00
Courtney Bane
35b7607802 Don't check ctime when ignoring inode. 2019-04-24 20:53:08 -05:00
Alexander Neumann
fad9f65c65 Merge pull request #2251 from restic/update-deps
Update dependencies
2019-04-24 16:42:57 +02:00
Alexander Neumann
939f3e972c node: Make sure year of all timestamps is valid
Sometimes restic gets bogus timestamps which cannot be converted to
JSON, because the stdlib JSON encoder returns an error if the year is
not within [0, 9999]. We now make sure that we at least record _some_
timestamp and cap the year either to 0000 or 9999. Before, restic would
refuse to save the file at all, so this improves the status quo.

This fixes #2174 and #1173
2019-04-24 16:39:36 +02:00
Alexander Neumann
ca8c3b4fd5 Update dependencies 2019-04-24 15:17:48 +02:00
Alexander Neumann
4f45b14f25 Add changelog file 2019-04-24 15:17:25 +02:00
Alexander Neumann
389067fb8b Only use list of blobs for old node
Closes #2249
2019-04-24 15:07:26 +02:00
Alexander Neumann
4b0ca9ddab Add test for #2249 2019-04-24 15:07:23 +02:00
Courtney Bane
b8c2544dcb Examine file ctime when checking if files have changed. 2019-04-23 21:54:35 -05:00
Alexander Neumann
c7762453cf Set development version for 0.9.5 2019-04-23 13:19:43 +02:00
Alexander Neumann
303210aa08 Add version for 0.9.5 2019-04-23 13:19:39 +02:00
Alexander Neumann
c029881379 Update manpages and auto-completion 2019-04-23 13:19:39 +02:00
Alexander Neumann
6e89963c21 Generate CHANGELOG.md for 0.9.5 2019-04-23 13:19:36 +02:00
Alexander Neumann
1ac560181b Prepare changelog for 0.9.5 2019-04-23 13:19:23 +02:00
Alexander Neumann
18ec27a0da Merge pull request #2243 from treymo/ls-length-2104
backend find: Check prefix length < snapshot IDs when searching
2019-04-23 09:41:19 +02:00
Alexander Neumann
b40dea29ad Merge pull request #2247 from tbm/docs
Minor docs fixes
2019-04-23 09:17:22 +02:00
Martin Michlmayr
0561155963 Split paragraph from list in restic stats --help
The help text for `restic stats` lists a number of modes in a list.
Make sure the "more info" text is a separate paragraph rather than
being part of the list.
2019-04-23 10:36:33 +07:00
Martin Michlmayr
1aafc17212 Avoid error "undefined control sequence" in LaTeX
Converting the changelog to PDF using pandoc leads to:

! Undefined control sequence.
l.1497 ...mple, by creating a file named ``..\test

This is because \t is interpreted as a control sequence.  Use ``
instead of "" to work around this.
2019-04-23 10:36:33 +07:00
Martin Michlmayr
f11789c437 Add missing opening parenthesis 2019-04-23 10:36:26 +07:00
Alexander Neumann
8cab0c121d Merge pull request #2221 from classmarkets/2203-password-from-stdin
Fix reading password from stdin
2019-04-22 20:59:59 +02:00
Alexander Neumann
5979414bcd Merge pull request #2124 from Kidswiss/tar
Ability to dump folders to tar via stdout
2019-04-22 20:58:59 +02:00
Simon Beck
cc8b690b52 Restore whole folder to sdtout as tar
With this change it is possible to dump a folder to stdout as a tar. The

It can be used just like the normal dump command:

`./restic dump fa97e6e1 "/data/test/" > test.tar`

Where `/data/test/` is a a folder instead of a file.
2019-04-22 20:44:33 +02:00
Alexander Neumann
a164dc9391 Merge pull request #2087 from ArcticXWolf/add_group_by_option_for_snapshots
Add GroupBy option to snapshots command
2019-04-22 20:27:24 +02:00
Jan Niklas Richter
9a26be4e5b Add documentation for --group-by flag for snapshots command 2019-04-22 14:57:53 +02:00
Jan Niklas Richter
733519d895 Refactor duplicate code for grouping snapshots
This commit is a followup to the addition of the --group-by flag for the
snapshots command. Adding the grouping code there introduced duplicated
code (the forget command also does grouping). This commit refactors
boths sides to only use shared code.
2019-04-22 14:57:53 +02:00
Jan Niklas Richter
3d5a0c799b Add changelog of group-by option for snapshots command 2019-04-22 14:37:58 +02:00
Jan Niklas Richter
c4475ac58f Move snapshot grouping code into own function to deduplicate code
This commit moves the code which is used to group snapshots in the
snapshots command into an own function to deduplicate code shared by the
snapshots command and forget command.
2019-04-22 14:37:58 +02:00
Jan Niklas Richter
c9fd9b5275 Fix json tags for grouped snapshot output
This commit will add json tags to the structs for json output, so all
json variables of the snapshot command output are lowercase and
snake-case.

Furthermore it adds some internal code changes based on the feedback in
the pull request #2087.
2019-04-22 14:37:58 +02:00
Jan Niklas Richter
cadcab5a19 Add GroupBy option to snapshots command
This commit adds a --group-by option to the snapshots command, which
behaves similar to the --group-by option of forget. Valid option values
are "host, paths, tags". If this option is given, the output of
snapshots will be divided into multiple tables, according to the value
given (i.e. "host" will create a table of snapshots for each host, that
has a snapshot in the list). Also the JSON output will be grouped.

The default behavior (when --group-by is not given) has not changed.

More to this discussion can be found in issue #2037.
2019-04-22 14:37:58 +02:00
Trey Moore
5ac9c1157a Prevent "slice bounds out of range" error if prefix is longer than snapshot IDs.
This includes tests as well as other tests for the backend_find.Find function. Issue #2104.
2019-04-16 20:26:20 -07:00
Peter Schultz
5715517e29 Fix reading password from stdin
Reading the password from non-terminal stdin used io.ReadFull with a
byte slice of length 1000.

We are now using a Scanner to read one line of input, independent of its
length.

Additionally, if stdin is not a terminal, the password is read only
once instead of twice (in an effort to detect typos).

Fixes #2203

Signed-off-by: Peter Schultz <peter.schultz@classmarkets.com>
2019-04-15 10:05:49 +02:00
Alexander Neumann
ecc2458de8 Merge pull request #2230 from cdhowie/issue-2229
Extend find --show-pack-id to work with --tree
2019-04-14 19:38:38 +02:00
Alexander Neumann
2c6ba5d9ac Merge pull request #2231 from cdhowie/issue-2224
find command: don't abort on tree load errors
2019-04-14 19:31:06 +02:00
Alexander Neumann
0cc3647e51 Remove changelog entry, not relevant for end-users 2019-04-14 19:29:12 +02:00
Alexander Neumann
6b700d02f5 Merge pull request #2217 from restic/improve-memory-usage
WIP: improve memory usage
2019-04-13 15:07:07 +02:00
Alexander Neumann
2b09a10234 Merge pull request #2218 from kcthrn/patch-1
Fix minor error in doc for forgetting snapshots
2019-04-13 14:55:40 +02:00
Alexander Neumann
1c87d01bad Merge pull request #2220 from BenoitKnecht/s3-storage-class
Add config option to set S3 storage class
2019-04-13 14:54:32 +02:00
Alexander Neumann
78a3ffcfb9 Merge pull request #2185 from d3zd3z/json-forget
Json forget
2019-04-13 14:23:32 +02:00
Alexander Neumann
4d77c0c21c Merge pull request #2228 from cstegm/patch-1
Update 030_preparing_a_new_repo.rst
2019-04-13 14:20:01 +02:00
Alexander Neumann
fb064afa34 Merge pull request #2232 from jacksgt/document_cachedir-tag
Mention Cache Directoy Tagging Standard in man page and help text
2019-04-13 14:17:38 +02:00
Alexander Neumann
7304738872 check: Reduce default parallelism from 40 to 5 2019-04-13 13:38:39 +02:00
Alexander Neumann
66efa425bf Reuse buffer in worker functions 2019-04-13 13:38:39 +02:00
Alexander Neumann
d51e9d1b98 Add []byte to repo.LoadAndDecrypt and utils.LoadAll
This commit changes the signatures for repository.LoadAndDecrypt and
utils.LoadAll to allow passing in a []byte as the buffer to use. This
buffer is enlarged as needed, and returned back to the caller for
further use.

In later commits, this allows reducing allocations by reusing a buffer
for multiple calls, e.g. in a worker function.
2019-04-13 13:38:39 +02:00
Alexander Neumann
e046428c94 Replace FilesInParallel with an errgroup.Group 2019-04-13 13:38:39 +02:00
Alexander Neumann
75906edef5 mock: Remove unused repository type 2019-04-13 13:38:39 +02:00
Alexander Neumann
203d775190 restic: Make JSON unmarshal for ID more efficient
This commit reduces several allocations in UnmarshalJSON() by decoding
the hex string directly in a single step.
2019-04-13 13:38:39 +02:00
Jack Henschel
ecd7ee85e8 Mention Cache Directoy Tagging Standard in man page and help text
This patch makes it more explicit what is meant by the CACHEDIR.TAG file.
It not only has to have this particular name, but also a specific content
(described at http://bford.info/cachedir/spec.html), which is not immediately
obvious to the user.
2019-04-02 15:53:07 +02:00
Alexander Neumann
2022355800 doc: Fix versions in self-update example 2019-03-30 09:44:59 +01:00
Chris Howie
36f22a0feb find command: don't abort on tree load errors 2019-03-29 22:58:12 -04:00
Chris Howie
f58a44b911 Extend find --show-pack-id to work with --tree 2019-03-29 22:56:36 -04:00
cstegm
fe886a6439 Update 030_preparing_a_new_repo.rst
Helps users having this issue: https://github.com/restic/restic/issues/2216
2019-03-29 18:24:17 +01:00
Benoît Knecht
be23313072 changelog: Add entry for s3.storage-class option 2019-03-26 16:39:27 +01:00
Benoît Knecht
3c112d9cae s3: Add config option to set storage class
The `s3.storage-class` option can be passed to restic (using `-o`) to
specify the storage class to be used for S3 objects created by restic.

The storage class is passed as-is to S3, so it needs to be understood by
the API. On AWS, it can be one of `STANDARD`, `STANDARD_IA`,
`ONEZONE_IA`, `INTELLIGENT_TIERING` and `REDUCED_REDUNDANCY`. If
unspecified, the default storage class is used (`STANDARD` on AWS).

You can mix storage classes in the same bucket, and the setting isn't
stored in the restic repository, so be sure to specify it with each
command that writes to S3.

Closes #706
2019-03-26 16:37:07 +01:00
kcthrn
2970e38d92 Fix minor error in doc for forgetting snapshots 2019-03-24 17:59:19 -04:00
Alexander Neumann
870e7583a1 Merge pull request #2210 from restic/update-deps
Update dependencies
2019-03-17 13:38:34 +01:00
Alexander Neumann
db1c835c37 Update dependencies 2019-03-17 12:13:53 +01:00
Alexander Neumann
190bed9908 Merge pull request #2208 from restic/update-go
Update Go for CI tests
2019-03-17 11:36:06 +01:00
Alexander Neumann
85f4c826db Update Go for CI tests 2019-03-17 11:06:16 +01:00
Alexander Neumann
5da4b0fc7d Merge pull request #2209 from restic/fix-freebsd
Fix build on FreeBSD for Go < 1.12
2019-03-17 11:05:38 +01:00
Alexander Neumann
c1058005c3 Fix build on FreeBSD for Go < 1.12 2019-03-16 20:52:37 +01:00
Alexander Neumann
ca73808649 Merge pull request #2197 from dmgk/master
Fix build on FreeBSD with Go 1.12
2019-03-16 20:23:19 +01:00
Alexander Neumann
f2ea91df38 Merge pull request #2189 from ifedorenko/filewrite-race
Fix rare 'file already closed' during restore
2019-03-16 19:53:18 +01:00
Alexander Neumann
15cc4d74b2 Run 'go mod tidy' and 'go mod vendor' 2019-03-16 17:01:20 +01:00
Igor Fedorenko
bf9a507148 Fix rare 'file already closed' during restore
Fixes #2183

Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>
2019-03-16 17:01:20 +01:00
Alexander Neumann
65b476ead9 Fix gofmt 2019-03-16 13:29:05 +01:00
Alexander Neumann
aaa1cc2c26 Merge pull request 2193 from restic/allow-empty-rclone-args
rclone: Rework backend option parsing
2019-03-16 12:17:38 +01:00
Alexander Neumann
95434cff16 Merge pull request 2156 from kayrus/swift-app-cred
Swift: introduce application credential auth support
2019-03-16 12:17:17 +01:00
Alexander Neumann
1b94ae1c00 Merge pull request 2205 from heikobornholdt/ignore-inode
Add --ignore-inode option to backup cmd
2019-03-16 12:16:31 +01:00
Heiko Bornholdt
d138b38f28 Add pull-2205 to changelog 2019-03-10 21:37:01 +01:00
Heiko Bornholdt
db8f5864fc Add --ignore-inode option to backup cmd
revised version of https://github.com/restic/restic/pull/2047
2019-03-10 21:24:29 +01:00
Dmitri Goutnik
1d8b21cdad Fix build on FreeBSD with Go 1.12 2019-03-06 09:41:49 -05:00
Alexander Neumann
3865b59716 rclone: Rework backend option parsing
This change allows passing no arguments to rclone, using `-o
rclone.args=""`. It is helpful when running rclone remotely via SSH
using a key with a forced command (via `command=` in `authorized_keys`).
2019-03-02 10:36:42 +01:00
Alexander Neumann
7b8d1dc040 Merge pull request 2187 from restic/fix-2181
self-update: Don't cancel download after 30s
2019-02-24 21:21:55 +01:00
David Brown
d19a29f79e Include reasons in json output of forget
This dumps the reasons as well as the list of keeps and removes with the
output from the forget command.
2019-02-23 09:38:33 -07:00
David Brown
449c049ce9 Add changelog for #2184 2019-02-23 09:37:38 -07:00
Alexander Neumann
9f436d80e1 Add changelog file 2019-02-23 11:16:08 +01:00
Alexander Neumann
e277a92a2f self-update: Don't cancel download after 30 seconds 2019-02-23 11:15:18 +01:00
David Brown
d9e22c2df1 Add test for --json support for forget command
This adds a test of the json output of the forget command, by running it
once, asking it to keep one snapshot, and verifying that the output has
the right number of snapshots listed in the Keep and Remove fields of
the result.
2019-02-22 22:00:20 -07:00
David Brown
4b0fb5af36 Add --json support to forget command
Fixes #2184
2019-02-22 22:00:15 -07:00
Alexander Neumann
7519c73987 Clarify documentation on --exclude-if-present 2019-02-22 15:22:29 +01:00
Alexander Neumann
45a48eb4a8 Merge pull request 2171 from tbm/typos
Fix typos
2019-02-21 19:46:10 +01:00
Martin Michlmayr
a2f30cde4c Fix typos 2019-02-17 15:31:07 +00:00
kayrus
6ebcfe7c18 Swift: introduce application credential auth support 2019-02-14 14:19:05 +01:00
Alexander Neumann
0022926eba Merge pull request 2167 from moritzdietz/master
Update dead link in docs
2019-02-11 21:10:44 +01:00
Alexander Neumann
3e3a0220ec Merge pull request 2151 from restic/update-deps
Update dependencies
2019-02-11 20:27:17 +01:00
Moritz Dietz
c125fb763d Update dead link 2019-02-11 20:18:43 +01:00
Alexander Neumann
b9f0f031b6 Update dependencies
Closes #2129
2019-02-10 13:24:37 +01:00
Alexander Neumann
aa7043151a Merge pull request 2147 from kilburn/macports
Document installation with MacPorts
2019-02-10 12:50:52 +01:00
Alexander Neumann
ebf22a35f4 Merge pull request 2154 from ciderpunx/patch-1
Remove stray "in" from b2 instructions
2019-02-10 12:50:11 +01:00
Alexander Neumann
3f069ac404 Merge pull request 2153 from dmd/umount-message
more accurate umount help message, for #815
2019-02-10 12:43:48 +01:00
Alexander Neumann
56e5467096 Merge pull request 2032 from j6s/feature.case-insensitive-exclude
Add options for case insensitive includes & excludes
2019-02-10 12:40:33 +01:00
Alexander Neumann
5ee932a124 Add changelog for #2139 2019-02-10 12:35:41 +01:00
Alexander Neumann
fed25714a4 Merge pull request 2139 from restic/fail-zero-bytes-stdin
Return error when reading zero byte from stdin
2019-02-10 12:34:05 +01:00
Alexander Neumann
8906d85ab8 Merge pull request 2138 from restic/fix-2136
Use processed bytes for summary
2019-02-10 12:32:50 +01:00
Alexander Neumann
97aafc1eec Add changelog file for #1944 2019-02-10 12:31:18 +01:00
Alexander Neumann
6a5c9f57c2 Merge pull request 1944 from mholt/jsonprogress
backup: Support --json flag by streaming JSON to report progress
2019-02-10 12:29:50 +01:00
Matthew Holt
6cf13483b5 Add snapshot ID to summary output 2019-02-10 12:09:09 +01:00
Matthew Holt
f645306a18 Initial implementation of JSON progress reporter 2019-02-10 12:09:09 +01:00
ciderpunx
186e10e0cb Remove stray "in" from b2 instructions 2019-01-29 12:39:46 +00:00
Daniel M. Drucker
29a5bd5b30 more accurate umount help message, for #815 2019-01-28 16:53:35 -05:00
Marc Pujol
06a01bc016 Document installation with MacPorts 2019-01-21 08:13:53 +01:00
Johannes Hertenstein
cdc287a7f6 Store reference to reject function for insensitive pattern rejection 2019-01-19 11:08:13 +00:00
Johannes Hertenstein
deedc38129 Only convert iexclude & iinclude casing once 2019-01-19 11:04:53 +00:00
Alexander Neumann
1107eef215 Merge pull request 2142 from restic/fix-2140
Print message in verbose mode only
2019-01-12 13:30:20 +01:00
Alexander Neumann
60c7020bcb Print message in verbose mode only
Closes #2140
2019-01-10 21:28:22 +01:00
Alexander Neumann
b96ef48562 Set development version for 0.9.4 2019-01-06 21:40:32 +01:00
Alexander Neumann
cd9b2295f1 Add version for 0.9.4 2019-01-06 21:40:32 +01:00
Alexander Neumann
a439cdeb05 Update manpages and auto-completion 2019-01-06 21:40:32 +01:00
Alexander Neumann
827f6d7b24 Generate CHANGELOG.md for 0.9.4 2019-01-06 21:40:31 +01:00
Alexander Neumann
77ab10d401 Create changelog dir for 0.9.4 2019-01-06 21:39:56 +01:00
Alexander Neumann
3b0ad2e368 release: Pull latest alpine image 2019-01-06 21:39:56 +01:00
Alexander Neumann
2996c110f1 Merge pull request 2017 from kylewlacy/fuse_default_permissions_option
mount: Add default-permissions flag to set FUSE option
2019-01-06 21:19:27 +01:00
Alexander Neumann
4609b5c24d Merge pull request 2094 from juergenhoetzel/password-command
Add support for reading password from external command
2019-01-06 21:14:52 +01:00
Alexander Neumann
830511460a mount: Turn on DefaultPermissions for --allow-other`
This commit changes the logic slightly: checking the permissions in the
fuse mount when nobody else besides the current user can access the fuse
mount does not sense. The current user has access to the repo files in
addition to the password, so they can access all data regardless of what
the fuse mount does.

Enabling `--allow-root` allows the root user to access the files in the
fuse mount, for this user no permission checks will be done anyway.

The code now enables `DefaultPermissions` automatically when
`--allow-other` is set, it can be disabled with
`--no-default-permissions` to restore the old behavior.
2019-01-06 20:55:49 +01:00
Alexander Neumann
0dc3648416 Add documentation for --password-command 2019-01-06 20:41:38 +01:00
Alexander Neumann
d71dba3788 Merge pull request 2130 from andreaso/docs-https-links
Prefer https:// links in the documentation
2019-01-06 20:24:42 +01:00
Alexander Neumann
e482633943 Merge pull request 2137 from kevinawoo/patch-1
doc: Add more clarity to B2 application key
2019-01-06 20:24:00 +01:00
Alexander Neumann
900621051a Merge pull request 2120 from turnkey-commerce/fix-doc-typo
Fix a few typos in the FAQ doc.
2019-01-06 15:08:13 +01:00
Alexander Neumann
1f246c5309 Merge pull request 2090 from plumbeo/within-hours
Increase the granularity of the "keep within" snapshot retention policy
2019-01-06 15:04:55 +01:00
Alexander Neumann
e40805b002 Merge pull request 2103 from cdhowie/master
--one-file-system unsupported on Windows
2019-01-06 14:59:46 +01:00
Alexander Neumann
6f69ae1b8d Add docs, changelog file 2019-01-06 14:52:20 +01:00
Alexander Neumann
c4fbf2c779 Return error when reading zero byte from stdin
This commit changes the internal file system implementation for reading
data from stdin, it now returns an error when no bytes could be read. I
think it's worth failing in this case, the user instructed restic to
read some data from stdin, and no data was read at all. Maybe it was in
a pipe and some earlier stage failed.

See #2135 for a short discussion.
2019-01-06 14:52:20 +01:00
Alexander Neumann
7c084014fa Use processed bytes for summary
When restic reads the backup from stdin, the number of bytes processed
was always displayed as zero. The reason is that the UI for the archive
uses the total bytes as returned by the scanner, which is zero for
stdin. So instead we keep track of the real number of bytes processed
and print that at the end.

Closes #2136
2019-01-06 13:15:23 +01:00
Kevin Woo
d65bea1b2a doc: Add more clarity to B2 application key 2019-01-05 20:05:11 -08:00
Andreas Olsson
3b68acf853 Prefer https:// links in the documentation
All the changed urls are available by way of https://. Most of them
already redirect.
2018-12-29 15:57:44 +01:00
James Culbertson
82a70643a2 Fix a few typos in the FAQ doc. 2018-12-18 08:47:52 -06:00
Alexander Neumann
0dd805421e Merge pull request 2108 from mholt/noexitprint
cmd: Don't exit if printing to stdout or stderr fails (closes #2102)
2018-12-15 21:34:18 +01:00
Alexander Neumann
16b82f4b1d Merge pull request 2111 from andreaso/doc-moot-sudo
Remove moot sudo usage from documentation
2018-12-15 21:33:51 +01:00
Andreas Olsson
7a6bfcd58c Remove moot sudo usage from documentation
That usage of sudo only applies to the echo command itself. It has no
effect on the permissions of the stdout redirect.
2018-12-09 17:43:50 +01:00
Matthew Holt
de54618852 cmd: Don't exit if printing to stdout or stderr fails (closes #2102) 2018-12-01 15:11:22 -07:00
Alexander Neumann
98526b8dbe Merge pull request 2100 from restic/fix-1989
gs: Respect bandwidth limiting
2018-11-28 21:39:42 +01:00
Alexander Neumann
0083680d33 Merge pull request 2099 from restic/fix-1229
cache: Don't return an error for truncated files
2018-11-28 21:39:35 +01:00
Chris Howie
05222b7343 --one-file-system unsupported on Windows 2018-11-27 11:14:47 -05:00
Kyle Lacy
d4ff5b6bf4 Add changelog entry about "DefaultPermissions" change 2018-11-26 21:16:01 -08:00
Kyle Lacy
cf0883e16c mount: Add "no-default-permissions" option
This option restores the previous behavior of `mount` by disabling the "DefaultPermissions" FUSE option. This allows any user that can access the mountpoint to read any file from the snapshot. Normal FUSE rules apply, so `allow-root` or `allow-other` can be used to allow users besides the mounting user to access these files.
2018-11-26 21:16:01 -08:00
Kyle Lacy
a35a24b8b4 mount: Enable "DefaultPermissions" FUSE option by default
This enforces the Unix permissions of the snapshot files within the mounted filesystem, which will only allow users to access snapshot files if they had access to the file outside of the snapshot.
2018-11-26 21:16:01 -08:00
Juergen Hoetzel
df7f72cdde Add support for reading password from external command
This allows reading the password from an password manager (like "pass").

Signed-off-by: Juergen Hoetzel <juergen@archlinux.org>
2018-11-26 20:18:31 +01:00
plumbeo
3edc723bf0 Update 'restic forget --keep-within' documentation and add changelog entry 2018-11-26 14:27:48 +01:00
plumbeo
71891b340c Support time ranges expressed in hours in snapshot retention policies
Make restic forget --keep-within accept time ranges measured in hours and choose
accordingly which snapshots to keep and which to forget. Add relative tests.
2018-11-26 14:27:42 +01:00
Alexander Neumann
6f5c3e57f6 Update vendor/modules.txt 2018-11-25 19:22:57 +01:00
Alexander Neumann
56af0ce370 Add entry to changelog 2018-11-25 19:07:42 +01:00
Alexander Neumann
c9745cd47e gs: Respect bandwidth limiting
In 0dfdc11ed9, accidentally we dropped
using the provided http.RoundTripper, this commits adds it back.

Closes #1989
2018-11-25 18:52:32 +01:00
Alexander Neumann
2434ab2106 Merge pull request 2098 from cdhowie/key-hinting
Add key hinting (#2097)
2018-11-25 17:52:54 +01:00
Chris Howie
1688713400 Add key hinting (#2097) 2018-11-25 09:13:18 -05:00
Alexander Neumann
00597284de cache: Don't return an error for truncated files
Closes #1229
Closes #1328
2018-11-25 14:18:02 +01:00
Johannes Hertenstein
879f6e0c81 Add changelog file for insensitive includes & excludes 2018-11-25 13:32:16 +01:00
Johannes Hertenstein
8a97bb8661 Add documentation for insensitive includes & excludes 2018-11-25 13:32:16 +01:00
Johannes Hertenstein
5fe6de219d Add tests for insensitive variants of filter methods 2018-11-25 13:32:16 +01:00
Johannes Hertenstein
c13f79da02 Add iexclude and iinclude options to restore command 2018-11-25 13:32:16 +01:00
Johannes Hertenstein
db82e6b80c Add iexclude option to backup command 2018-11-25 13:32:16 +01:00
Alexander Neumann
6dc7cca597 Merge pull request 2086 from frebib/fix-2085
Allow --files-from multiple times
2018-11-25 13:21:29 +01:00
Alexander Neumann
d32c7c2aba Rework changelog for #2085 2018-11-25 12:55:03 +01:00
Joe Groocock
09e9b74cbd Allow --files-from multiple times
Fixes https://github.com/restic/restic/issues/2085
2018-11-25 12:55:03 +01:00
Alexander Neumann
d53595e43c Merge pull request 2088 from garrmcnu/stats-latest-host
stats: Add shorthand flag `-H` for host name filter
2018-11-24 19:05:53 +01:00
Alexander Neumann
0de19cc87f Merge pull request 2095 from plumbeo/parse-location
Use local time for user-provided time of backup
2018-11-24 18:50:12 +01:00
plumbeo
2c9ec07d0b Add changelog entry 2018-11-20 22:18:12 +01:00
plumbeo
a7971a3ece Use local time for user-provided time of backup 2018-11-20 21:28:19 +01:00
Alexander Neumann
4ab0022da8 Add hint which OS are supported
Closes #2016
2018-11-18 12:33:52 +01:00
Garry McNulty
4b3c054257 stats: Add shorthand flag -H for host name filter
The default value of the `--host` flag was set to 'H' (the shorthand
version of the flag), this caused the snapshot lookup to fail.

Also add shorthand `-H` for `backup` command.

Closes #2040
2018-11-14 21:58:31 +00:00
plumbeo
7486bfea5b Extend custom Duration granularity to hours and add tests 2018-11-14 17:27:02 +01:00
Alexander Neumann
c8fc72364a Merge pull request 2081 from restic/fix-2080
backup: Open repository before async status starts
2018-11-11 14:21:47 +01:00
Alexander Neumann
987ef2f4a9 Merge pull request 2082 from restic/fix-2079
dump: Use path instead of filepath
2018-11-11 14:21:37 +01:00
Alexander Neumann
5b95bb7059 Fix error message on Windows 2018-11-11 14:06:32 +01:00
Alexander Neumann
8471a359ee dump: Use path instead of filepath
Some time ago we changed the paths in the repo to always use a slash for
separation, it seems we missed that the `dump` command still uses the
`filepath` package, so on Windows backslashes are used.

Closes #2079
2018-11-10 12:43:11 +01:00
Alexander Neumann
f9422ff4c7 backup: Open repository before async status starts
Closes #2080
2018-11-10 12:38:29 +01:00
Alexander Neumann
c0572ca15f backup: Add warning when patterns do not match any files 2018-11-03 14:51:30 +01:00
Alexander Neumann
a630d69e0c Merge pull request 2070 from restic/display-local-time
Display local time for all commands
2018-11-02 21:16:29 +01:00
Alexander Neumann
20bcd281a3 Add entry to changelog 2018-11-02 20:40:52 +01:00
Alexander Neumann
c012fccd22 Display local time for all commands 2018-11-02 20:36:15 +01:00
Alexander Neumann
920727dd34 Merge pull request #2068 from restic/prune-check-load-error
prune: Correctly handle errors returned by Load()
2018-10-28 22:15:29 +01:00
Alexander Neumann
157d365894 Add entry to CHANGELOG 2018-10-28 21:38:04 +01:00
Alexander Neumann
bfa18ee8ec DownloadAndHash: Check error returned by Load() 2018-10-28 21:28:56 +01:00
Alexander Neumann
890eebf151 Correct summary for #1978 2018-10-28 20:55:49 +01:00
Alexander Neumann
9310cd0cd6 Merge pull request #2056 from restic/recover-data
Add new command 'recover'
2018-10-28 14:26:48 +01:00
Alexander Neumann
9f7ce7ce5a Merge pull request #2066 from restic/fix-list-error
rebuild-index/prune: Correctly handle error listing files
2018-10-28 14:26:40 +01:00
Alexander Neumann
0b600d6cef index.New: Test various error conditions 2018-10-28 14:02:31 +01:00
Alexander Neumann
3ae2a79bdf restic: Use local rand source instead of global one 2018-10-28 14:01:30 +01:00
Alexander Neumann
f7c0893f76 index: Add tests for error conditions 2018-10-28 13:16:36 +01:00
Alexander Neumann
c3de301fc8 index: Use interfaces instead of *repository.Repository 2018-10-28 12:58:34 +01:00
Alexander Neumann
944b446ac0 index: Cancel context for tests 2018-10-28 11:17:04 +01:00
Alexander Neumann
b096fc7abf index: Correctly process errors listing all files
This also removes the now unused `list` and `worker` packages.
2018-10-28 11:16:29 +01:00
Alexander Neumann
d10754e2b4 Merge pull request 2057 from re1/patch-1
Update install instructions for Arch Linux
2018-10-21 20:04:07 +02:00
Alexander Neumann
7ac683c360 rclone: Inject debug logger for HTTP 2018-10-21 19:58:40 +02:00
Markus
6caa9d38ac Update install instructions for Arch Linux
restic has been added to the official community repositories in august 2018.
2018-10-20 13:09:52 +00:00
Alexander Neumann
19fd0f101f Merge pull request 2053 from andyjack/correct-doc-for-self-update
Fix incorrect command name in long doc for self-update
2018-10-20 11:51:13 +02:00
Alexander Neumann
8c91c51d1b Fix timestamps 2018-10-20 11:08:03 +02:00
Alexander Neumann
7e28bf7e97 Add 'recover' command 2018-10-20 11:08:03 +02:00
Alexander Neumann
43d6e426c8 Merge pull request 2054 from gliptak/patch-3
Correct typo
2018-10-20 11:04:49 +02:00
Alexander Neumann
26fc60e7cb Merge pull request 2055 from gliptak/patch-4
Correct ineffassign
2018-10-20 11:04:32 +02:00
Gábor Lipták
e5d7879622 Correct ineffassign
Signed-off-by: Gábor Lipták <gliptak@gmail.com>
2018-10-19 16:58:14 -04:00
Gábor Lipták
d2ee58f2e9 Correct typo 2018-10-18 21:30:14 -04:00
Andy Jack
3f25537a06 Fix incorrect command name in long doc for self-update 2018-10-18 18:45:31 -04:00
Alexander Neumann
d203ae37f4 Merge pull request 2050 from andreasnuesslein/patch-1
tiny formatting fix
2018-10-18 22:31:15 +02:00
Andreas Nüßlein
6eedd66c1a tiny formatting fix
I noticed this discrepancy when trying to parse the output of restic.
2018-10-17 09:41:11 +02:00
Alexander Neumann
e4b39ae553 Merge pull request 2044 from restic/fix-verify
restore: Close files tested with --verify
2018-10-15 21:16:58 +02:00
Alexander Neumann
7cbcb6d318 Merge pull request 2043 from cgroschupp/patch-1
Add ssh binary to docker image to allow sftp repository
2018-10-14 21:43:04 +02:00
Alexander Neumann
c0fca3f50a restore: Close files tested with --verify
Before, the target files were opened once per blob and never closed,
this commit fixes that.
2018-10-14 21:00:14 +02:00
Alexander Neumann
4c2072d875 Merge pull request 1719 from ifedorenko/mt-restorer
new optimized multithreaded restore implementation
2018-10-14 20:29:16 +02:00
Christian Groschupp
92ecca1808 Add ssh binary to docker image to allow sftp repository 2018-10-14 19:56:02 +02:00
Alexander Neumann
7236635cc1 Merge pull request 2042 from restic/fix-2041
self-update: fix path to output file
2018-10-14 19:48:28 +02:00
Alexander Neumann
21a3486ebb Rework changelog entry 2018-10-14 17:39:42 +02:00
Igor Fedorenko
bda8d7722e restorer: Optimize empty file restore
don't create fileInfo structs for empty files. this saves memory.
this also avoids extra serial scan of all fileInfo, which should
make restore faster and more consistent.

Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>
2018-10-14 17:39:42 +02:00
Igor Fedorenko
c2bcb764cd restorer: Add a note on hardlink metadata
Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>
2018-10-14 17:39:42 +02:00
Igor Fedorenko
9e24154ec9 restore: significantly reduce memory footprint
reworked restore error callback to use file location
path instead of much heavier Node. this reduced restore
memory usage by as much as 50% in some of my tests.

Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>
2018-10-14 17:39:42 +02:00
Igor Fedorenko
9f3ca97ee8 restore: Chang fileInfo to use snapshot location instead of target path
* uses less memory as common prefix is only stored once
* stepping stone for simpler error callback api, which
  will allow further memory footprint reduction

Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>
2018-10-14 17:39:42 +02:00
Igor Fedorenko
32d5ceba87 restore: Fix packcache capacity math with failed downloads
Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>
2018-10-14 17:39:42 +02:00
Igor Fedorenko
e010f3b884 restore: Fix small memory leak in filesWriter, add tests
Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>
2018-10-14 17:39:42 +02:00
Alexander Neumann
941202c119 restore: Rename things, match the rest of the project 2018-10-14 17:39:37 +02:00
Alexander Neumann
c021ad2334 restore: Move documentation to godoc 2018-10-14 17:39:35 +02:00
Igor Fedorenko
2b3420820b go mod vendor
Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>
2018-10-14 17:37:30 +02:00
Igor Fedorenko
da57302fca restore: Removed legacy restore implementation
Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>
2018-10-14 17:37:30 +02:00
Igor Fedorenko
1869930d95 restore: New optimized multithreaded implementation
Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>
2018-10-14 17:37:30 +02:00
Igor Fedorenko
1213d8fef4 Cleanup: more realistic restorer test data setup
Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>
2018-10-14 17:37:30 +02:00
Alexander Neumann
a432b42c81 self-update: Check current version before download 2018-10-14 17:29:46 +02:00
Alexander Neumann
7d0f2eaf24 self-update: Use correct path to restic binary
Closes #2041
2018-10-14 17:29:19 +02:00
Alexander Neumann
41a4d67d93 Merge pull request 1962 from mholt/lsjson
ls: Stream output when using --json option
2018-10-14 15:51:38 +02:00
Alexander Neumann
afde60e433 Merge pull request #2039 from restic/fix-2038
snapshots: Don't print empty line for --compact
2018-10-13 21:24:26 +02:00
Alexander Neumann
d7baa67acb snapshots: Don't print empty line for --compact
Closes #2038
2018-10-13 20:17:34 +02:00
Alexander Neumann
167397c18c Set development version for 0.9.3 2018-10-13 13:48:31 +02:00
Matthew Holt
9151eec24e Add changelog entry 2018-08-19 09:14:58 -06:00
Matthew Holt
22475729ce Select specific Node fields for listing 2018-08-19 09:03:47 -06:00
Matthew Holt
04c67d700d ls: Stream output when using --json option 2018-08-19 00:18:43 -06:00
1442 changed files with 16179 additions and 408896 deletions

View File

@@ -1,27 +0,0 @@
<!--
Welcome! If you have a question or are unsure if you should open an issue,
please use the forum instead!
https://forum.restic.net
The forum is a better place for questions about restic or general suggestions
and topics, e.g. usage or documentation questions! This issue tracker is mainly
for tracking bugs and feature requests directly relating to the development of
the software itself, rather than the project.
Thanks for understanding, and for contributing to the project!
-->
Output of `restic version`
--------------------------
<!--
Please add the version of restic you're currently using here, this helps us
later to see what has changed in restic when we revisit this issue after some
time.
-->
Describe the issue
------------------

View File

@@ -83,8 +83,8 @@ Do you have an idea how to solve the issue?
Did restic help you or made you happy in any way?
-------------------------------------------------
Did restic help you today? Did it make you happy in any way?
------------------------------------------------------------
<!--
Answering this question is not required, but if you have anything positive to share, please do so here!

View File

@@ -39,16 +39,16 @@ Please describe the feature you'd like us to add here.
-->
What are you trying to do?
--------------------------
What are you trying to do? What problem would this solve?
---------------------------------------------------------
<!--
This section should contain a brief description what you're trying to do, which
would be possible after implementing the new feature.
-->
Did restic help you or made you happy in any way?
-------------------------------------------------
Did restic help you today? Did it make you happy in any way?
------------------------------------------------------------
<!--
Answering this question is not required, but if you have anything positive to share, please do so here!

4
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@@ -0,0 +1,4 @@
contact_links:
- name: restic forum
url: https://forum.restic.net
about: Please ask questions about using restic here, do not open an issue for questions.

View File

@@ -10,11 +10,11 @@ your time and add more commits. If you're done and ready for review, please
check the last box.
-->
What is the purpose of this change? What does it change?
--------------------------------------------------------
What does this PR change? What problem does it solve?
-----------------------------------------------------
<!--
Describe the changes here, as detailed as needed.
Describe the changes and their purpose here, as detailed as needed.
-->
Was the change discussed in an issue or in the forum before?
@@ -22,12 +22,16 @@ Was the change discussed in an issue or in the forum before?
<!--
Link issues and relevant forum posts here.
If this PR resolves an issue on GitHub, use "Closes #1234" so that the issue
is closed automatically when this PR is merged.
-->
Checklist
---------
- [ ] I have read the [Contribution Guidelines](https://github.com/restic/restic/blob/master/CONTRIBUTING.md#providing-patches)
- [ ] I have enabled [maintainer edits for this PR](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/allowing-changes-to-a-pull-request-branch-created-from-a-fork)
- [ ] I have added tests for all changes in this PR
- [ ] I have added documentation for the changes (in the manual)
- [ ] There's a new file in `changelog/unreleased/` that describes the changes for our users (template [here](https://github.com/restic/restic/blob/master/changelog/TEMPLATE))

View File

@@ -4,15 +4,15 @@ sudo: false
matrix:
include:
- os: linux
go: "1.9.x"
env: RESTIC_TEST_FUSE=0 RESTIC_TEST_CLOUD_BACKENDS=0 RESTIC_BUILD_SOLARIS=0
go: "1.13.x"
env: RESTIC_TEST_FUSE=0 RESTIC_TEST_CLOUD_BACKENDS=0
cache:
directories:
- $HOME/.cache/go-build
- $HOME/gopath/pkg/mod
- os: linux
go: "1.10.x"
go: "1.14.x"
env: RESTIC_TEST_FUSE=0 RESTIC_TEST_CLOUD_BACKENDS=0
cache:
directories:
@@ -21,7 +21,7 @@ matrix:
# only run fuse and cloud backends tests on Travis for the latest Go on Linux
- os: linux
go: "1.11.x"
go: "1.15.x"
sudo: true
cache:
directories:
@@ -29,7 +29,7 @@ matrix:
- $HOME/gopath/pkg/mod
- os: osx
go: "1.11.x"
go: "1.15.x"
env: RESTIC_TEST_FUSE=0 RESTIC_TEST_CLOUD_BACKENDS=0
cache:
directories:
@@ -56,6 +56,3 @@ install:
script:
- go run run_integration_tests.go
after_success:
- test -r all.cov && bash <(curl -s https://codecov.io/bash) -f all.cov

View File

@@ -1,3 +1,840 @@
Changelog for restic 0.10.0 (2020-09-19)
=======================================
The following sections list the changes in restic 0.10.0 relevant to
restic users. The changes are ordered by importance.
Summary
-------
* Fix #1863: Report correct number of directories processed by backup
* Fix #2254: Fix tar issues when dumping `/`
* Fix #2281: Handle format verbs like '%' properly in `find` output
* Fix #2298: Do not hang when run as a background job
* Fix #2389: Fix mangled json output of backup command
* Fix #2390: Refresh lock timestamp
* Fix #2429: Backup --json reports total_bytes_processed as 0
* Fix #2469: Fix incorrect bytes stats in `diff` command
* Fix #2518: Do not crash with Synology NAS sftp server
* Fix #2531: Fix incorrect size calculation in `stats --mode restore-size`
* Fix #2537: Fix incorrect file counts in `stats --mode restore-size`
* Fix #2592: SFTP backend supports IPv6 addresses
* Fix #2607: Honor RESTIC_CACHE_DIR environment variable on Mac and Windows
* Fix #2668: Don't abort the stats command when data blobs are missing
* Fix #2674: Add stricter prune error checks
* Fix #2899: Fix possible crash in the progress bar of check --read-data
* Chg #2482: Remove vendored dependencies
* Chg #2546: Return exit code 3 when failing to backup all source data
* Chg #2600: Update dependencies, require Go >= 1.13
* Chg #1597: Honor the --no-lock flag in the mount command
* Enh #1570: Support specifying multiple host flags for various commands
* Enh #1680: Optimize `restic mount`
* Enh #2072: Display snapshot date when using `restic find`
* Enh #2175: Allow specifying user and host when creating keys
* Enh #2277: Add support for ppc64le
* Enh #2395: Ignore sync errors when operation not supported by local filesystem
* Enh #2427: Add flag `--iexclude-file` to backup command
* Enh #2569: Support excluding files by their size
* Enh #2571: Self-heal missing file parts during backup of unchanged files
* Enh #2858: Support filtering snapshots by tag and path in the stats command
* Enh #323: Add command for copying snapshots between repositories
* Enh #551: Use optimized library for hash calculation of file chunks
* Enh #2195: Simplify and improve restore performance
* Enh #2328: Improve speed of check command
* Enh #2423: Support user@domain parsing as user
* Enh #2576: Improve the chunking algorithm
* Enh #2598: Improve speed of diff command
* Enh #2599: Slightly reduce memory usage of prune and stats commands
* Enh #2733: S3 backend: Add support for WebIdentityTokenFile
* Enh #2773: Optimize handling of new index entries
* Enh #2781: Reduce memory consumption of in-memory index
* Enh #2786: Optimize `list blobs` command
* Enh #2790: Optimized file access in restic mount
* Enh #2840: Speed-up file deletion in forget, prune and rebuild-index
Details
-------
* Bugfix #1863: Report correct number of directories processed by backup
The directory statistics calculation was fixed to report the actual number of processed
directories instead of always zero.
https://github.com/restic/restic/issues/1863
* Bugfix #2254: Fix tar issues when dumping `/`
We've fixed an issue with dumping either `/` or files on the first sublevel e.g. `/foo` to tar.
This also fixes tar dumping issues on Windows where this issue could also happen.
https://github.com/restic/restic/issues/2254
https://github.com/restic/restic/issues/2357
https://github.com/restic/restic/pull/2255
* Bugfix #2281: Handle format verbs like '%' properly in `find` output
The JSON or "normal" output of the `find` command can now deal with file names that contain
substrings which the Golang `fmt` package considers "format verbs" like `%s`.
https://github.com/restic/restic/issues/2281
* Bugfix #2298: Do not hang when run as a background job
Restic did hang on exit while restoring the terminal configuration when it was started as a
background job, for example using `restic ... &`. This has been fixed by only restoring the
terminal configuration when restic is interrupted while reading a password from the
terminal.
https://github.com/restic/restic/issues/2298
* Bugfix #2389: Fix mangled json output of backup command
We've fixed a race condition in the json output of the backup command that could cause multiple
lines to get mixed up. We've also ensured that the backup summary is printed last.
https://github.com/restic/restic/issues/2389
https://github.com/restic/restic/pull/2545
* Bugfix #2390: Refresh lock timestamp
Long-running operations did not refresh lock timestamp, resulting in locks becoming stale.
This is now fixed.
https://github.com/restic/restic/issues/2390
* Bugfix #2429: Backup --json reports total_bytes_processed as 0
We've fixed the json output of total_bytes_processed. The non-json output was already fixed
with pull request #2138 but left the json output untouched.
https://github.com/restic/restic/issues/2429
* Bugfix #2469: Fix incorrect bytes stats in `diff` command
In some cases, the wrong number of bytes (e.g. 16777215.998 TiB) were reported by the `diff`
command. This is now fixed.
https://github.com/restic/restic/issues/2469
* Bugfix #2518: Do not crash with Synology NAS sftp server
It was found that when restic is used to store data on an sftp server on a Synology NAS with a
relative path (one which does not start with a slash), it may go into an endless loop trying to
create directories on the server. We've fixed this bug by using a function in the sftp library
instead of our own implementation.
The bug was discovered because the Synology sftp server behaves erratic with non-absolute
path (e.g. `home/restic-repo`). This can be resolved by just using an absolute path instead
(`/home/restic-repo`). We've also added a paragraph in the FAQ.
https://github.com/restic/restic/issues/2518
https://github.com/restic/restic/issues/2363
https://github.com/restic/restic/pull/2530
* Bugfix #2531: Fix incorrect size calculation in `stats --mode restore-size`
The restore-size mode of stats was counting hard-linked files as if they were independent.
https://github.com/restic/restic/issues/2531
* Bugfix #2537: Fix incorrect file counts in `stats --mode restore-size`
The restore-size mode of stats was failing to count empty directories and some files with hard
links.
https://github.com/restic/restic/issues/2537
* Bugfix #2592: SFTP backend supports IPv6 addresses
The SFTP backend now supports IPv6 addresses natively, without relying on aliases in the
external SSH configuration.
https://github.com/restic/restic/pull/2592
* Bugfix #2607: Honor RESTIC_CACHE_DIR environment variable on Mac and Windows
On Mac and Windows, the RESTIC_CACHE_DIR environment variable was ignored. This variable can
now be used on all platforms to set the directory where restic stores caches.
https://github.com/restic/restic/pull/2607
* Bugfix #2668: Don't abort the stats command when data blobs are missing
Runing the stats command in the blobs-per-file mode on a repository with missing data blobs
previously resulted in a crash.
https://github.com/restic/restic/pull/2668
* Bugfix #2674: Add stricter prune error checks
Additional checks were added to the prune command in order to improve resiliency to backend,
hardware and/or networking issues. The checks now detect a few more cases where such outside
factors could potentially cause data loss.
https://github.com/restic/restic/pull/2674
* Bugfix #2899: Fix possible crash in the progress bar of check --read-data
We've fixed a possible crash while displaying the progress bar for the check --read-data
command. The crash occurred when the length of the progress bar status exceeded the terminal
width, which only happened for very narrow terminal windows.
https://github.com/restic/restic/pull/2899
https://forum.restic.net/t/restic-rclone-pcloud-connection-issues/2963/15
* Change #2482: Remove vendored dependencies
We've removed the vendored dependencies (in the subdir `vendor/`). When building restic, the
Go compiler automatically fetches the dependencies. It will also cryptographically verify
that the correct code has been fetched by using the hashes in `go.sum` (see the link to the
documentation below).
https://github.com/restic/restic/issues/2482
https://golang.org/cmd/go/#hdr-Module_downloading_and_verification
* Change #2546: Return exit code 3 when failing to backup all source data
The backup command used to return a zero exit code as long as a snapshot could be created
successfully, even if some of the source files could not be read (in which case the snapshot
would contain the rest of the files).
This made it hard for automation/scripts to detect failures/incomplete backups by looking at
the exit code. Restic now returns the following exit codes for the backup command:
- 0 when the command was successful - 1 when there was a fatal error (no snapshot created) - 3 when
some source data could not be read (incomplete snapshot created)
https://github.com/restic/restic/issues/956
https://github.com/restic/restic/issues/2064
https://github.com/restic/restic/issues/2526
https://github.com/restic/restic/issues/2364
https://github.com/restic/restic/pull/2546
* Change #2600: Update dependencies, require Go >= 1.13
Restic now requires Go to be at least 1.13. This allows simplifications in the build process and
removing workarounds.
This is also probably the last version of restic still supporting mounting repositories via
fuse on macOS. The library we're using for fuse does not support macOS any more and osxfuse is not
open source any more.
https://github.com/bazil/fuse/issues/224
https://github.com/osxfuse/osxfuse/issues/590
https://github.com/restic/restic/pull/2600
https://github.com/restic/restic/pull/2852
https://github.com/restic/restic/pull/2927
* Change #1597: Honor the --no-lock flag in the mount command
The mount command now does not lock the repository if given the --no-lock flag. This allows to
mount repositories which are archived on a read only backend/filesystem.
https://github.com/restic/restic/issues/1597
https://github.com/restic/restic/pull/2821
* Enhancement #1570: Support specifying multiple host flags for various commands
Previously commands didn't take more than one `--host` or `-H` argument into account, which
could be limiting with e.g. the `forget` command.
The `dump`, `find`, `forget`, `ls`, `mount`, `restore`, `snapshots`, `stats` and `tag`
commands will now take into account multiple `--host` and `-H` flags.
https://github.com/restic/restic/issues/1570
* Enhancement #1680: Optimize `restic mount`
We've optimized the FUSE implementation used within restic. `restic mount` is now more
responsive and uses less memory.
https://github.com/restic/restic/issues/1680
https://github.com/restic/restic/pull/2587
https://github.com/restic/restic/pull/2787
* Enhancement #2072: Display snapshot date when using `restic find`
Added the respective snapshot date to the output of `restic find`.
https://github.com/restic/restic/issues/2072
* Enhancement #2175: Allow specifying user and host when creating keys
When adding a new key to the repository, the username and hostname for the new key can be
specified on the command line. This allows overriding the defaults, for example if you would
prefer to use the FQDN to identify the host or if you want to add keys for several different hosts
without having to run the key add command on those hosts.
https://github.com/restic/restic/issues/2175
* Enhancement #2277: Add support for ppc64le
Adds support for ppc64le, the processor architecture from IBM.
https://github.com/restic/restic/issues/2277
* Enhancement #2395: Ignore sync errors when operation not supported by local filesystem
The local backend has been modified to work with filesystems which doesn't support the `sync`
operation. This operation is normally used by restic to ensure that data files are fully
written to disk before continuing.
For these limited filesystems, saving a file in the backend would previously fail with an
"operation not supported" error. This error is now ignored, which means that e.g. an SMB mount
on macOS can now be used as storage location for a repository.
https://github.com/restic/restic/issues/2395
https://forum.restic.net/t/sync-errors-on-mac-over-smb/1859
* Enhancement #2427: Add flag `--iexclude-file` to backup command
The backup command now supports the flag `--iexclude-file` which is a case-insensitive
version of `--exclude-file`.
https://github.com/restic/restic/issues/2427
https://github.com/restic/restic/pull/2898
* Enhancement #2569: Support excluding files by their size
The `backup` command now supports the `--exclude-larger-than` option to exclude files which
are larger than the specified maximum size. This can for example be useful to exclude
unimportant files with a large file size.
https://github.com/restic/restic/issues/2569
https://github.com/restic/restic/pull/2914
* Enhancement #2571: Self-heal missing file parts during backup of unchanged files
We've improved the resilience of restic to certain types of repository corruption.
For files that are unchanged since the parent snapshot, the backup command now verifies that
all parts of the files still exist in the repository. Parts that are missing, e.g. from a damaged
repository, are backed up again. This verification was already run for files that were
modified since the parent snapshot, but is now also done for unchanged files.
Note that restic will not backup file parts that are referenced in the index but where the actual
data is not present on disk, as this situation can only be detected by restic check. Please
ensure that you run `restic check` regularly.
https://github.com/restic/restic/issues/2571
https://github.com/restic/restic/pull/2827
* Enhancement #2858: Support filtering snapshots by tag and path in the stats command
We've added filtering snapshots by `--tag tagList` and by `--path path` to the `stats`
command. This includes filtering of only 'latest' snapshots or all snapshots in a repository.
https://github.com/restic/restic/issues/2858
https://github.com/restic/restic/pull/2859
https://forum.restic.net/t/stats-for-a-host-and-filtered-snapshots/3020
* Enhancement #323: Add command for copying snapshots between repositories
We've added a copy command, allowing you to copy snapshots from one repository to another.
Note that this process will have to read (download) and write (upload) the entire snapshot(s)
due to the different encryption keys used on the source and destination repository. Also, the
transferred files are not re-chunked, which may break deduplication between files already
stored in the destination repo and files copied there using this command.
To fully support deduplication between repositories when the copy command is used, the init
command now supports the `--copy-chunker-params` option, which initializes the new
repository with identical parameters for splitting files into chunks as an already existing
repository. This allows copied snapshots to be equally deduplicated in both repositories.
https://github.com/restic/restic/issues/323
https://github.com/restic/restic/pull/2606
https://github.com/restic/restic/pull/2928
* Enhancement #551: Use optimized library for hash calculation of file chunks
We've switched the library used to calculate the hashes of file chunks, which are used for
deduplication, to the optimized Minio SHA-256 implementation.
Depending on the CPU it improves the hashing throughput by 10-30%. Modern x86 CPUs with the SHA
Extension should be about two to three times faster.
https://github.com/restic/restic/issues/551
https://github.com/restic/restic/pull/2709
* Enhancement #2195: Simplify and improve restore performance
Significantly improves restore performance of large files (i.e. 50M+):
https://github.com/restic/restic/issues/2074
https://forum.restic.net/t/restore-using-rclone-gdrive-backend-is-slow/1112/8
https://forum.restic.net/t/degraded-restore-performance-s3-backend/1400
Fixes "not enough cache capacity" error during restore:
https://github.com/restic/restic/issues/2244
NOTE: This new implementation does not guarantee order in which blobs are written to the target
files and, for example, the last blob of a file can be written to the file before any of the
preceeding file blobs. It is therefore possible to have gaps in the data written to the target
files if restore fails or interrupted by the user.
The implementation will try to preallocate space for the restored files on the filesystem to
prevent file fragmentation. This ensures good read performance for large files, like for
example VM images. If preallocating space is not supported by the filesystem, then this step is
silently skipped.
https://github.com/restic/restic/pull/2195
https://github.com/restic/restic/pull/2893
* Enhancement #2328: Improve speed of check command
We've improved the check command to traverse trees only once independent of whether they are
contained in multiple snapshots. The check command is now much faster for repositories with a
large number of snapshots.
https://github.com/restic/restic/issues/2284
https://github.com/restic/restic/pull/2328
* Enhancement #2423: Support user@domain parsing as user
Added the ability for user@domain-like users to be authenticated over SFTP servers.
https://github.com/restic/restic/pull/2423
* Enhancement #2576: Improve the chunking algorithm
We've updated the chunker library responsible for splitting files into smaller blocks. It
should improve the chunking throughput by 5-15% depending on the CPU.
https://github.com/restic/restic/issues/2820
https://github.com/restic/restic/pull/2576
https://github.com/restic/restic/pull/2845
* Enhancement #2598: Improve speed of diff command
We've improved the performance of the diff command when comparing snapshots with similar
content. It should run up to twice as fast as before.
https://github.com/restic/restic/pull/2598
* Enhancement #2599: Slightly reduce memory usage of prune and stats commands
The prune and the stats command kept directory identifiers in memory twice while searching for
used blobs.
https://github.com/restic/restic/pull/2599
* Enhancement #2733: S3 backend: Add support for WebIdentityTokenFile
We've added support for EKS IAM roles for service accounts feature to the S3 backend.
https://github.com/restic/restic/issues/2703
https://github.com/restic/restic/pull/2733
* Enhancement #2773: Optimize handling of new index entries
Restic now uses less memory for backups which add a lot of data, e.g. large initial backups. In
addition, we've improved the stability in some edge cases.
https://github.com/restic/restic/pull/2773
* Enhancement #2781: Reduce memory consumption of in-memory index
We've improved how the index is stored in memory. This change can reduce memory usage for large
repositories by up to 50% (depending on the operation).
https://github.com/restic/restic/pull/2781
https://github.com/restic/restic/pull/2812
* Enhancement #2786: Optimize `list blobs` command
We've changed the implementation of `list blobs` which should be now a bit faster and consume
almost no memory even for large repositories.
https://github.com/restic/restic/pull/2786
* Enhancement #2790: Optimized file access in restic mount
Reading large (> 100GiB) files from restic mountpoints is now faster, and the speedup is
greater for larger files.
https://github.com/restic/restic/pull/2790
* Enhancement #2840: Speed-up file deletion in forget, prune and rebuild-index
We've sped up the file deletion for the commands forget, prune and rebuild-index, especially
for remote repositories. Deletion was sequential before and is now run in parallel.
https://github.com/restic/restic/pull/2840
Changelog for restic 0.9.6 (2019-11-22)
=======================================
The following sections list the changes in restic 0.9.6 relevant to
restic users. The changes are ordered by importance.
Summary
-------
* Fix #2063: Allow absolute path for filename when backing up from stdin
* Fix #2174: Save files with invalid timestamps
* Fix #2249: Read fresh metadata for unmodified files
* Fix #2301: Add upper bound for t in --read-data-subset=n/t
* Fix #2321: Check errors when loading index files
* Enh #2179: Use ctime when checking for file changes
* Enh #2306: Allow multiple retries for interactive password input
* Enh #2330: Make `--group-by` accept both singular and plural
* Enh #2350: Add option to configure S3 region
Details
-------
* Bugfix #2063: Allow absolute path for filename when backing up from stdin
When backing up from stdin, handle directory path for `--stdin-filename`. This can be used to
specify the full path for the backed-up file.
https://github.com/restic/restic/issues/2063
* Bugfix #2174: Save files with invalid timestamps
When restic reads invalid timestamps (year is before 0000 or after 9999) it refused to read and
archive the file. We've changed the behavior and will now save modified timestamps with the
year set to either 0000 or 9999, the rest of the timestamp stays the same, so the file will be saved
(albeit with a bogus timestamp).
https://github.com/restic/restic/issues/2174
https://github.com/restic/restic/issues/1173
* Bugfix #2249: Read fresh metadata for unmodified files
Restic took all metadata for files which were detected as unmodified, not taking into account
changed metadata (ownership, mode). This is now corrected.
https://github.com/restic/restic/issues/2249
https://github.com/restic/restic/pull/2252
* Bugfix #2301: Add upper bound for t in --read-data-subset=n/t
256 is the effective maximum for t, but restic would allow larger values, leading to strange
behavior.
https://github.com/restic/restic/issues/2301
https://github.com/restic/restic/pull/2304
* Bugfix #2321: Check errors when loading index files
Restic now checks and handles errors which occur when loading index files, the missing check
leads to odd errors (and a stack trace printed to users) later. This was reported in the forum.
https://github.com/restic/restic/pull/2321
https://forum.restic.net/t/check-rebuild-index-prune/1848/13
* Enhancement #2179: Use ctime when checking for file changes
Previously, restic only checked a file's mtime (along with other non-timestamp metadata) to
decide if a file has changed. This could cause restic to not notice that a file has changed (and
therefore continue to store the old version, as opposed to the modified version) if something
edits the file and then resets the timestamp. Restic now also checks the ctime of files, so any
modifications to a file should be noticed, and the modified file will be backed up. The ctime
check will be disabled if the --ignore-inode flag was given.
If this change causes problems for you, please open an issue, and we can look in to adding a
seperate flag to disable just the ctime check.
https://github.com/restic/restic/issues/2179
https://github.com/restic/restic/pull/2212
* Enhancement #2306: Allow multiple retries for interactive password input
Restic used to quit if the repository password was typed incorrectly once. Restic will now ask
the user again for the repository password if typed incorrectly. The user will now get three
tries to input the correct password before restic quits.
https://github.com/restic/restic/issues/2306
* Enhancement #2330: Make `--group-by` accept both singular and plural
One can now use the values `host`/`hosts`, `path`/`paths` and `tag` / `tags` interchangeably
in the `--group-by` argument.
https://github.com/restic/restic/issues/2330
* Enhancement #2350: Add option to configure S3 region
We've added a new option for setting the region when accessing an S3-compatible service. For
some providers, it is required to set this to a valid value. You can do that either by setting the
environment variable `AWS_DEFAULT_REGION` or using the option `s3.region`, e.g. like this:
`-o s3.region="us-east-1"`.
https://github.com/restic/restic/pull/2350
Changelog for restic 0.9.5 (2019-04-23)
=======================================
The following sections list the changes in restic 0.9.5 relevant to
restic users. The changes are ordered by importance.
Summary
-------
* Fix #2135: Return error when no bytes could be read from stdin
* Fix #2181: Don't cancel timeout after 30 seconds for self-update
* Fix #2203: Fix reading passwords from stdin
* Fix #2224: Don't abort the find command when a tree can't be loaded
* Enh #1895: Add case insensitive include & exclude options
* Enh #1937: Support streaming JSON output for backup
* Enh #2155: Add Openstack application credential auth for Swift
* Enh #2184: Add --json support to forget command
* Enh #2037: Add group-by option to snapshots command
* Enh #2124: Ability to dump folders to tar via stdout
* Enh #2139: Return error if no bytes could be read for `backup --stdin`
* Enh #2205: Add --ignore-inode option to backup cmd
* Enh #2220: Add config option to set S3 storage class
Details
-------
* Bugfix #2135: Return error when no bytes could be read from stdin
We assume that users reading backup data from stdin want to know when no data could be read, so now
restic returns an error when `backup --stdin` is called but no bytes could be read. Usually,
this means that an earlier command in a pipe has failed. The documentation was amended and now
recommends setting the `pipefail` option (`set -o pipefail`).
https://github.com/restic/restic/pull/2135
https://github.com/restic/restic/pull/2139
* Bugfix #2181: Don't cancel timeout after 30 seconds for self-update
https://github.com/restic/restic/issues/2181
* Bugfix #2203: Fix reading passwords from stdin
Passwords for the `init`, `key add`, and `key passwd` commands can now be read from
non-terminal stdin.
https://github.com/restic/restic/issues/2203
* Bugfix #2224: Don't abort the find command when a tree can't be loaded
Change the find command so that missing trees don't result in a crash. Instead, the error is
logged to the debug log, and the tree ID is displayed along with the snapshot it belongs to. This
makes it possible to recover repositories that are missing trees by forgetting the snapshots
they are used in.
https://github.com/restic/restic/issues/2224
* Enhancement #1895: Add case insensitive include & exclude options
The backup and restore commands now have --iexclude and --iinclude flags as case insensitive
variants of --exclude and --include.
https://github.com/restic/restic/issues/1895
https://github.com/restic/restic/pull/2032
* Enhancement #1937: Support streaming JSON output for backup
We've added support for getting machine-readable status output during backup, just pass the
flag `--json` for `restic backup` and restic will output a stream of JSON objects which contain
the current progress.
https://github.com/restic/restic/issues/1937
https://github.com/restic/restic/pull/1944
* Enhancement #2155: Add Openstack application credential auth for Swift
Since Openstack Queens Identity (auth V3) service supports an application credential auth
method. It allows to create a technical account with the limited roles. This commit adds an
application credential authentication method for the Swift backend.
https://github.com/restic/restic/issues/2155
* Enhancement #2184: Add --json support to forget command
The forget command now supports the --json argument, outputting the information about what is
(or would-be) kept and removed from the repository.
https://github.com/restic/restic/issues/2184
https://github.com/restic/restic/pull/2185
* Enhancement #2037: Add group-by option to snapshots command
We have added an option to group the output of the snapshots command, similar to the output of the
forget command. The option has been called "--group-by" and accepts any combination of the
values "host", "paths" and "tags", separated by commas. Default behavior (not specifying
--group-by) has not been changed. We have added support of the grouping to the JSON output.
https://github.com/restic/restic/issues/2037
https://github.com/restic/restic/pull/2087
* Enhancement #2124: Ability to dump folders to tar via stdout
We've added the ability to dump whole folders to stdout via the `dump` command. Restic now
requires at least Go 1.10 due to a limitation of the standard library for Go <= 1.9.
https://github.com/restic/restic/issues/2123
https://github.com/restic/restic/pull/2124
* Enhancement #2139: Return error if no bytes could be read for `backup --stdin`
When restic is used to backup the output of a program, like `mysqldump | restic backup --stdin`,
it now returns an error if no bytes could be read at all. This catches the failure case when
`mysqldump` failed for some reason and did not output any data to stdout.
https://github.com/restic/restic/pull/2139
* Enhancement #2205: Add --ignore-inode option to backup cmd
This option handles backup of virtual filesystems that do not keep fixed inodes for files, like
Fuse-based, pCloud, etc. Ignoring inode changes allows to consider the file as unchanged if
last modification date and size are unchanged.
https://github.com/restic/restic/issues/1631
https://github.com/restic/restic/pull/2205
https://github.com/restic/restic/pull/2047
* Enhancement #2220: Add config option to set S3 storage class
The `s3.storage-class` option can be passed to restic (using `-o`) to specify the storage
class to be used for S3 objects created by restic.
The storage class is passed as-is to S3, so it needs to be understood by the API. On AWS, it can be
one of `STANDARD`, `STANDARD_IA`, `ONEZONE_IA`, `INTELLIGENT_TIERING` and
`REDUCED_REDUNDANCY`. If unspecified, the default storage class is used (`STANDARD` on
AWS).
You can mix storage classes in the same bucket, and the setting isn't stored in the restic
repository, so be sure to specify it with each command that writes to S3.
https://github.com/restic/restic/issues/706
https://github.com/restic/restic/pull/2220
Changelog for restic 0.9.4 (2019-01-06)
=======================================
The following sections list the changes in restic 0.9.4 relevant to
restic users. The changes are ordered by importance.
Summary
-------
* Fix #1989: Google Cloud Storage: Respect bandwidth limit
* Fix #2040: Add host name filter shorthand flag for `stats` command
* Fix #2068: Correctly return error loading data
* Fix #2095: Consistently use local time for snapshots times
* Enh #1605: Concurrent restore
* Enh #2089: Increase granularity of the "keep within" retention policy
* Enh #2097: Add key hinting
* Enh #2017: Mount: Enforce FUSE Unix permissions with allow-other
* Enh #2070: Make all commands display timestamps in local time
* Enh #2085: Allow --files-from to be specified multiple times
* Enh #2094: Run command to get password
Details
-------
* Bugfix #1989: Google Cloud Storage: Respect bandwidth limit
The GCS backend did not respect the bandwidth limit configured, a previous commit
accidentally removed support for it.
https://github.com/restic/restic/issues/1989
https://github.com/restic/restic/pull/2100
* Bugfix #2040: Add host name filter shorthand flag for `stats` command
The default value for `--host` flag was set to 'H' (the shorthand version of the flag), this
caused the lookup for the latest snapshot to fail.
Add shorthand flag `-H` for `--host` (with empty default so if these flags are not specified the
latest snapshot will not filter by host name).
Also add shorthand `-H` for `backup` command.
https://github.com/restic/restic/issues/2040
* Bugfix #2068: Correctly return error loading data
In one case during `prune` and `check`, an error loading data from the backend is not returned
properly. This is now corrected.
https://github.com/restic/restic/issues/1999#issuecomment-433737921
https://github.com/restic/restic/pull/2068
* Bugfix #2095: Consistently use local time for snapshots times
By default snapshots created with restic backup were set to local time, but when the --time flag
was used the provided timestamp was parsed as UTC. With this change all snapshots times are set
to local time.
https://github.com/restic/restic/pull/2095
* Enhancement #1605: Concurrent restore
This change significantly improves restore performance, especially when using
high-latency remote repositories like B2.
The implementation now uses several concurrent threads to download and process multiple
remote files concurrently. To further reduce restore time, each remote file is downloaded
using a single repository request.
https://github.com/restic/restic/issues/1605
https://github.com/restic/restic/pull/1719
* Enhancement #2089: Increase granularity of the "keep within" retention policy
The `keep-within` option of the `forget` command now accepts time ranges with an hourly
granularity. For example, running `restic forget --keep-within 3d12h` will keep all the
snapshots made within three days and twelve hours from the time of the latest snapshot.
https://github.com/restic/restic/issues/2089
https://github.com/restic/restic/pull/2090
* Enhancement #2097: Add key hinting
Added a new option `--key-hint` and corresponding environment variable `RESTIC_KEY_HINT`.
The key hint is a key ID to try decrypting first, before other keys in the repository.
This change will benefit repositories with many keys; if the correct key hint is supplied then
restic only needs to check one key. If the key hint is incorrect (the key does not exist, or the
password is incorrect) then restic will check all keys, as usual.
https://github.com/restic/restic/issues/2097
* Enhancement #2017: Mount: Enforce FUSE Unix permissions with allow-other
The fuse mount (`restic mount`) now lets the kernel check the permissions of the files within
snapshots (this is done through the `DefaultPermissions` FUSE option) when the option
`--allow-other` is specified.
To restore the old behavior, we've added the `--no-default-permissions` option. This allows
all users that have access to the mount point to access all files within the snapshots.
https://github.com/restic/restic/pull/2017
* Enhancement #2070: Make all commands display timestamps in local time
Restic used to drop the timezone information from displayed timestamps, it now converts
timestamps to local time before printing them so the times can be easily compared to.
https://github.com/restic/restic/pull/2070
* Enhancement #2085: Allow --files-from to be specified multiple times
Before, restic took only the last file specified with `--files-from` into account, this is now
corrected.
https://github.com/restic/restic/issues/2085
https://github.com/restic/restic/pull/2086
* Enhancement #2094: Run command to get password
We've added the `--password-command` option which allows specifying a command that restic
runs every time the password for the repository is needed, so it can be integrated with a
password manager or keyring. The option can also be set via the environment variable
`$RESTIC_PASSWORD_COMMAND`.
https://github.com/restic/restic/pull/2094
Changelog for restic 0.9.3 (2018-10-13)
=======================================
@@ -8,7 +845,7 @@ Summary
-------
* Fix #1935: Remove truncated files from cache
* Fix #1978: Do not return an error when the scanner is faster than backup
* Fix #1978: Do not return an error when the scanner is slower than backup
* Enh #1766: Restore: suppress lchown errors when not running as root
* Enh #1909: Reject files/dirs by name first
* Enh #1940: Add directory filter to ls command
@@ -20,6 +857,7 @@ Summary
* Enh #1920: Vendor dependencies with Go 1.11 Modules
* Enh #1949: Add new command `self-update`
* Enh #1953: Ls: Add JSON output support for restic ls cmd
* Enh #1962: Stream JSON output for ls command
Details
-------
@@ -32,7 +870,7 @@ Details
https://github.com/restic/restic/issues/1935
* Bugfix #1978: Do not return an error when the scanner is faster than backup
* Bugfix #1978: Do not return an error when the scanner is slower than backup
When restic makes a backup, there's a background task called "scanner" which collects
information on how many files and directories are to be saved, in order to display progress
@@ -155,6 +993,18 @@ Details
https://github.com/restic/restic/pull/1953
* Enhancement #1962: Stream JSON output for ls command
The `ls` command now supports JSON output with the global `--json` flag, and this change
streams out JSON messages one object at a time rather than en entire array buffered in memory
before encoding. The advantage is it allows large listings to be handled efficiently.
Two message types are printed: snapshots and nodes. A snapshot object will precede node
objects which belong to that snapshot. The `struct_type` field can be used to determine which
kind of message an object is.
https://github.com/restic/restic/pull/1962
Changelog for restic 0.9.2 (2018-08-06)
=======================================
@@ -975,10 +1825,10 @@ Details
Exploiting the vulnerability requires a Linux/Unix system which saves backups via restic and
a Windows systems which restores files from the repo. In addition, the attackers need to be able
to create create files with arbitrary names which are then saved to the restic repo. For
example, by creating a file named "..\test.txt" (which is a perfectly legal filename on Linux)
and restoring a snapshot containing this file on Windows, it would be written to the parent of
the target directory.
to create files with arbitrary names which are then saved to the restic repo. For example, by
creating a file named "..\test.txt" (which is a perfectly legal filename on Linux) and
restoring a snapshot containing this file on Windows, it would be written to the parent of the
target directory.
We'd like to thank Tyler Spivey for reporting this responsibly!

View File

@@ -46,15 +46,12 @@ Remember, the easier it is for us to reproduce the bug, the earlier it will be
corrected!
In addition, you can compile restic with debug support by running
`go run -mod=vendor build.go -tags debug` and instructing it to create a debug
`go run build.go -tags debug` and instructing it to create a debug
log by setting the environment variable `DEBUG_LOG` to a file, e.g. like this:
$ export DEBUG_LOG=/tmp/restic-debug.log
$ restic backup ~/work
For Go < 1.11, you need to remove the `-mod=vendor` option from the build
command.
Please be aware that the debug log file will contain potentially sensitive
things like file and directory names, so please either redact it before
uploading it somewhere or post only the parts that are really relevant.
@@ -63,16 +60,11 @@ uploading it somewhere or post only the parts that are really relevant.
Development Environment
=======================
The repository contains several sets of directories with code: `cmd/` and
`internal/` contain the code written for restic, whereas `vendor/` contains
copies of libraries restic depends on. The libraries are managed with the
command `go mod vendor`.
The repository contains the code written for restic in the directories
`cmd/` and `internal/`.
Go >= 1.11
----------
For Go version 1.11 or later, you should clone the repo (without having
`$GOPATH` set) and `cd` into the directory:
Restic requires Go version 1.12 or later for compiling. Clone the repo (without
having `$GOPATH` set) and `cd` into the directory:
$ unset GOPATH
$ git clone https://github.com/restic/restic
@@ -82,40 +74,12 @@ Then use the `go` tool to build restic:
$ go build ./cmd/restic
$ ./restic version
restic 0.9.2-dev (compiled manually) compiled with go1.11 on linux/amd64
restic 0.9.6-dev (compiled manually) compiled with go1.14 on linux/amd64
You can run all tests with the following command:
$ go test ./...
Go < 1.11
---------
In order to compile restic with Go before 1.11, it needs to be checked out at
the right path within a `GOPATH`. The concept of a `GOPATH` is explained in
["How to write Go code"](https://golang.org/doc/code.html).
If you do not have a directory with Go code yet, executing the following
instructions in your shell will create one for you and check out the restic
repo:
$ export GOPATH="$HOME/go"
$ mkdir -p "$GOPATH/src/github.com/restic"
$ cd "$GOPATH/src/github.com/restic"
$ git clone https://github.com/restic/restic
$ cd restic
You can then build restic as follows:
$ go build ./cmd/restic
$ ./restic version
restic compiled manually
compiled with go1.8.3 on linux/amd64
The following commands can be used to run all the tests:
$ go test ./...
Providing Patches
=================
@@ -128,21 +92,19 @@ down to the following steps:
GitHub. For a new feature, please add an issue before starting to work on
it, so that duplicate work is prevented.
1. First we would kindly ask you to fork our project on GitHub if you haven't
done so already.
1. Next, fork our project on GitHub if you haven't done so already.
2. Clone the repository locally and create a new branch. If you are working on
the code itself, please set up the development environment as described in
the previous section. Especially take care to place your forked repository
at the correct path (`src/github.com/restic/restic`) within your `GOPATH`.
2. Clone your fork of the repository locally and **create a new branch** for
your changes. If you are working on the code itself, please set up the
development environment as described in the previous section.
3. Then commit your changes as fine grained as possible, as smaller patches,
that handle one and only one issue are easier to discuss and merge.
3. Commit your changes to the new branch as fine grained as possible, as
smaller patches, for individual changes, are easier to discuss and merge.
4. Push the new branch with your changes to your fork of the repository.
5. Create a pull request by visiting the GitHub website, it will guide you
through the process.
through the process. Please [allow edits from maintainers](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/allowing-changes-to-a-pull-request-branch-created-from-a-fork).
6. You will receive comments on your code and the feature or bug that they
address. Maybe you need to rework some minor things, in this case push new
@@ -150,17 +112,19 @@ down to the following steps:
existing commit, use common sense to decide which is better), they will be
automatically added to the pull request.
7. If your pull request changes anything that users should be aware of (a
bugfix, a new feature, ...) please add an entry to the file
['CHANGELOG.md'](CHANGELOG.md). It will be used in the announcement of the
next stable release. While writing, ask yourself: If I were the user, what
would I need to be aware of with this change.
7. If your pull request changes anything that users should be aware of
(a bugfix, a new feature, ...) please add an entry as a new file in
`changelog/unreleased` including the issue number in the filename (e.g.
`issue-8756`). Use the template in `changelog/TEMPLATE` for the content.
It will be used in the announcement of the next stable release. While
writing, ask yourself: If I were the user, what would I need to be aware
of with this change?
8. Once your code looks good and passes all the tests, we'll merge it. Thanks
a lot for your contribution!
Please provide the patches for each bug or feature in a separate branch and
open up a pull request for each.
open up a pull request for each, as this simplifies discussion and merging.
The restic project uses the `gofmt` tool for Go source indentation, so please
run

View File

@@ -3,7 +3,7 @@
all: restic
restic:
go run -mod=vendor build.go || go run build.go
go run build.go
clean:
rm -f restic

View File

@@ -1,9 +1,9 @@
|Documentation| |Build Status| |Build status| |Report Card| |Say Thanks| |TestCoverage| |Reviewed by Hound|
|Documentation| |Build Status| |Build status| |Report Card| |Say Thanks| |Reviewed by Hound|
Introduction
------------
restic is a backup program that is fast, efficient and secure.
restic is a backup program that is fast, efficient and secure. It supports the three major operating systems (Linux, macOS, Windows) and a few smaller ones (FreeBSD, OpenBSD).
For detailed usage and installation instructions check out the `documentation <https://restic.readthedocs.io/en/latest>`__.
@@ -129,8 +129,6 @@ Storage are sponsored by `AppsCode <https://appscode.com>`__!
:target: https://goreportcard.com/report/github.com/restic/restic
.. |Say Thanks| image:: https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg
:target: https://saythanks.io/to/restic
.. |TestCoverage| image:: https://codecov.io/gh/restic/restic/branch/master/graph/badge.svg
:target: https://codecov.io/gh/restic/restic
.. |AppsCode| image:: https://cdn.appscode.com/images/logo/appscode/ac-logo-color.png
:target: https://appscode.com
.. |Reviewed by Hound| image:: https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg

View File

@@ -1 +1 @@
0.9.3
0.10.0

View File

@@ -20,8 +20,8 @@ init:
install:
- rmdir c:\go /s /q
- appveyor DownloadFile https://dl.google.com/go/go1.11.windows-amd64.msi
- msiexec /i go1.11.windows-amd64.msi /q
- appveyor DownloadFile https://dl.google.com/go/go1.15.2.windows-amd64.msi
- msiexec /i go1.15.2.windows-amd64.msi /q
- go version
- go env
- appveyor DownloadFile http://sourceforge.netcologne.de/project/gnuwin32/tar/1.13-1/tar-1.13-1-bin.zip -FileName tar.zip
@@ -29,4 +29,4 @@ install:
- set PATH=bin/;%PATH%
build_script:
- go run -mod=vendor run_integration_tests.go
- go run run_integration_tests.go

280
build.go
View File

@@ -3,22 +3,15 @@
// This program aims to make building Go programs for end users easier by just
// calling it with `go run`, without having to setup a GOPATH.
//
// For Go < 1.11, it'll create a new GOPATH in a temporary directory, then run
// `go build` on the package configured as Main in the Config struct.
//
// For Go >= 1.11 if the file go.mod is present, it'll use Go modules and not
// setup a GOPATH. It builds the package configured as Main in the Config
// struct with `go build -mod=vendor` to use the vendored dependencies.
// The variable GOPROXY is set to `off` so that no network calls are made. All
// files are copied to a temporary directory before `go build` is called within
// that directory.
// This program needs Go >= 1.12. It'll use Go modules for compilation. It
// builds the package configured as Main in the Config struct.
// BSD 2-Clause License
//
// Copyright (c) 2016-2018, Alexander Neumann <alexander@bumpern.de>
// All rights reserved.
//
// This file has been copied from the repository at:
// This file has been derived from the repository at:
// https://github.com/fd0/build-go
//
// Redistribution and use in source and binary forms, with or without
@@ -60,12 +53,12 @@ import (
// config contains the configuration for the program to build.
var config = Config{
Name: "restic", // name of the program executable and directory
Namespace: "github.com/restic/restic", // subdir of GOPATH, e.g. "github.com/foo/bar"
Main: "./cmd/restic", // package name for the main package
DefaultBuildTags: []string{"selfupdate"}, // specify build tags which are always used
Tests: []string{"./..."}, // tests to run
MinVersion: GoVersion{Major: 1, Minor: 9, Patch: 0}, // minimum Go version supported
Name: "restic", // name of the program executable and directory
Namespace: "github.com/restic/restic", // subdir of GOPATH, e.g. "github.com/foo/bar"
Main: "./cmd/restic", // package name for the main package
DefaultBuildTags: []string{"selfupdate"}, // specify build tags which are always used
Tests: []string{"./..."}, // tests to run
MinVersion: GoVersion{Major: 1, Minor: 11, Patch: 0}, // minimum Go version supported
}
// Config configures the build.
@@ -79,125 +72,13 @@ type Config struct {
}
var (
verbose bool
keepGopath bool
runTests bool
enableCGO bool
enablePIE bool
goVersion = ParseGoVersion(runtime.Version())
verbose bool
runTests bool
enableCGO bool
enablePIE bool
goVersion = ParseGoVersion(runtime.Version())
)
// copy all Go files in src to dst, creating directories on the fly, so calling
//
// copy("/tmp/gopath/src/github.com/restic/restic", "/home/u/restic")
//
// with "/home/u/restic" containing the file "foo.go" yields the following tree
// at "/tmp/gopath":
//
// /tmp/gopath
// └── src
// └── github.com
// └── restic
// └── restic
// └── foo.go
func copy(dst, src string) error {
verbosePrintf("copy contents of %v to %v\n", src, dst)
return filepath.Walk(src, func(name string, fi os.FileInfo, err error) error {
if name == src {
return err
}
if name == ".git" {
return filepath.SkipDir
}
if err != nil {
return err
}
if fi.IsDir() {
return nil
}
intermediatePath, err := filepath.Rel(src, name)
if err != nil {
return err
}
fileSrc := filepath.Join(src, intermediatePath)
fileDst := filepath.Join(dst, intermediatePath)
return copyFile(fileDst, fileSrc)
})
}
func directoryExists(dirname string) bool {
stat, err := os.Stat(dirname)
if err != nil && os.IsNotExist(err) {
return false
}
return stat.IsDir()
}
func fileExists(filename string) bool {
stat, err := os.Stat(filename)
if err != nil && os.IsNotExist(err) {
return false
}
return stat.Mode().IsRegular()
}
// copyFile creates dst from src, preserving file attributes and timestamps.
func copyFile(dst, src string) error {
fi, err := os.Stat(src)
if err != nil {
return err
}
fsrc, err := os.Open(src)
if err != nil {
return err
}
if err = os.MkdirAll(filepath.Dir(dst), 0755); err != nil {
fmt.Printf("MkdirAll(%v)\n", filepath.Dir(dst))
return err
}
fdst, err := os.Create(dst)
if err != nil {
_ = fsrc.Close()
return err
}
_, err = io.Copy(fdst, fsrc)
if err != nil {
_ = fsrc.Close()
_ = fdst.Close()
return err
}
err = fdst.Close()
if err != nil {
_ = fsrc.Close()
return err
}
err = fsrc.Close()
if err != nil {
return err
}
err = os.Chmod(dst, fi.Mode())
if err != nil {
return err
}
return os.Chtimes(dst, fi.ModTime(), fi.ModTime())
}
// die prints the message with fmt.Fprintf() to stderr and exits with an error
// code.
func die(message string, args ...interface{}) {
@@ -211,7 +92,6 @@ func showUsage(output io.Writer) {
fmt.Fprintf(output, "OPTIONS:\n")
fmt.Fprintf(output, " -v --verbose output more messages\n")
fmt.Fprintf(output, " -t --tags specify additional build tags\n")
fmt.Fprintf(output, " -k --keep-tempdir do not remove the temporary directory after build\n")
fmt.Fprintf(output, " -T --test run tests\n")
fmt.Fprintf(output, " -o --output set output file name\n")
fmt.Fprintf(output, " --enable-cgo use CGO to link against libc\n")
@@ -219,7 +99,6 @@ func showUsage(output io.Writer) {
fmt.Fprintf(output, " --goos value set GOOS for cross-compilation\n")
fmt.Fprintf(output, " --goarch value set GOARCH for cross-compilation\n")
fmt.Fprintf(output, " --goarm value set GOARM for cross-compilation\n")
fmt.Fprintf(output, " --tempdir dir use a specific directory for compilation\n")
}
func verbosePrintf(message string, args ...interface{}) {
@@ -230,49 +109,39 @@ func verbosePrintf(message string, args ...interface{}) {
fmt.Printf("build: "+message, args...)
}
// cleanEnv returns a clean environment with GOPATH, GOBIN and GO111MODULE
// removed (if present).
func cleanEnv() (env []string) {
removeKeys := map[string]struct{}{
"GOPATH": struct{}{},
"GOBIN": struct{}{},
"GO111MODULE": struct{}{},
}
for _, v := range os.Environ() {
data := strings.SplitN(v, "=", 2)
name := data[0]
if _, ok := removeKeys[name]; ok {
// printEnv prints Go-relevant environment variables in a nice way using verbosePrintf.
func printEnv(env []string) {
verbosePrintf("environment (GO*):\n")
for _, v := range env {
// ignore environment variables which do not start with GO*.
if !strings.HasPrefix(v, "GO") {
continue
}
env = append(env, v)
verbosePrintf(" %s\n", v)
}
return env
}
// build runs "go build args..." with GOPATH set to gopath.
func build(cwd string, env map[string]string, args ...string) error {
a := []string{"build"}
if goVersion.AtLeast(GoVersion{1, 10, 0}) {
verbosePrintf("Go version is at least 1.10, using new syntax for -gcflags\n")
// use new prefix
// try to remove all absolute paths from resulting binary
if goVersion.AtLeast(GoVersion{1, 13, 0}) {
// use the new flag introduced by Go 1.13
a = append(a, "-trimpath")
} else {
// otherwise try to trim as many paths as possible
a = append(a, "-asmflags", fmt.Sprintf("all=-trimpath=%s", cwd))
a = append(a, "-gcflags", fmt.Sprintf("all=-trimpath=%s", cwd))
} else {
a = append(a, "-asmflags", fmt.Sprintf("-trimpath=%s", cwd))
a = append(a, "-gcflags", fmt.Sprintf("-trimpath=%s", cwd))
}
if enablePIE {
a = append(a, "-buildmode=pie")
}
a = append(a, args...)
cmd := exec.Command("go", a...)
cmd.Env = append(cleanEnv(), "GOPROXY=off")
cmd.Env = os.Environ()
for k, v := range env {
cmd.Env = append(cmd.Env, k+"="+v)
}
@@ -280,6 +149,8 @@ func build(cwd string, env map[string]string, args ...string) error {
cmd.Env = append(cmd.Env, "CGO_ENABLED=0")
}
printEnv(cmd.Env)
cmd.Dir = cwd
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
@@ -294,7 +165,7 @@ func build(cwd string, env map[string]string, args ...string) error {
func test(cwd string, env map[string]string, args ...string) error {
args = append([]string{"test", "-count", "1"}, args...)
cmd := exec.Command("go", args...)
cmd.Env = append(cleanEnv(), "GOPROXY=off")
cmd.Env = os.Environ()
for k, v := range env {
cmd.Env = append(cmd.Env, k+"="+v)
}
@@ -305,6 +176,8 @@ func test(cwd string, env map[string]string, args ...string) error {
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
printEnv(cmd.Env)
verbosePrintf("chdir %q\n", cwd)
verbosePrintf("go %q\n", args)
@@ -454,6 +327,10 @@ func (v GoVersion) String() string {
}
func main() {
if !goVersion.AtLeast(GoVersion{1, 12, 0}) {
die("Go version (%v) is too old, restic requires Go >= 1.12\n", goVersion)
}
if !goVersion.AtLeast(config.MinVersion) {
fmt.Fprintf(os.Stderr, "%s detected, this program requires at least %s\n", goVersion, config.MinVersion)
os.Exit(1)
@@ -464,15 +341,13 @@ func main() {
skipNext := false
params := os.Args[1:]
goEnv := map[string]string{}
buildEnv := map[string]string{
"GOOS": runtime.GOOS,
"GOARCH": runtime.GOARCH,
"GOARM": "",
env := map[string]string{
"GO111MODULE": "on", // make sure we build in Module mode
"GOOS": runtime.GOOS,
"GOARCH": runtime.GOARCH,
"GOARM": "",
}
tempdir := ""
var outputFilename string
for i, arg := range params {
@@ -484,8 +359,6 @@ func main() {
switch arg {
case "-v", "--verbose":
verbose = true
case "-k", "--keep-gopath":
keepGopath = true
case "-t", "-tags", "--tags":
if i+1 >= len(params) {
die("-t given but no tag specified")
@@ -495,9 +368,6 @@ func main() {
case "-o", "--output":
skipNext = true
outputFilename = params[i+1]
case "--tempdir":
skipNext = true
tempdir = params[i+1]
case "-T", "--test":
runTests = true
case "--enable-cgo":
@@ -506,13 +376,13 @@ func main() {
enablePIE = true
case "--goos":
skipNext = true
buildEnv["GOOS"] = params[i+1]
env["GOOS"] = params[i+1]
case "--goarch":
skipNext = true
buildEnv["GOARCH"] = params[i+1]
env["GOARCH"] = params[i+1]
case "--goarm":
skipNext = true
buildEnv["GOARM"] = params[i+1]
env["GOARM"] = params[i+1]
case "-h":
showUsage(os.Stdout)
return
@@ -525,8 +395,12 @@ func main() {
verbosePrintf("detected Go version %v\n", goVersion)
preserveSymbols := false
for i := range buildTags {
buildTags[i] = strings.TrimSpace(buildTags[i])
if buildTags[i] == "debug" || buildTags[i] == "profile" {
preserveSymbols = true
}
}
verbosePrintf("build tags: %s\n", buildTags)
@@ -538,7 +412,7 @@ func main() {
if outputFilename == "" {
outputFilename = config.Name
if buildEnv["GOOS"] == "windows" {
if env["GOOS"] == "windows" {
outputFilename += ".exe"
}
}
@@ -553,7 +427,11 @@ func main() {
if version != "" {
constants["main.version"] = version
}
ldflags := "-s -w " + constants.LDFlags()
ldflags := constants.LDFlags()
if !preserveSymbols {
// Strip debug symbols.
ldflags = "-s -w " + ldflags
}
verbosePrintf("ldflags: %s\n", ldflags)
var (
@@ -567,54 +445,18 @@ func main() {
}
buildTarget := filepath.FromSlash(mainPackage)
buildCWD := ""
if goVersion.AtLeast(GoVersion{1, 11, 0}) && fileExists("go.mod") {
verbosePrintf("Go >= 1.11 and 'go.mod' found, building with modules\n")
buildCWD = root
buildArgs = append(buildArgs, "-mod=vendor")
testArgs = append(testArgs, "-mod=vendor")
} else {
if tempdir == "" {
tempdir, err = ioutil.TempDir("", fmt.Sprintf("%v-build-", config.Name))
if err != nil {
die("TempDir(): %v\n", err)
}
}
verbosePrintf("Go < 1.11 or 'go.mod' not found, create GOPATH at %v\n", tempdir)
targetdir := filepath.Join(tempdir, "src", filepath.FromSlash(config.Namespace))
if err = copy(targetdir, root); err != nil {
die("copying files from %v to %v/src failed: %v\n", root, tempdir, err)
}
defer func() {
if !keepGopath {
verbosePrintf("remove %v\n", tempdir)
if err = os.RemoveAll(tempdir); err != nil {
die("remove GOPATH at %s failed: %v\n", tempdir, err)
}
} else {
verbosePrintf("leaving temporary GOPATH at %v\n", tempdir)
}
}()
buildCWD = targetdir
goEnv["GOPATH"] = tempdir
buildEnv["GOPATH"] = tempdir
buildCWD, err := os.Getwd()
if err != nil {
die("unable to determine current working directory: %v\n", err)
}
verbosePrintf("environment:\n go: %v\n build: %v\n", goEnv, buildEnv)
buildArgs = append(buildArgs,
"-tags", strings.Join(buildTags, " "),
"-ldflags", ldflags,
"-o", output, buildTarget,
)
err = build(buildCWD, buildEnv, buildArgs...)
err = build(buildCWD, env, buildArgs...)
if err != nil {
die("build failed: %v\n", err)
}
@@ -624,7 +466,7 @@ func main() {
testArgs = append(testArgs, config.Tests...)
err = test(buildCWD, goEnv, testArgs...)
err = test(buildCWD, env, testArgs...)
if err != nil {
die("running tests failed: %v\n", err)
}

View File

View File

@@ -0,0 +1,9 @@
Enhancement: Support specifying multiple host flags for various commands
Previously commands didn't take more than one `--host` or `-H` argument into account, which could be limiting with e.g.
the `forget` command.
The `dump`, `find`, `forget`, `ls`, `mount`, `restore`, `snapshots`, `stats` and `tag` commands will now take into account
multiple `--host` and `-H` flags.
https://github.com/restic/restic/issues/1570

View File

@@ -0,0 +1,8 @@
Enhancement: Optimize `restic mount`
We've optimized the FUSE implementation used within restic.
`restic mount` is now more responsive and uses less memory.
https://github.com/restic/restic/issues/1680
https://github.com/restic/restic/pull/2587
https://github.com/restic/restic/pull/2787

View File

@@ -0,0 +1,6 @@
Bugfix: Report correct number of directories processed by backup
The directory statistics calculation was fixed to report the actual number
of processed directories instead of always zero.
https://github.com/restic/restic/issues/1863

View File

@@ -0,0 +1,5 @@
Enhancement: Display snapshot date when using `restic find`
Added the respective snapshot date to the output of `restic find`.
https://github.com/restic/restic/issues/2072

View File

@@ -0,0 +1,9 @@
Enhancement: Allow specifying user and host when creating keys
When adding a new key to the repository, the username and hostname for the new
key can be specified on the command line. This allows overriding the defaults,
for example if you would prefer to use the FQDN to identify the host or if you
want to add keys for several different hosts without having to run the key add
command on those hosts.
https://github.com/restic/restic/issues/2175

View File

@@ -0,0 +1,9 @@
Bugfix: Fix tar issues when dumping `/`
We've fixed an issue with dumping either `/` or files on the first sublevel
e.g. `/foo` to tar. This also fixes tar dumping issues on Windows where this
issue could also happen.
https://github.com/restic/restic/issues/2254
https://github.com/restic/restic/issues/2357
https://github.com/restic/restic/pull/2255

View File

@@ -0,0 +1,5 @@
Enhancement: Add support for ppc64le
Adds support for ppc64le, the processor architecture from IBM.
https://github.com/restic/restic/issues/2277

View File

@@ -0,0 +1,7 @@
Bugfix: Handle format verbs like '%' properly in `find` output
The JSON or "normal" output of the `find` command can now deal with file names
that contain substrings which the Golang `fmt` package considers "format verbs"
like `%s`.
https://github.com/restic/restic/issues/2281

View File

@@ -0,0 +1,8 @@
Bugfix: Do not hang when run as a background job
Restic did hang on exit while restoring the terminal configuration when it was
started as a background job, for example using `restic ... &`. This has been
fixed by only restoring the terminal configuration when restic is interrupted
while reading a password from the terminal.
https://github.com/restic/restic/issues/2298

View File

@@ -0,0 +1,8 @@
Bugfix: Fix mangled json output of backup command
We've fixed a race condition in the json output of the backup command
that could cause multiple lines to get mixed up. We've also ensured that
the backup summary is printed last.
https://github.com/restic/restic/issues/2389
https://github.com/restic/restic/pull/2545

View File

@@ -0,0 +1,5 @@
Bugfix: Refresh lock timestamp
Long-running operations did not refresh lock timestamp, resulting in locks becoming stale. This is now fixed.
https://github.com/restic/restic/issues/2390

View File

@@ -0,0 +1,12 @@
Enhancement: Ignore sync errors when operation not supported by local filesystem
The local backend has been modified to work with filesystems which doesn't support
the `sync` operation. This operation is normally used by restic to ensure that data
files are fully written to disk before continuing.
For these limited filesystems, saving a file in the backend would previously fail with
an "operation not supported" error. This error is now ignored, which means that e.g.
an SMB mount on macOS can now be used as storage location for a repository.
https://github.com/restic/restic/issues/2395
https://forum.restic.net/t/sync-errors-on-mac-over-smb/1859

View File

@@ -0,0 +1,7 @@
Enhancement: Add flag `--iexclude-file` to backup command
The backup command now supports the flag `--iexclude-file` which is a
case-insensitive version of `--exclude-file`.
https://github.com/restic/restic/issues/2427
https://github.com/restic/restic/pull/2898

View File

@@ -0,0 +1,6 @@
Bugfix: backup --json reports total_bytes_processed as 0
We've fixed the json output of total_bytes_processed. The non-json output
was already fixed with pull request #2138 but left the json output untouched.
https://github.com/restic/restic/issues/2429

View File

@@ -0,0 +1,5 @@
Bugfix: Fix incorrect bytes stats in `diff` command
In some cases, the wrong number of bytes (e.g. 16777215.998 TiB) were reported by the `diff` command. This is now fixed.
https://github.com/restic/restic/issues/2469

View File

@@ -0,0 +1,9 @@
Change: Remove vendored dependencies
We've removed the vendored dependencies (in the subdir `vendor/`). When
building restic, the Go compiler automatically fetches the dependencies. It
will also cryptographically verify that the correct code has been fetched by
using the hashes in `go.sum` (see the link to the documentation below).
https://github.com/restic/restic/issues/2482
https://golang.org/cmd/go/#hdr-Module_downloading_and_verification

View File

@@ -0,0 +1,16 @@
Bugfix: Do not crash with Synology NAS sftp server
It was found that when restic is used to store data on an sftp server on a
Synology NAS with a relative path (one which does not start with a slash), it
may go into an endless loop trying to create directories on the server. We've
fixed this bug by using a function in the sftp library instead of our own
implementation.
The bug was discovered because the Synology sftp server behaves erratic with
non-absolute path (e.g. `home/restic-repo`). This can be resolved by just using
an absolute path instead (`/home/restic-repo`). We've also added a paragraph in
the FAQ.
https://github.com/restic/restic/issues/2518
https://github.com/restic/restic/issues/2363
https://github.com/restic/restic/pull/2530

View File

@@ -0,0 +1,5 @@
Bugfix: Fix incorrect size calculation in `stats --mode restore-size`
The restore-size mode of stats was counting hard-linked files as if they were independent.
https://github.com/restic/restic/issues/2531

View File

@@ -0,0 +1,5 @@
Bugfix: Fix incorrect file counts in `stats --mode restore-size`
The restore-size mode of stats was failing to count empty directories and some files with hard links.
https://github.com/restic/restic/issues/2537

View File

@@ -0,0 +1,8 @@
Enhancement: Support excluding files by their size
The `backup` command now supports the `--exclude-larger-than` option to exclude files which are
larger than the specified maximum size. This can for example be useful to exclude unimportant
files with a large file size.
https://github.com/restic/restic/issues/2569
https://github.com/restic/restic/pull/2914

View File

@@ -0,0 +1,16 @@
Enhancement: Self-heal missing file parts during backup of unchanged files
We've improved the resilience of restic to certain types of repository corruption.
For files that are unchanged since the parent snapshot, the backup command now
verifies that all parts of the files still exist in the repository. Parts that are
missing, e.g. from a damaged repository, are backed up again. This verification
was already run for files that were modified since the parent snapshot, but is
now also done for unchanged files.
Note that restic will not backup file parts that are referenced in the index but
where the actual data is not present on disk, as this situation can only be
detected by restic check. Please ensure that you run `restic check` regularly.
https://github.com/restic/restic/issues/2571
https://github.com/restic/restic/pull/2827

View File

@@ -0,0 +1,9 @@
Enhancement: Support filtering snapshots by tag and path in the stats command
We've added filtering snapshots by `--tag tagList` and by `--path path` to
the `stats` command. This includes filtering of only 'latest' snapshots or
all snapshots in a repository.
https://github.com/restic/restic/issues/2858
https://github.com/restic/restic/pull/2859
https://forum.restic.net/t/stats-for-a-host-and-filtered-snapshots/3020

View File

@@ -0,0 +1,20 @@
Enhancement: Add command for copying snapshots between repositories
We've added a copy command, allowing you to copy snapshots from one
repository to another.
Note that this process will have to read (download) and write (upload) the
entire snapshot(s) due to the different encryption keys used on the source
and destination repository. Also, the transferred files are not re-chunked,
which may break deduplication between files already stored in the
destination repo and files copied there using this command.
To fully support deduplication between repositories when the copy command is
used, the init command now supports the `--copy-chunker-params` option,
which initializes the new repository with identical parameters for splitting
files into chunks as an already existing repository. This allows copied
snapshots to be equally deduplicated in both repositories.
https://github.com/restic/restic/issues/323
https://github.com/restic/restic/pull/2606
https://github.com/restic/restic/pull/2928

View File

@@ -0,0 +1,10 @@
Enhancement: Use optimized library for hash calculation of file chunks
We've switched the library used to calculate the hashes of file chunks, which
are used for deduplication, to the optimized Minio SHA-256 implementation.
Depending on the CPU it improves the hashing throughput by 10-30%. Modern x86
CPUs with the SHA Extension should be about two to three times faster.
https://github.com/restic/restic/issues/551
https://github.com/restic/restic/pull/2709

View File

@@ -0,0 +1,23 @@
Enhancement: Simplify and improve restore performance
Significantly improves restore performance of large files (i.e. 50M+):
https://github.com/restic/restic/issues/2074
https://forum.restic.net/t/restore-using-rclone-gdrive-backend-is-slow/1112/8
https://forum.restic.net/t/degraded-restore-performance-s3-backend/1400
Fixes "not enough cache capacity" error during restore:
https://github.com/restic/restic/issues/2244
NOTE: This new implementation does not guarantee order in which blobs
are written to the target files and, for example, the last blob of a
file can be written to the file before any of the preceeding file blobs.
It is therefore possible to have gaps in the data written to the target
files if restore fails or interrupted by the user.
The implementation will try to preallocate space for the restored files
on the filesystem to prevent file fragmentation. This ensures good read
performance for large files, like for example VM images. If preallocating
space is not supported by the filesystem, then this step is silently skipped.
https://github.com/restic/restic/pull/2195
https://github.com/restic/restic/pull/2893

View File

@@ -0,0 +1,8 @@
Enhancement: Improve speed of check command
We've improved the check command to traverse trees only once independent of
whether they are contained in multiple snapshots. The check command is now much
faster for repositories with a large number of snapshots.
https://github.com/restic/restic/pull/2328
https://github.com/restic/restic/issues/2284

View File

@@ -0,0 +1,5 @@
Enhancement: support user@domain parsing as user
Added the ability for user@domain-like users to be authenticated over SFTP servers.
https://github.com/restic/restic/pull/2423

View File

@@ -0,0 +1,19 @@
Change: Return exit code 3 when failing to backup all source data
The backup command used to return a zero exit code as long as a snapshot
could be created successfully, even if some of the source files could not
be read (in which case the snapshot would contain the rest of the files).
This made it hard for automation/scripts to detect failures/incomplete
backups by looking at the exit code. Restic now returns the following exit
codes for the backup command:
- 0 when the command was successful
- 1 when there was a fatal error (no snapshot created)
- 3 when some source data could not be read (incomplete snapshot created)
https://github.com/restic/restic/pull/2546
https://github.com/restic/restic/issues/956
https://github.com/restic/restic/issues/2064
https://github.com/restic/restic/issues/2526
https://github.com/restic/restic/issues/2364

View File

@@ -0,0 +1,9 @@
Enhancement: Improve the chunking algorithm
We've updated the chunker library responsible for splitting files into smaller
blocks. It should improve the chunking throughput by 5-15% depending on the
CPU.
https://github.com/restic/restic/pull/2576
https://github.com/restic/restic/pull/2845
https://github.com/restic/restic/issues/2820

View File

@@ -0,0 +1,6 @@
Bugfix: SFTP backend supports IPv6 addresses
The SFTP backend now supports IPv6 addresses natively, without relying on
aliases in the external SSH configuration.
https://github.com/restic/restic/pull/2592

View File

@@ -0,0 +1,6 @@
Enhancement: Improve speed of diff command
We've improved the performance of the diff command when comparing snapshots
with similar content. It should run up to twice as fast as before.
https://github.com/restic/restic/pull/2598

View File

@@ -0,0 +1,6 @@
Enhancement: Slightly reduce memory usage of prune and stats commands
The prune and the stats command kept directory identifiers in memory twice
while searching for used blobs.
https://github.com/restic/restic/pull/2599

View File

@@ -0,0 +1,14 @@
Change: Update dependencies, require Go >= 1.13
Restic now requires Go to be at least 1.13. This allows simplifications in the
build process and removing workarounds.
This is also probably the last version of restic still supporting mounting
repositories via fuse on macOS. The library we're using for fuse does not
support macOS any more and osxfuse is not open source any more.
https://github.com/restic/restic/pull/2600
https://github.com/restic/restic/pull/2852
https://github.com/restic/restic/pull/2927
https://github.com/bazil/fuse/issues/224
https://github.com/osxfuse/osxfuse/issues/590

View File

@@ -0,0 +1,7 @@
Bugfix: Honor RESTIC_CACHE_DIR environment variable on Mac and Windows
On Mac and Windows, the RESTIC_CACHE_DIR environment variable was ignored.
This variable can now be used on all platforms to set the directory where
restic stores caches.
https://github.com/restic/restic/pull/2607

View File

@@ -0,0 +1,6 @@
Bugfix: Don't abort the stats command when data blobs are missing
Runing the stats command in the blobs-per-file mode on a repository with
missing data blobs previously resulted in a crash.
https://github.com/restic/restic/pull/2668

View File

@@ -0,0 +1,8 @@
Bugfix: Add stricter prune error checks
Additional checks were added to the prune command in order to improve
resiliency to backend, hardware and/or networking issues. The checks now
detect a few more cases where such outside factors could potentially cause
data loss.
https://github.com/restic/restic/pull/2674

View File

@@ -0,0 +1,6 @@
Enhancement: S3 backend: Add support for WebIdentityTokenFile
We've added support for EKS IAM roles for service accounts feature to the S3 backend.
https://github.com/restic/restic/pull/2733
https://github.com/restic/restic/issues/2703

View File

@@ -0,0 +1,6 @@
Enhancement: Optimize handling of new index entries
Restic now uses less memory for backups which add a lot of data, e.g. large initial backups.
In addition, we've improved the stability in some edge cases.
https://github.com/restic/restic/pull/2773

View File

@@ -0,0 +1,8 @@
Enhancement: Reduce memory consumption of in-memory index
We've improved how the index is stored in memory.
This change can reduce memory usage for large repositories by up to 50%
(depending on the operation).
https://github.com/restic/restic/pull/2781
https://github.com/restic/restic/pull/2812

View File

@@ -0,0 +1,6 @@
Enhancement: Optimize `list blobs` command
We've changed the implementation of `list blobs` which should be now a bit faster
and consume almost no memory even for large repositories.
https://github.com/restic/restic/pull/2786

View File

@@ -0,0 +1,6 @@
Enhancement: Optimized file access in restic mount
Reading large (> 100GiB) files from restic mountpoints is now faster,
and the speedup is greater for larger files.
https://github.com/restic/restic/pull/2790

View File

@@ -0,0 +1,8 @@
Change: Honor the --no-lock flag in the mount command
The mount command now does not lock the repository if given the
--no-lock flag. This allows to mount repositories which are archived
on a read only backend/filesystem.
https://github.com/restic/restic/issues/1597
https://github.com/restic/restic/pull/2821

View File

@@ -0,0 +1,7 @@
Enhancement: Speed-up file deletion in forget, prune and rebuild-index
We've sped up the file deletion for the commands forget, prune and
rebuild-index, especially for remote repositories.
Deletion was sequential before and is now run in parallel.
https://github.com/restic/restic/pull/2840

View File

@@ -0,0 +1,9 @@
Bugfix: Fix possible crash in the progress bar of check --read-data
We've fixed a possible crash while displaying the progress bar for the
check --read-data command. The crash occurred when the length of the
progress bar status exceeded the terminal width, which only happened for
very narrow terminal windows.
https://github.com/restic/restic/pull/2899
https://forum.restic.net/t/restic-rclone-pcloud-connection-issues/2963/15

View File

@@ -7,7 +7,7 @@ vulnerability, but urge all users to upgrade to the latest version of restic.
Exploiting the vulnerability requires a Linux/Unix system which saves backups
via restic and a Windows systems which restores files from the repo. In
addition, the attackers need to be able to create create files with arbitrary
addition, the attackers need to be able to create files with arbitrary
names which are then saved to the restic repo. For example, by creating a file
named "..\test.txt" (which is a perfectly legal filename on Linux) and
restoring a snapshot containing this file on Windows, it would be written to

View File

@@ -1,4 +1,4 @@
Bugfix: Do not return an error when the scanner is faster than backup
Bugfix: Do not return an error when the scanner is slower than backup
When restic makes a backup, there's a background task called "scanner" which
collects information on how many files and directories are to be saved, in

View File

@@ -0,0 +1,13 @@
Enhancement: Stream JSON output for ls command
The `ls` command now supports JSON output with the global `--json`
flag, and this change streams out JSON messages one object at a time
rather than en entire array buffered in memory before encoding. The
advantage is it allows large listings to be handled efficiently.
Two message types are printed: snapshots and nodes. A snapshot
object will precede node objects which belong to that snapshot.
The `struct_type` field can be used to determine which kind of
message an object is.
https://github.com/restic/restic/pull/1962

View File

@@ -0,0 +1,11 @@
Enhancement: Concurrent restore
This change significantly improves restore performance, especially
when using high-latency remote repositories like B2.
The implementation now uses several concurrent threads to download and process
multiple remote files concurrently. To further reduce restore time, each remote
file is downloaded using a single repository request.
https://github.com/restic/restic/issues/1605
https://github.com/restic/restic/pull/1719

View File

@@ -0,0 +1,7 @@
Bugfix: Google Cloud Storage: Respect bandwidth limit
The GCS backend did not respect the bandwidth limit configured, a previous
commit accidentally removed support for it.
https://github.com/restic/restic/issues/1989
https://github.com/restic/restic/pull/2100

View File

@@ -0,0 +1,11 @@
Bugfix: Add host name filter shorthand flag for `stats` command
The default value for `--host` flag was set to 'H' (the shorthand version of
the flag), this caused the lookup for the latest snapshot to fail.
Add shorthand flag `-H` for `--host` (with empty default so if these flags
are not specified the latest snapshot will not filter by host name).
Also add shorthand `-H` for `backup` command.
https://github.com/restic/restic/issues/2040

View File

@@ -0,0 +1,9 @@
Enhancement: increase granularity of the "keep within" retention policy
The `keep-within` option of the `forget` command now accepts time ranges with
an hourly granularity. For example, running `restic forget --keep-within 3d12h`
will keep all the snapshots made within three days and twelve hours from the
time of the latest snapshot.
https://github.com/restic/restic/issues/2089
https://github.com/restic/restic/pull/2090

View File

@@ -0,0 +1,12 @@
Enhancement: Add key hinting
Added a new option `--key-hint` and corresponding environment variable
`RESTIC_KEY_HINT`. The key hint is a key ID to try decrypting first, before
other keys in the repository.
This change will benefit repositories with many keys; if the correct key hint
is supplied then restic only needs to check one key. If the key hint is
incorrect (the key does not exist, or the password is incorrect) then restic
will check all keys, as usual.
https://github.com/restic/restic/issues/2097

View File

@@ -0,0 +1,11 @@
Enhancement: mount: Enforce FUSE Unix permissions with allow-other
The fuse mount (`restic mount`) now lets the kernel check the permissions of
the files within snapshots (this is done through the `DefaultPermissions` FUSE
option) when the option `--allow-other` is specified.
To restore the old behavior, we've added the `--no-default-permissions` option.
This allows all users that have access to the mount point to access all
files within the snapshots.
https://github.com/restic/restic/pull/2017

View File

@@ -0,0 +1,6 @@
Bugfix: Correctly return error loading data
In one case during `prune` and `check`, an error loading data from the backend is not returned properly. This is now corrected.
https://github.com/restic/restic/pull/2068
https://github.com/restic/restic/issues/1999#issuecomment-433737921

View File

@@ -0,0 +1,7 @@
Enhancement: Make all commands display timestamps in local time
Restic used to drop the timezone information from displayed timestamps, it now
converts timestamps to local time before printing them so the times can be
easily compared to.
https://github.com/restic/restic/pull/2070

View File

@@ -0,0 +1,7 @@
Enhancement: Allow --files-from to be specified multiple times
Before, restic took only the last file specified with `--files-from` into
account, this is now corrected.
https://github.com/restic/restic/issues/2085
https://github.com/restic/restic/pull/2086

View File

@@ -0,0 +1,8 @@
Enhancement: Run command to get password
We've added the `--password-command` option which allows specifying a command
that restic runs every time the password for the repository is needed, so it
can be integrated with a password manager or keyring. The option can also be
set via the environment variable `$RESTIC_PASSWORD_COMMAND`.
https://github.com/restic/restic/pull/2094

View File

@@ -0,0 +1,7 @@
Bugfix: consistently use local time for snapshots times
By default snapshots created with restic backup were set to local time,
but when the --time flag was used the provided timestamp was parsed as
UTC. With this change all snapshots times are set to local time.
https://github.com/restic/restic/pull/2095

View File

@@ -0,0 +1,7 @@
Enhancement: Add case insensitive include & exclude options
The backup and restore commands now have --iexclude and --iinclude flags
as case insensitive variants of --exclude and --include.
https://github.com/restic/restic/issues/1895
https://github.com/restic/restic/pull/2032

View File

@@ -0,0 +1,8 @@
Enhancement: Support streaming JSON output for backup
We've added support for getting machine-readable status output during backup,
just pass the flag `--json` for `restic backup` and restic will output a stream
of JSON objects which contain the current progress.
https://github.com/restic/restic/issues/1937
https://github.com/restic/restic/pull/1944

View File

@@ -0,0 +1,10 @@
Bugfix: Return error when no bytes could be read from stdin
We assume that users reading backup data from stdin want to know when no data
could be read, so now restic returns an error when `backup --stdin` is called
but no bytes could be read. Usually, this means that an earlier command in a
pipe has failed. The documentation was amended and now recommends setting the
`pipefail` option (`set -o pipefail`).
https://github.com/restic/restic/pull/2135
https://github.com/restic/restic/pull/2139

View File

@@ -0,0 +1,8 @@
Enhancement: add Openstack application credential auth for Swift
Since Openstack Queens Identity (auth V3) service supports an application
credential auth method. It allows to create a technical account with the
limited roles. This commit adds an application credential authentication
method for the Swift backend.
https://github.com/restic/restic/issues/2155

View File

@@ -0,0 +1,3 @@
Bugfix: Don't cancel timeout after 30 seconds for self-update
https://github.com/restic/restic/issues/2181

View File

@@ -0,0 +1,8 @@
Enhancement: Add --json support to forget command
The forget command now supports the --json argument, outputting the
information about what is (or would-be) kept and removed from the
repository.
https://github.com/restic/restic/issues/2184
https://github.com/restic/restic/pull/2185

View File

@@ -0,0 +1,6 @@
Bugfix: Fix reading passwords from stdin
Passwords for the `init`, `key add`, and `key passwd` commands can now be read from
non-terminal stdin.
https://github.com/restic/restic/issues/2203

View File

@@ -0,0 +1,9 @@
Bugfix: Don't abort the find command when a tree can't be loaded
Change the find command so that missing trees don't result in a crash.
Instead, the error is logged to the debug log, and the tree ID is displayed
along with the snapshot it belongs to. This makes it possible to recover
repositories that are missing trees by forgetting the snapshots they are used
in.
https://github.com/restic/restic/issues/2224

View File

@@ -0,0 +1,10 @@
Enhancement: Add group-by option to snapshots command
We have added an option to group the output of the snapshots command, similar
to the output of the forget command. The option has been called "--group-by"
and accepts any combination of the values "host", "paths" and "tags", separated
by commas. Default behavior (not specifying --group-by) has not been changed.
We have added support of the grouping to the JSON output.
https://github.com/restic/restic/issues/2037
https://github.com/restic/restic/pull/2087

View File

@@ -0,0 +1,8 @@
Enhancement: Ability to dump folders to tar via stdout
We've added the ability to dump whole folders to stdout via the `dump` command.
Restic now requires at least Go 1.10 due to a limitation of the standard
library for Go <= 1.9.
https://github.com/restic/restic/pull/2124
https://github.com/restic/restic/issues/2123

View File

@@ -0,0 +1,8 @@
Enhancement: Return error if no bytes could be read for `backup --stdin`
When restic is used to backup the output of a program, like `mysqldump | restic
backup --stdin`, it now returns an error if no bytes could be read at all. This
catches the failure case when `mysqldump` failed for some reason and did not
output any data to stdout.
https://github.com/restic/restic/pull/2139

View File

@@ -0,0 +1,10 @@
Enhancement: Add --ignore-inode option to backup cmd
This option handles backup of virtual filesystems that do not keep fixed
inodes for files, like Fuse-based, pCloud, etc. Ignoring inode changes allows
to consider the file as unchanged if last modification date and size
are unchanged.
https://github.com/restic/restic/pull/2205
https://github.com/restic/restic/pull/2047
https://github.com/restic/restic/issues/1631

View File

@@ -0,0 +1,16 @@
Enhancement: Add config option to set S3 storage class
The `s3.storage-class` option can be passed to restic (using `-o`) to
specify the storage class to be used for S3 objects created by restic.
The storage class is passed as-is to S3, so it needs to be understood by
the API. On AWS, it can be one of `STANDARD`, `STANDARD_IA`,
`ONEZONE_IA`, `INTELLIGENT_TIERING` and `REDUCED_REDUNDANCY`. If
unspecified, the default storage class is used (`STANDARD` on AWS).
You can mix storage classes in the same bucket, and the setting isn't
stored in the restic repository, so be sure to specify it with each
command that writes to S3.
https://github.com/restic/restic/pull/2220
https://github.com/restic/restic/issues/706

View File

@@ -0,0 +1,6 @@
Bugfix: Allow absolute path for filename when backing up from stdin
When backing up from stdin, handle directory path for `--stdin-filename`.
This can be used to specify the full path for the backed-up file.
https://github.com/restic/restic/issues/2063

View File

@@ -0,0 +1,10 @@
Bugfix: Save files with invalid timestamps
When restic reads invalid timestamps (year is before 0000 or after 9999) it
refused to read and archive the file. We've changed the behavior and will now
save modified timestamps with the year set to either 0000 or 9999, the rest of
the timestamp stays the same, so the file will be saved (albeit with a bogus
timestamp).
https://github.com/restic/restic/issues/2174
https://github.com/restic/restic/issues/1173

View File

@@ -0,0 +1,15 @@
Enhancement: Use ctime when checking for file changes
Previously, restic only checked a file's mtime (along with other non-timestamp
metadata) to decide if a file has changed. This could cause restic to not notice
that a file has changed (and therefore continue to store the old version, as
opposed to the modified version) if something edits the file and then resets the
timestamp. Restic now also checks the ctime of files, so any modifications to a
file should be noticed, and the modified file will be backed up. The ctime check
will be disabled if the --ignore-inode flag was given.
If this change causes problems for you, please open an issue, and we can look in
to adding a seperate flag to disable just the ctime check.
https://github.com/restic/restic/issues/2179
https://github.com/restic/restic/pull/2212

View File

@@ -0,0 +1,6 @@
Bugfix: Read fresh metadata for unmodified files
Restic took all metadata for files which were detected as unmodified, not taking into account changed metadata (ownership, mode). This is now corrected.
https://github.com/restic/restic/issues/2249
https://github.com/restic/restic/pull/2252

View File

@@ -0,0 +1,7 @@
Bugfix: Add upper bound for t in --read-data-subset=n/t
256 is the effective maximum for t, but restic would allow larger
values, leading to strange behavior.
https://github.com/restic/restic/issues/2301
https://github.com/restic/restic/pull/2304

View File

@@ -0,0 +1,7 @@
Enhancement: Allow multiple retries for interactive password input
Restic used to quit if the repository password was typed incorrectly once.
Restic will now ask the user again for the repository password if typed incorrectly.
The user will now get three tries to input the correct password before restic quits.
https://github.com/restic/restic/issues/2306

View File

@@ -0,0 +1,6 @@
Enhancement: Make `--group-by` accept both singular and plural
One can now use the values `host`/`hosts`, `path`/`paths` and
`tag` / `tags` interchangeably in the `--group-by` argument.
https://github.com/restic/restic/issues/2330

View File

@@ -0,0 +1,8 @@
Bugfix: Check errors when loading index files
Restic now checks and handles errors which occur when loading index files, the
missing check leads to odd errors (and a stack trace printed to users) later.
This was reported in the forum.
https://github.com/restic/restic/pull/2321
https://forum.restic.net/t/check-rebuild-index-prune/1848/13

View File

@@ -0,0 +1,8 @@
Enhancement: Add option to configure S3 region
We've added a new option for setting the region when accessing an S3-compatible
service. For some providers, it is required to set this to a valid value. You
can do that either by setting the environment variable `AWS_DEFAULT_REGION` or
using the option `s3.region`, e.g. like this: `-o s3.region="us-east-1"`.
https://github.com/restic/restic/pull/2350

View File

@@ -16,7 +16,7 @@ Details
{{ range $entry := .Entries }}{{ with $entry }}
* {{ .Type }} #{{ .PrimaryID }}: {{ .Title }}
{{ range $par := .Paragraphs }}
{{ wrap $par 80 3 }}
{{ wrapIndent $par 80 3 }}
{{ end -}}
{{ range $url := .IssueURLs }}
{{ $url -}}

View File

@@ -9,4 +9,4 @@ in case there aren't any issue links) is used as the primary ID.
https://github.com/restic/restic/issues/1234
https://github.com/restic/restic/pull/55555
https://forum.restic/.net/foo/bar/baz
https://forum.restic.net/foo/bar/baz

View File

@@ -1,7 +1,6 @@
package main
import (
"fmt"
"os"
"os/signal"
"sync"
@@ -17,10 +16,8 @@ var cleanupHandlers struct {
ch chan os.Signal
}
var stderr = os.Stderr
func init() {
cleanupHandlers.ch = make(chan os.Signal)
cleanupHandlers.ch = make(chan os.Signal, 1)
go CleanupHandler(cleanupHandlers.ch)
signal.Notify(cleanupHandlers.ch, syscall.SIGINT)
}
@@ -51,7 +48,7 @@ func RunCleanupHandlers() {
for _, f := range cleanupHandlers.list {
err := f()
if err != nil {
fmt.Fprintf(stderr, "error in cleanup handler: %v\n", err)
Warnf("error in cleanup handler: %v\n", err)
}
}
cleanupHandlers.list = nil
@@ -61,7 +58,7 @@ func RunCleanupHandlers() {
func CleanupHandler(c <-chan os.Signal) {
for s := range c {
debug.Log("signal %v received, cleaning up", s)
fmt.Fprintf(stderr, "%ssignal %v received, cleaning up\n", ClearLine(), s)
Warnf("%ssignal %v received, cleaning up\n", ClearLine(), s)
code := 0

View File

@@ -5,8 +5,10 @@ import (
"bytes"
"context"
"fmt"
"io"
"io/ioutil"
"os"
"path"
"path/filepath"
"strconv"
"strings"
@@ -23,6 +25,7 @@ import (
"github.com/restic/restic/internal/restic"
"github.com/restic/restic/internal/textfile"
"github.com/restic/restic/internal/ui"
"github.com/restic/restic/internal/ui/json"
"github.com/restic/restic/internal/ui/termstatus"
)
@@ -32,6 +35,13 @@ var cmdBackup = &cobra.Command{
Long: `
The "backup" command creates a new snapshot and saves the files and directories
given as the arguments.
EXIT STATUS
===========
Exit status is 0 if the command was successful.
Exit status is 1 if there was a fatal error (no snapshot created).
Exit status is 3 if some source data could not be read (incomplete snapshot created).
`,
PreRun: func(cmd *cobra.Command, args []string) {
if backupOptions.Host == "" {
@@ -45,8 +55,12 @@ given as the arguments.
},
DisableAutoGenTag: true,
RunE: func(cmd *cobra.Command, args []string) error {
if backupOptions.Stdin && backupOptions.FilesFrom == "-" {
return errors.Fatal("cannot use both `--stdin` and `--files-from -`")
if backupOptions.Stdin {
for _, filename := range backupOptions.FilesFrom {
if filename == "-" {
return errors.Fatal("cannot use both `--stdin` and `--files-from -`")
}
}
}
var t tomb.Tomb
@@ -64,46 +78,57 @@ given as the arguments.
// BackupOptions bundles all options for the backup command.
type BackupOptions struct {
Parent string
Force bool
Excludes []string
ExcludeFiles []string
ExcludeOtherFS bool
ExcludeIfPresent []string
ExcludeCaches bool
Stdin bool
StdinFilename string
Tags []string
Host string
FilesFrom string
TimeStamp string
WithAtime bool
Parent string
Force bool
Excludes []string
InsensitiveExcludes []string
ExcludeFiles []string
InsensitiveExcludeFiles []string
ExcludeOtherFS bool
ExcludeIfPresent []string
ExcludeCaches bool
ExcludeLargerThan string
Stdin bool
StdinFilename string
Tags []string
Host string
FilesFrom []string
TimeStamp string
WithAtime bool
IgnoreInode bool
}
var backupOptions BackupOptions
// ErrInvalidSourceData is used to report an incomplete backup
var ErrInvalidSourceData = errors.New("failed to read all source data during backup")
func init() {
cmdRoot.AddCommand(cmdBackup)
f := cmdBackup.Flags()
f.StringVar(&backupOptions.Parent, "parent", "", "use this parent snapshot (default: last snapshot in the repo that has the same target files/directories)")
f.StringVar(&backupOptions.Parent, "parent", "", "use this parent `snapshot` (default: last snapshot in the repo that has the same target files/directories)")
f.BoolVarP(&backupOptions.Force, "force", "f", false, `force re-reading the target files/directories (overrides the "parent" flag)`)
f.StringArrayVarP(&backupOptions.Excludes, "exclude", "e", nil, "exclude a `pattern` (can be specified multiple times)")
f.StringArrayVar(&backupOptions.InsensitiveExcludes, "iexclude", nil, "same as --exclude `pattern` but ignores the casing of filenames")
f.StringArrayVar(&backupOptions.ExcludeFiles, "exclude-file", nil, "read exclude patterns from a `file` (can be specified multiple times)")
f.StringArrayVar(&backupOptions.InsensitiveExcludeFiles, "iexclude-file", nil, "same as --exclude-file but ignores casing of `file`names in patterns")
f.BoolVarP(&backupOptions.ExcludeOtherFS, "one-file-system", "x", false, "exclude other file systems")
f.StringArrayVar(&backupOptions.ExcludeIfPresent, "exclude-if-present", nil, "takes filename[:header], exclude contents of directories containing filename (except filename itself) if header of that file is as provided (can be specified multiple times)")
f.BoolVar(&backupOptions.ExcludeCaches, "exclude-caches", false, `excludes cache directories that are marked with a CACHEDIR.TAG file`)
f.StringArrayVar(&backupOptions.ExcludeIfPresent, "exclude-if-present", nil, "takes `filename[:header]`, exclude contents of directories containing filename (except filename itself) if header of that file is as provided (can be specified multiple times)")
f.BoolVar(&backupOptions.ExcludeCaches, "exclude-caches", false, `excludes cache directories that are marked with a CACHEDIR.TAG file. See https://bford.info/cachedir/ for the Cache Directory Tagging Standard`)
f.StringVar(&backupOptions.ExcludeLargerThan, "exclude-larger-than", "", "max `size` of the files to be backed up (allowed suffixes: k/K, m/M, g/G, t/T)")
f.BoolVar(&backupOptions.Stdin, "stdin", false, "read backup from stdin")
f.StringVar(&backupOptions.StdinFilename, "stdin-filename", "stdin", "file name to use when reading from stdin")
f.StringVar(&backupOptions.StdinFilename, "stdin-filename", "stdin", "`filename` to use when reading from stdin")
f.StringArrayVar(&backupOptions.Tags, "tag", nil, "add a `tag` for the new snapshot (can be specified multiple times)")
f.StringVar(&backupOptions.Host, "host", "H", "set the `hostname` for the snapshot manually. To prevent an expensive rescan use the \"parent\" flag")
f.StringVarP(&backupOptions.Host, "host", "H", "", "set the `hostname` for the snapshot manually. To prevent an expensive rescan use the \"parent\" flag")
f.StringVar(&backupOptions.Host, "hostname", "", "set the `hostname` for the snapshot manually")
f.MarkDeprecated("hostname", "use --host")
f.StringVar(&backupOptions.FilesFrom, "files-from", "", "read the files to backup from file (can be combined with file args)")
f.StringVar(&backupOptions.TimeStamp, "time", "", "time of the backup (ex. '2012-11-01 22:08:41') (default: now)")
f.StringArrayVar(&backupOptions.FilesFrom, "files-from", nil, "read the files to backup from `file` (can be combined with file args/can be specified multiple times)")
f.StringVar(&backupOptions.TimeStamp, "time", "", "`time` of the backup (ex. '2012-11-01 22:08:41') (default: now)")
f.BoolVar(&backupOptions.WithAtime, "with-atime", false, "store the atime for all files and directories")
f.BoolVar(&backupOptions.IgnoreInode, "ignore-inode", false, "ignore inode number changes when checking for modified files")
}
// filterExisting returns a slice of all existing items, or an error if no
@@ -175,12 +200,16 @@ func readLinesFromFile(filename string) ([]string, error) {
// Check returns an error when an invalid combination of options was set.
func (opts BackupOptions) Check(gopts GlobalOptions, args []string) error {
if opts.FilesFrom == "-" && gopts.password == "" {
return errors.Fatal("unable to read password from stdin when data is to be read from stdin, use --password-file or $RESTIC_PASSWORD")
if gopts.password == "" {
for _, filename := range opts.FilesFrom {
if filename == "-" {
return errors.Fatal("unable to read password from stdin when data is to be read from stdin, use --password-file or $RESTIC_PASSWORD")
}
}
}
if opts.Stdin {
if opts.FilesFrom != "" {
if len(opts.FilesFrom) > 0 {
return errors.Fatal("--stdin and --files-from cannot be used together")
}
@@ -214,6 +243,18 @@ func collectRejectByNameFuncs(opts BackupOptions, repo *repository.Repository, t
opts.Excludes = append(opts.Excludes, excludes...)
}
if len(opts.InsensitiveExcludeFiles) > 0 {
excludes, err := readExcludePatternsFromFiles(opts.InsensitiveExcludeFiles)
if err != nil {
return nil, err
}
opts.InsensitiveExcludes = append(opts.InsensitiveExcludes, excludes...)
}
if len(opts.InsensitiveExcludes) > 0 {
fs = append(fs, rejectByInsensitivePattern(opts.InsensitiveExcludes))
}
if len(opts.Excludes) > 0 {
fs = append(fs, rejectByPattern(opts.Excludes))
}
@@ -246,6 +287,14 @@ func collectRejectFuncs(opts BackupOptions, repo *repository.Repository, targets
fs = append(fs, f)
}
if len(opts.ExcludeLargerThan) != 0 && !opts.Stdin {
f, err := rejectBySize(opts.ExcludeLargerThan)
if err != nil {
return nil, err
}
fs = append(fs, f)
}
return fs, nil
}
@@ -302,20 +351,25 @@ func collectTargets(opts BackupOptions, args []string) (targets []string, err er
return nil, nil
}
fromfile, err := readLinesFromFile(opts.FilesFrom)
if err != nil {
return nil, err
}
// expand wildcards
var lines []string
for _, line := range fromfile {
var expanded []string
expanded, err := filepath.Glob(line)
for _, file := range opts.FilesFrom {
fromfile, err := readLinesFromFile(file)
if err != nil {
return nil, errors.WithMessage(err, fmt.Sprintf("pattern: %s", line))
return nil, err
}
// expand wildcards
for _, line := range fromfile {
var expanded []string
expanded, err := filepath.Glob(line)
if err != nil {
return nil, errors.WithMessage(err, fmt.Sprintf("pattern: %s", line))
}
if len(expanded) == 0 {
Warnf("pattern %q does not match any files, skipping\n", line)
}
lines = append(lines, expanded...)
}
lines = append(lines, expanded...)
}
// merge files from files-from into normal args so we can reuse the normal
@@ -350,7 +404,7 @@ func findParentSnapshot(ctx context.Context, repo restic.Repository, opts Backup
// Find last snapshot to set it as parent, if not already set
if !opts.Force && parentID == nil {
id, err := restic.FindLatestSnapshot(ctx, repo, targets, []restic.TagList{}, opts.Host)
id, err := restic.FindLatestSnapshot(ctx, repo, targets, []restic.TagList{}, []string{opts.Host})
if err == nil {
parentID = &id
} else if err != restic.ErrNoSnapshotFound {
@@ -374,7 +428,7 @@ func runBackup(opts BackupOptions, gopts GlobalOptions, term *termstatus.Termina
timeStamp := time.Now()
if opts.TimeStamp != "" {
timeStamp, err = time.Parse(TimeFormat, opts.TimeStamp)
timeStamp, err = time.ParseInLocation(TimeFormat, opts.TimeStamp, time.Local)
if err != nil {
return errors.Fatalf("error in time option: %v\n", err)
}
@@ -382,7 +436,43 @@ func runBackup(opts BackupOptions, gopts GlobalOptions, term *termstatus.Termina
var t tomb.Tomb
p := ui.NewBackup(term, gopts.verbosity)
if gopts.verbosity >= 2 && !gopts.JSON {
Verbosef("open repository\n")
}
repo, err := OpenRepository(gopts)
if err != nil {
return err
}
type ArchiveProgressReporter interface {
CompleteItem(item string, previous, current *restic.Node, s archiver.ItemStats, d time.Duration)
StartFile(filename string)
CompleteBlob(filename string, bytes uint64)
ScannerError(item string, fi os.FileInfo, err error) error
ReportTotal(item string, s archiver.ScanStats)
SetMinUpdatePause(d time.Duration)
Run(ctx context.Context) error
Error(item string, fi os.FileInfo, err error) error
Finish(snapshotID restic.ID)
// ui.StdioWrapper
Stdout() io.WriteCloser
Stderr() io.WriteCloser
// ui.Message
E(msg string, args ...interface{})
P(msg string, args ...interface{})
V(msg string, args ...interface{})
VV(msg string, args ...interface{})
}
var p ArchiveProgressReporter
if gopts.JSON {
p = json.NewBackup(term, gopts.verbosity)
} else {
p = ui.NewBackup(term, gopts.verbosity)
}
// use the terminal for stdout/stderr
prevStdout, prevStderr := gopts.stdout, gopts.stderr
@@ -397,19 +487,15 @@ func runBackup(opts BackupOptions, gopts GlobalOptions, term *termstatus.Termina
if fps > 60 {
fps = 60
}
p.MinUpdatePause = time.Second / time.Duration(fps)
p.SetMinUpdatePause(time.Second / time.Duration(fps))
}
}
t.Go(func() error { return p.Run(t.Context(gopts.ctx)) })
p.V("open repository")
repo, err := OpenRepository(gopts)
if err != nil {
return err
if !gopts.JSON {
p.V("lock repository")
}
p.V("lock repository")
lock, err := lockRepo(repo)
defer unlockRepo(lock)
if err != nil {
@@ -428,7 +514,9 @@ func runBackup(opts BackupOptions, gopts GlobalOptions, term *termstatus.Termina
return err
}
p.V("load index files")
if !gopts.JSON {
p.V("load index files")
}
err = repo.LoadIndex(gopts.ctx)
if err != nil {
return err
@@ -439,7 +527,7 @@ func runBackup(opts BackupOptions, gopts GlobalOptions, term *termstatus.Termina
return err
}
if parentSnapshotID != nil {
if !gopts.JSON && parentSnapshotID != nil {
p.V("using parent snapshot %v\n", parentSnapshotID.Str())
}
@@ -463,14 +551,17 @@ func runBackup(opts BackupOptions, gopts GlobalOptions, term *termstatus.Termina
var targetFS fs.FS = fs.Local{}
if opts.Stdin {
p.V("read data from stdin")
if !gopts.JSON {
p.V("read data from stdin")
}
filename := path.Join("/", opts.StdinFilename)
targetFS = &fs.Reader{
ModTime: timeStamp,
Name: opts.StdinFilename,
Name: filename,
Mode: 0644,
ReadCloser: os.Stdin,
}
targets = []string{opts.StdinFilename}
targets = []string{filename}
}
sc := archiver.NewScanner(targetFS)
@@ -479,17 +570,24 @@ func runBackup(opts BackupOptions, gopts GlobalOptions, term *termstatus.Termina
sc.Error = p.ScannerError
sc.Result = p.ReportTotal
p.V("start scan on %v", targets)
if !gopts.JSON {
p.V("start scan on %v", targets)
}
t.Go(func() error { return sc.Scan(t.Context(gopts.ctx), targets) })
arch := archiver.New(repo, targetFS, archiver.Options{})
arch.SelectByName = selectByNameFilter
arch.Select = selectFilter
arch.WithAtime = opts.WithAtime
arch.Error = p.Error
arch.CompleteItem = p.CompleteItemFn
success := true
arch.Error = func(item string, fi os.FileInfo, err error) error {
success = false
return p.Error(item, fi, err)
}
arch.CompleteItem = p.CompleteItem
arch.StartFile = p.StartFile
arch.CompleteBlob = p.CompleteBlob
arch.IgnoreInode = opts.IgnoreInode
if parentSnapshotID == nil {
parentSnapshotID = &restic.ID{}
@@ -503,37 +601,29 @@ func runBackup(opts BackupOptions, gopts GlobalOptions, term *termstatus.Termina
ParentSnapshot: *parentSnapshotID,
}
uploader := archiver.IndexUploader{
Repository: repo,
Start: func() {
p.VV("uploading intermediate index")
},
Complete: func(id restic.ID) {
p.V("uploaded intermediate index %v", id.Str())
},
if !gopts.JSON {
p.V("start backup on %v", targets)
}
t.Go(func() error {
return uploader.Upload(gopts.ctx, t.Context(gopts.ctx), 30*time.Second)
})
p.V("start backup on %v", targets)
_, id, err := arch.Snapshot(gopts.ctx, targets, snapshotOpts)
if err != nil {
return errors.Fatalf("unable to save snapshot: %v", err)
}
p.Finish()
p.P("snapshot %s saved\n", id.Str())
// cleanly shutdown all running goroutines
t.Kill(nil)
// let's see if one returned an error
err = t.Wait()
if err != nil {
return err
// Report finished execution
p.Finish(id)
if !gopts.JSON {
p.P("snapshot %s saved\n", id.Str())
}
if !success {
return ErrInvalidSourceData
}
return nil
// Return error if any
return err
}

View File

@@ -19,6 +19,11 @@ var cmdCache = &cobra.Command{
Short: "Operate on local cache directories",
Long: `
The "cache" command allows listing and cleaning local cache directories.
EXIT STATUS
===========
Exit status is 0 if the command was successful, and non-zero if there was any error.
`,
DisableAutoGenTag: true,
RunE: func(cmd *cobra.Command, args []string) error {

View File

@@ -2,8 +2,6 @@ package main
import (
"encoding/json"
"fmt"
"os"
"github.com/spf13/cobra"
@@ -18,6 +16,11 @@ var cmdCat = &cobra.Command{
Short: "Print internal objects to stdout",
Long: `
The "cat" command is used to print internal objects to stdout.
EXIT STATUS
===========
Exit status is 0 if the command was successful, and non-zero if there was any error.
`,
DisableAutoGenTag: true,
RunE: func(cmd *cobra.Command, args []string) error {
@@ -71,17 +74,16 @@ func runCat(gopts GlobalOptions, args []string) error {
return err
}
fmt.Println(string(buf))
Println(string(buf))
return nil
case "index":
buf, err := repo.LoadAndDecrypt(gopts.ctx, restic.IndexFile, id)
buf, err := repo.LoadAndDecrypt(gopts.ctx, nil, restic.IndexFile, id)
if err != nil {
return err
}
_, err = os.Stdout.Write(append(buf, '\n'))
return err
Println(string(buf))
return nil
case "snapshot":
sn := &restic.Snapshot{}
err = repo.LoadJSONUnpacked(gopts.ctx, restic.SnapshotFile, id, sn)
@@ -94,12 +96,11 @@ func runCat(gopts GlobalOptions, args []string) error {
return err
}
fmt.Println(string(buf))
Println(string(buf))
return nil
case "key":
h := restic.Handle{Type: restic.KeyFile, Name: id.String()}
buf, err := backend.LoadAll(gopts.ctx, repo.Backend(), h)
buf, err := backend.LoadAll(gopts.ctx, nil, repo.Backend(), h)
if err != nil {
return err
}
@@ -115,7 +116,7 @@ func runCat(gopts GlobalOptions, args []string) error {
return err
}
fmt.Println(string(buf))
Println(string(buf))
return nil
case "masterkey":
buf, err := json.MarshalIndent(repo.Key(), "", " ")
@@ -123,7 +124,7 @@ func runCat(gopts GlobalOptions, args []string) error {
return err
}
fmt.Println(string(buf))
Println(string(buf))
return nil
case "lock":
lock, err := restic.LoadLock(gopts.ctx, repo, id)
@@ -136,8 +137,7 @@ func runCat(gopts GlobalOptions, args []string) error {
return err
}
fmt.Println(string(buf))
Println(string(buf))
return nil
}
@@ -149,36 +149,32 @@ func runCat(gopts GlobalOptions, args []string) error {
switch tpe {
case "pack":
h := restic.Handle{Type: restic.DataFile, Name: id.String()}
buf, err := backend.LoadAll(gopts.ctx, repo.Backend(), h)
h := restic.Handle{Type: restic.PackFile, Name: id.String()}
buf, err := backend.LoadAll(gopts.ctx, nil, repo.Backend(), h)
if err != nil {
return err
}
hash := restic.Hash(buf)
if !hash.Equal(id) {
fmt.Fprintf(stderr, "Warning: hash of data does not match ID, want\n %v\ngot:\n %v\n", id.String(), hash.String())
Warnf("Warning: hash of data does not match ID, want\n %v\ngot:\n %v\n", id.String(), hash.String())
}
_, err = os.Stdout.Write(buf)
_, err = globalOptions.stdout.Write(buf)
return err
case "blob":
for _, t := range []restic.BlobType{restic.DataBlob, restic.TreeBlob} {
list, found := repo.Index().Lookup(id, t)
if !found {
if !repo.Index().Has(id, t) {
continue
}
blob := list[0]
buf := make([]byte, blob.Length)
n, err := repo.LoadBlob(gopts.ctx, t, id, buf)
buf, err := repo.LoadBlob(gopts.ctx, t, id, nil)
if err != nil {
return err
}
buf = buf[:n]
_, err = os.Stdout.Write(buf)
_, err = globalOptions.stdout.Write(buf)
return err
}

Some files were not shown because too many files have changed in this diff Show More