1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2025-03-09 00:00:02 +01:00

Merge remote-tracking branch 'origin/master' into add-smb-backend

This commit is contained in:
aneesh-n 2024-09-01 10:59:03 -06:00
commit d96990ee40
No known key found for this signature in database
GPG key ID: 6F5A52831C046F44
494 changed files with 21269 additions and 12208 deletions

View file

@ -25,7 +25,7 @@ jobs:
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@5139682d94efc37792e6b54386b5b470a68a4737
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
@ -33,7 +33,7 @@ jobs:
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
@ -45,7 +45,7 @@ jobs:
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226
uses: docker/setup-buildx-action@2b51285047da1547ffb1b2203d8be4c0af6b1f20
- name: Ensure consistent binaries
run: |
@ -55,7 +55,7 @@ jobs:
if: github.ref != 'refs/heads/master'
- name: Build and push Docker image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
uses: docker/build-push-action@15560696de535e4014efeff63c48f16952e52dd1
with:
push: true
context: .

View file

@ -72,6 +72,9 @@ jobs:
GOPROXY: https://proxy.golang.org
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v5
with:
@ -80,7 +83,7 @@ jobs:
- name: Get programs (Linux/macOS)
run: |
echo "build Go tools"
go install github.com/restic/rest-server/cmd/rest-server@latest
go install github.com/restic/rest-server/cmd/rest-server@master
echo "install minio server"
mkdir $HOME/bin
@ -203,7 +206,7 @@ jobs:
$ProgressPreference = 'SilentlyContinue'
echo "build Go tools"
go install github.com/restic/rest-server/...
go install github.com/restic/rest-server/cmd/rest-server@master
echo "install minio server"
mkdir $Env:USERPROFILE/bin
@ -242,7 +245,7 @@ jobs:
echo "Making user admin"
Add-LocalGroupMember -Group "Administrators" -Member "$smbuser"
$path="C:\$smbuser"
mkdir $path
@ -256,9 +259,6 @@ jobs:
echo $Env:USERPROFILE\tar\bin >> $Env:GITHUB_PATH
if: matrix.os == 'windows-latest'
- name: Check out code
uses: actions/checkout@v4
- name: Build with build.go
run: |
go run build.go
@ -332,7 +332,6 @@ jobs:
cross_compile:
strategy:
matrix:
# run cross-compile in three batches parallel so the overall tests run faster
subset:
@ -348,14 +347,14 @@ jobs:
name: Cross Compile for subset ${{ matrix.subset }}
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Go ${{ env.latest_go }}
uses: actions/setup-go@v5
with:
go-version: ${{ env.latest_go }}
- name: Check out code
uses: actions/checkout@v4
- name: Cross-compile for subset ${{ matrix.subset }}
run: |
mkdir build-output build-output-debug
@ -365,20 +364,24 @@ jobs:
lint:
name: lint
runs-on: ubuntu-latest
permissions:
contents: read
# allow annotating code in the PR
checks: write
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Go ${{ env.latest_go }}
uses: actions/setup-go@v5
with:
go-version: ${{ env.latest_go }}
- name: Check out code
uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
uses: golangci/golangci-lint-action@v6
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.56.1
version: v1.57.1
args: --verbose --timeout 5m
# only run golangci-lint for pull requests, otherwise ALL hints get
@ -416,7 +419,7 @@ jobs:
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
@ -439,7 +442,7 @@ jobs:
- name: Build and push
id: docker_build
uses: docker/build-push-action@v4
uses: docker/build-push-action@v6
with:
push: false
context: .

View file

@ -38,6 +38,8 @@ linters:
# ensure that http response bodies are closed
- bodyclose
- importas
issues:
# don't use the default exclude rules, this hides (among others) ignored
# errors from Close() calls
@ -58,4 +60,10 @@ issues:
exclude-rules:
# revive: ignore unused parameters in tests
- path: (_test\.go|testing\.go|backend/.*/tests\.go)
text: "unused-parameter:"
text: "unused-parameter:"
linters-settings:
importas:
alias:
- pkg: github.com/restic/restic/internal/test
alias: rtest

View file

@ -1,5 +1,7 @@
# Table of Contents
* [Changelog for 0.17.0](#changelog-for-restic-0170-2024-07-26)
* [Changelog for 0.16.5](#changelog-for-restic-0165-2024-07-01)
* [Changelog for 0.16.4](#changelog-for-restic-0164-2024-02-04)
* [Changelog for 0.16.3](#changelog-for-restic-0163-2024-01-14)
* [Changelog for 0.16.2](#changelog-for-restic-0162-2023-10-29)
@ -33,6 +35,738 @@
* [Changelog for 0.6.0](#changelog-for-restic-060-2017-05-29)
# Changelog for restic 0.17.0 (2024-07-26)
The following sections list the changes in restic 0.17.0 relevant to
restic users. The changes are ordered by importance.
## Summary
* Fix #3600: Handle unreadable xattrs in folders above `backup` source
* Fix #4209: Fix slow SFTP upload performance
* Fix #4503: Correct hardlink handling in `stats` command
* Fix #4568: Prevent `forget --keep-tags <invalid>` from deleting all snapshots
* Fix #4615: Make `find` not sometimes ignore directories
* Fix #4656: Properly report ID of newly added keys
* Fix #4703: Shutdown cleanly when receiving SIGTERM
* Fix #4709: Correct `--no-lock` handling of `ls` and `tag` commands
* Fix #4760: Fix possible error on concurrent cache cleanup
* Fix #4850: Handle UTF-16 password files in `key` command correctly
* Fix #4902: Update snapshot summary on `rewrite`
* Chg #956: Return exit code 10 and 11 for non-existing and locked repository
* Chg #4540: Require at least ARMv6 for ARM binaries
* Chg #4602: Deprecate legacy index format and `s3legacy` repository layout
* Chg #4627: Redesign backend error handling to improve reliability
* Chg #4707: Disable S3 anonymous authentication by default
* Chg #4744: Include full key ID in JSON output of `key list`
* Enh #662: Optionally skip snapshot creation if nothing changed
* Enh #693: Include snapshot size in `snapshots` output
* Enh #805: Add bitrot detection to `diff` command
* Enh #828: Improve features of the `repair packs` command
* Enh #1786: Support repositories with empty password
* Enh #2348: Add `--delete` option to `restore` command
* Enh #3067: Add extended options to configure Windows Shadow Copy Service
* Enh #3406: Improve `dump` performance for large files
* Enh #3806: Optimize and make `prune` command resumable
* Enh #4006: (alpha) Store deviceID only for hardlinks
* Enh #4048: Add support for FUSE-T with `mount` on macOS
* Enh #4251: Support reading backup from a command's standard output
* Enh #4287: Support connection to rest-server using unix socket
* Enh #4354: Significantly reduce `prune` memory usage
* Enh #4437: Make `check` command create non-existent cache directory
* Enh #4472: Support AWS Assume Role for S3 backend
* Enh #4547: Add `--json` option to `version` command
* Enh #4549: Add `--ncdu` option to `ls` command
* Enh #4573: Support rewriting host and time metadata in snapshots
* Enh #4583: Ignore `s3.storage-class` archive tiers for metadata
* Enh #4590: Speed up `mount` command's error detection
* Enh #4601: Add support for feature flags
* Enh #4611: Back up more file metadata on Windows
* Enh #4664: Make `ls` use `message_type` field in JSON output
* Enh #4676: Make `key` command's actions separate sub-commands
* Enh #4678: Add `--target` option to the `dump` command
* Enh #4708: Back up and restore SecurityDescriptors on Windows
* Enh #4733: Allow specifying `--host` via environment variable
* Enh #4737: Include snapshot ID in `reason` field of `forget` JSON output
* Enh #4764: Support forgetting all snapshots
* Enh #4768: Allow specifying custom User-Agent for outgoing requests
* Enh #4781: Add `restore` options to read include/exclude patterns from files
* Enh #4807: Support Extended Attributes on Windows NTFS
* Enh #4817: Make overwrite behavior of `restore` customizable
* Enh #4839: Add dry-run support to `restore` command
## Details
* Bugfix #3600: Handle unreadable xattrs in folders above `backup` source
When backup sources are specified using absolute paths, `backup` also includes
information about the parent folders of the backup sources in the snapshot.
If the extended attributes for some of these folders could not be read due to
missing permissions, this caused the backup to fail. This has now been fixed.
https://github.com/restic/restic/issues/3600
https://github.com/restic/restic/pull/4668
https://forum.restic.net/t/parent-directories-above-the-snapshot-source-path-fatal-error-permission-denied/7216
* Bugfix #4209: Fix slow SFTP upload performance
Since restic 0.12.1, the upload speed of the sftp backend to a remote server has
regressed significantly. This has now been fixed.
https://github.com/restic/restic/issues/4209
https://github.com/restic/restic/pull/4782
* Bugfix #4503: Correct hardlink handling in `stats` command
If files on different devices had the same inode ID, the `stats` command did not
correctly calculate the snapshot size. This has now been fixed.
https://github.com/restic/restic/pull/4503
https://github.com/restic/restic/pull/4006
https://forum.restic.net/t/possible-bug-in-stats/6461/8
* Bugfix #4568: Prevent `forget --keep-tags <invalid>` from deleting all snapshots
Running `forget --keep-tags <invalid>`, where `<invalid>` is a tag that does not
exist in the repository, would remove all snapshots. This is especially
problematic if the tag name contains a typo.
The `forget` command now fails with an error if all snapshots in a snapshot
group would be deleted. This prevents the above example from deleting all
snapshots.
It is possible to temporarily disable the new check by setting the environment
variable `RESTIC_FEATURES=safe-forget-keep-tags=false`. Note that this feature
flag will be removed in the next minor restic version.
https://github.com/restic/restic/pull/4568
https://github.com/restic/restic/pull/4764
* Bugfix #4615: Make `find` not sometimes ignore directories
In some cases, the `find` command ignored empty or moved directories. This has
now been fixed.
https://github.com/restic/restic/pull/4615
* Bugfix #4656: Properly report ID of newly added keys
`restic key add` now reports the ID of the newly added key. This simplifies
selecting a specific key using the `--key-hint key` option.
https://github.com/restic/restic/issues/4656
https://github.com/restic/restic/pull/4657
* Bugfix #4703: Shutdown cleanly when receiving SIGTERM
Previously, when restic received the SIGTERM signal it would terminate
immediately, skipping cleanup and potentially causing issues like stale locks
being left behind. This primarily effected containerized restic invocations that
use SIGTERM, but could also be triggered via a simple `killall restic`.
This has now been fixed, such that restic shuts down cleanly when receiving the
SIGTERM signal.
https://github.com/restic/restic/pull/4703
* Bugfix #4709: Correct `--no-lock` handling of `ls` and `tag` commands
The `ls` command never locked the repository. This has now been fixed, with the
old behavior still being supported using `ls --no-lock`. The latter invocation
also works with older restic versions.
The `tag` command erroneously accepted the `--no-lock` command. This command now
always requires an exclusive lock.
https://github.com/restic/restic/pull/4709
* Bugfix #4760: Fix possible error on concurrent cache cleanup
If multiple restic processes concurrently cleaned up no longer existing files
from the cache, this could cause some of the processes to fail with an `no such
file or directory` error. This has now been fixed.
https://github.com/restic/restic/issues/4760
https://github.com/restic/restic/pull/4761
* Bugfix #4850: Handle UTF-16 password files in `key` command correctly
Previously, `key add` and `key passwd` did not properly decode UTF-16 encoded
passwords read from a password file. This has now been fixed to correctly match
the encoding when opening a repository.
https://github.com/restic/restic/issues/4850
https://github.com/restic/restic/pull/4851
* Bugfix #4902: Update snapshot summary on `rewrite`
Restic previously did not recalculate the total number of files and bytes
processed when files were excluded from a snapshot by the `rewrite` command.
This has now been fixed.
https://github.com/restic/restic/issues/4902
https://github.com/restic/restic/pull/4905
* Change #956: Return exit code 10 and 11 for non-existing and locked repository
If a repository does not exist or cannot be locked, restic previously always
returned exit code 1. This made it difficult to distinguish these cases from
other errors.
Restic now returns exit code 10 if the repository does not exist, and exit code
11 if the repository could be not locked due to a conflicting lock.
https://github.com/restic/restic/issues/956
https://github.com/restic/restic/pull/4884
* Change #4540: Require at least ARMv6 for ARM binaries
The official release binaries of restic now require at least ARMv6 support for
ARM platforms.
https://github.com/restic/restic/issues/4540
https://github.com/restic/restic/pull/4542
* Change #4602: Deprecate legacy index format and `s3legacy` repository layout
Support for the legacy index format used by restic before version 0.2.0 has been
deprecated and will be removed in the next minor restic version. You can use
`restic repair index` to update the index to the current format.
It is possible to temporarily reenable support for the legacy index format by
setting the environment variable `RESTIC_FEATURES=deprecate-legacy-index=false`.
Note that this feature flag will be removed in the next minor restic version.
Support for the `s3legacy` repository layout used for the S3 backend before
restic 0.7.0 has been deprecated and will be removed in the next minor restic
version. You can migrate your S3 repository to the current layout using
`RESTIC_FEATURES=deprecate-s3-legacy-layout=false restic migrate s3_layout`.
It is possible to temporarily reenable support for the `s3legacy` layout by
setting the environment variable
`RESTIC_FEATURES=deprecate-s3-legacy-layout=false`. Note that this feature flag
will be removed in the next minor restic version.
https://github.com/restic/restic/issues/4602
https://github.com/restic/restic/pull/4724
https://github.com/restic/restic/pull/4743
* Change #4627: Redesign backend error handling to improve reliability
Restic now downloads pack files in large chunks instead of using a streaming
download. This prevents failures due to interrupted streams. The `restore`
command now also retries downloading individual blobs that could not be
retrieved.
HTTP requests that are stuck for more than two minutes while uploading or
downloading are now forcibly interrupted. This ensures that stuck requests are
retried after a short timeout.
Attempts to access a missing or truncated file will no longer be retried. This
avoids unnecessary retries in those cases. All other backend requests are
retried for up to 15 minutes. This ensures that temporarily interrupted network
connections can be tolerated.
If a download yields a corrupt file or blob, then the download will be retried
once.
Most parts of the new backend error handling can temporarily be disabled by
setting the environment variable `RESTIC_FEATURES=backend-error-redesign=false`.
Note that this feature flag will be removed in the next minor restic version.
https://github.com/restic/restic/issues/4627
https://github.com/restic/restic/issues/4193
https://github.com/restic/restic/issues/4515
https://github.com/restic/restic/issues/1523
https://github.com/restic/restic/pull/4605
https://github.com/restic/restic/pull/4792
https://github.com/restic/restic/pull/4520
https://github.com/restic/restic/pull/4800
https://github.com/restic/restic/pull/4784
https://github.com/restic/restic/pull/4844
* Change #4707: Disable S3 anonymous authentication by default
When using the S3 backend with anonymous authentication, it continuously tried
to retrieve new authentication credentials, causing bad performance.
Now, to use anonymous authentication, it is necessary to pass the extended
option `-o s3.unsafe-anonymous-auth=true` to restic.
It is possible to temporarily revert to the old behavior by setting the
environment variable `RESTIC_FEATURES=explicit-s3-anonymous-auth=false`. Note
that this feature flag will be removed in the next minor restic version.
https://github.com/restic/restic/issues/4707
https://github.com/restic/restic/pull/4908
* Change #4744: Include full key ID in JSON output of `key list`
The JSON output of the `key list` command has changed to include the full key ID
instead of just a shortened version of the ID, as the latter can be ambiguous in
some rare cases. To derive the short ID, please truncate the full ID down to
eight characters.
https://github.com/restic/restic/issues/4744
https://github.com/restic/restic/pull/4745
* Enhancement #662: Optionally skip snapshot creation if nothing changed
The `backup` command always created a snapshot even if nothing in the backup set
changed compared to the parent snapshot.
Restic now supports the `--skip-if-unchanged` option for the `backup` command,
which omits creating a snapshot if the new snapshot's content would be identical
to that of the parent snapshot.
https://github.com/restic/restic/issues/662
https://github.com/restic/restic/pull/4816
* Enhancement #693: Include snapshot size in `snapshots` output
The `snapshots` command now prints the size for snapshots created using this or
a future restic version. To achieve this, the `backup` command now stores the
backup summary statistics in the snapshot.
The text output of the `snapshots` command only shows the snapshot size. The
other statistics are only included in the JSON output. To inspect these
statistics use `restic snapshots --json` or `restic cat snapshot <snapshotID>`.
https://github.com/restic/restic/issues/693
https://github.com/restic/restic/pull/4705
https://github.com/restic/restic/pull/4913
* Enhancement #805: Add bitrot detection to `diff` command
The output of the `diff` command now includes the modifier `?` for files to
indicate bitrot in backed up files. The `?` will appear whenever there is a
difference in content while the metadata is exactly the same.
Since files with unchanged metadata are normally not read again when creating a
backup, the detection is only effective when the right-hand side of the diff has
been created with `backup --force`.
https://github.com/restic/restic/issues/805
https://github.com/restic/restic/pull/4526
* Enhancement #828: Improve features of the `repair packs` command
The `repair packs` command has been improved to also be able to process
truncated pack files. The `check` and `check --read-data` command will provide
instructions on using the command if necessary to repair a repository. See the
guide at https://restic.readthedocs.io/en/stable/077_troubleshooting.html for
further instructions.
https://github.com/restic/restic/issues/828
https://github.com/restic/restic/pull/4644
https://github.com/restic/restic/pull/4882
* Enhancement #1786: Support repositories with empty password
Restic previously required a password to create or operate on repositories.
Using the new option `--insecure-no-password` it is now possible to disable this
requirement. Restic will not prompt for a password when using this option.
For security reasons, the option must always be specified when operating on
repositories with an empty password, and specifying `--insecure-no-password`
while also passing a password to restic via a CLI option or environment variable
results in an error.
The `init` and `copy` commands add the related `--from-insecure-no-password`
option, which applies to the source repository. The `key add` and `key passwd`
commands add the `--new-insecure-no-password` option to add or set an empty
password.
https://github.com/restic/restic/issues/1786
https://github.com/restic/restic/issues/4326
https://github.com/restic/restic/pull/4698
https://github.com/restic/restic/pull/4808
* Enhancement #2348: Add `--delete` option to `restore` command
The `restore` command now supports a `--delete` option that allows removing
files and directories from the target directory that do not exist in the
snapshot. This option also allows files in the snapshot to replace non-empty
directories having the same name.
To check that only expected files are deleted, add the `--dry-run --verbose=2`
options.
https://github.com/restic/restic/issues/2348
https://github.com/restic/restic/pull/4881
* Enhancement #3067: Add extended options to configure Windows Shadow Copy Service
Previous, restic always used a 120 seconds timeout and unconditionally created
VSS snapshots for all volume mount points on disk. This behavior can now be
fine-tuned by the following new extended options (available only on Windows):
- `-o vss.timeout`: Time that VSS can spend creating snapshot before timing out
(default: 120s) - `-o vss.exclude-all-mount-points`: Exclude mountpoints from
snapshotting on all volumes (default: false) - `-o vss.exclude-volumes`:
Semicolon separated list of volumes to exclude from snapshotting - `-o
vss.provider`: VSS provider identifier which will be used for snapshotting
For example, change VSS timeout to five minutes and disable snapshotting of
mount points on all volumes:
Restic backup --use-fs-snapshot -o vss.timeout=5m -o
vss.exclude-all-mount-points=true
Exclude drive `d:`, mount point `c:\mnt` and a specific volume from
snapshotting:
Restic backup --use-fs-snapshot -o
vss.exclude-volumes="d:\;c:\mnt\;\\?\Volume{e2e0315d-9066-4f97-8343-eb5659b35762}"
Uses 'Microsoft Software Shadow Copy provider 1.0' instead of the default
provider:
Restic backup --use-fs-snapshot -o
vss.provider={b5946137-7b9f-4925-af80-51abd60b20d5}
https://github.com/restic/restic/pull/3067
* Enhancement #3406: Improve `dump` performance for large files
The `dump` command now retrieves the data chunks for a file in parallel. This
improves the download performance by up to as many times as the configured
number of parallel backend connections.
https://github.com/restic/restic/issues/3406
https://github.com/restic/restic/pull/4796
* Enhancement #3806: Optimize and make `prune` command resumable
Previously, if the `prune` command was interrupted, a later `prune` run would
start repacking pack files from the start, as `prune` did not update the index
while repacking.
The `prune` command now supports resuming interrupted prune runs. The update of
the repository index has also been optimized to use less memory and only rewrite
parts of the index that have changed.
https://github.com/restic/restic/issues/3806
https://github.com/restic/restic/pull/4812
* Enhancement #4006: (alpha) Store deviceID only for hardlinks
Set `RESTIC_FEATURES=device-id-for-hardlinks` to enable this alpha feature. The
feature flag will be removed after repository format version 3 becomes available
or be replaced with a different solution.
When creating backups from a filesystem snapshot, for example created using
BTRFS subvolumes, the deviceID of the filesystem changes compared to previous
snapshots. This prevented restic from deduplicating the directory metadata of a
snapshot.
When this alpha feature is enabled, the deviceID is only stored for hardlinks,
which significantly reduces the metadata duplication for most backups.
https://github.com/restic/restic/pull/4006
* Enhancement #4048: Add support for FUSE-T with `mount` on macOS
The restic `mount` command now supports creating FUSE mounts using FUSE-T on
macOS.
https://github.com/restic/restic/issues/4048
https://github.com/restic/restic/pull/4825
* Enhancement #4251: Support reading backup from a command's standard output
The `backup` command now supports the `--stdin-from-command` option. When using
this option, the arguments to `backup` are interpreted as a command instead of
paths to back up. `backup` then executes the given command and stores the
standard output from it in the backup, similar to the what the `--stdin` option
does. This also enables restic to verify that the command completes with exit
code zero. A non-zero exit code causes the backup to fail.
Note that the `--stdin` option does not have to be specified at the same time,
and that the `--stdin-filename` option also applies to `--stdin-from-command`.
Example: `restic backup --stdin-from-command --stdin-filename dump.sql mysqldump
[...]`
https://github.com/restic/restic/issues/4251
https://github.com/restic/restic/pull/4410
* Enhancement #4287: Support connection to rest-server using unix socket
Restic now supports using a unix socket to connect to a rest-server version
0.13.0 or later. This allows running restic as follows:
```
rest-server --listen unix:/tmp/rest.socket --data /path/to/data &
restic -r rest:http+unix:///tmp/rest.socket:/my_backup_repo/ [...]
```
https://github.com/restic/restic/issues/4287
https://github.com/restic/restic/pull/4655
* Enhancement #4354: Significantly reduce `prune` memory usage
The `prune` command has been optimized to use up to 60% less memory. The memory
usage should now be roughly similar to creating a backup.
https://github.com/restic/restic/pull/4354
https://github.com/restic/restic/pull/4812
* Enhancement #4437: Make `check` command create non-existent cache directory
Previously, if a custom cache directory was specified for the `check` command,
but the directory did not exist, `check` continued with the cache disabled.
The `check` command now attempts to create the cache directory before
initializing the cache.
https://github.com/restic/restic/issues/4437
https://github.com/restic/restic/pull/4805
https://github.com/restic/restic/pull/4883
* Enhancement #4472: Support AWS Assume Role for S3 backend
Previously only credentials discovered via the Minio discovery methods were used
to authenticate.
However, there are many circumstances where the discovered credentials have
lower permissions and need to assume a specific role. This is now possible using
the following new environment variables:
- RESTIC_AWS_ASSUME_ROLE_ARN - RESTIC_AWS_ASSUME_ROLE_SESSION_NAME -
RESTIC_AWS_ASSUME_ROLE_EXTERNAL_ID - RESTIC_AWS_ASSUME_ROLE_REGION (defaults to
us-east-1) - RESTIC_AWS_ASSUME_ROLE_POLICY - RESTIC_AWS_ASSUME_ROLE_STS_ENDPOINT
https://github.com/restic/restic/issues/4472
https://github.com/restic/restic/pull/4474
* Enhancement #4547: Add `--json` option to `version` command
Restic now supports outputting restic version along with the Go version, OS and
architecture used to build restic in JSON format using `version --json`.
https://github.com/restic/restic/issues/4547
https://github.com/restic/restic/pull/4553
* Enhancement #4549: Add `--ncdu` option to `ls` command
NCDU (NCurses Disk Usage) is a tool to analyse disk usage of directories. It has
an option to save a directory tree and analyse it later.
The `ls` command now supports outputting snapshot information in the NCDU format
using the `--ncdu` option. Example usage: `restic ls latest --ncdu | ncdu -f -`
https://github.com/restic/restic/issues/4549
https://github.com/restic/restic/pull/4550
https://github.com/restic/restic/pull/4911
* Enhancement #4573: Support rewriting host and time metadata in snapshots
The `rewrite` command now supports rewriting the host and/or time metadata of a
snapshot using the new `--new-host` and `--new-time` options.
https://github.com/restic/restic/pull/4573
* Enhancement #4583: Ignore `s3.storage-class` archive tiers for metadata
Restic used to store all files on S3 using the specified `s3.storage-class`.
Now, restic will only use non-archive storage tiers for metadata, to avoid
problems when accessing a repository. To restore any data, it is still necessary
to manually warm up the required data beforehand.
NOTE: There is no official cold storage support in restic, use this option at
your own risk.
https://github.com/restic/restic/issues/4583
https://github.com/restic/restic/pull/4584
* Enhancement #4590: Speed up `mount` command's error detection
The `mount` command now checks for the existence of the mountpoint before
opening the repository, leading to quicker error detection.
https://github.com/restic/restic/pull/4590
* Enhancement #4601: Add support for feature flags
Restic now supports feature flags that can be used to enable and disable
experimental features. The flags can be set using the environment variable
`RESTIC_FEATURES`. To get a list of currently supported feature flags, use the
`features` command.
https://github.com/restic/restic/issues/4601
https://github.com/restic/restic/pull/4666
* Enhancement #4611: Back up more file metadata on Windows
Previously, restic did not back up all common Windows-specific metadata.
Restic now stores file creation time and file attributes like the hidden,
read-only and encrypted flags when backing up files and folders on Windows.
https://github.com/restic/restic/pull/4611
* Enhancement #4664: Make `ls` use `message_type` field in JSON output
The `ls` command was the only restic command that used the `struct_type` field
in its JSON output format to specify the message type.
The JSON output of the `ls` command now also includes the `message_type` field,
which is consistent with other commands. The `struct_type` field is still
included, but now deprecated.
https://github.com/restic/restic/pull/4664
* Enhancement #4676: Make `key` command's actions separate sub-commands
Each of the `add`, `list`, `remove` and `passwd` actions provided by the `key`
command is now a separate sub-command and have its own documentation which can
be invoked using `restic key <add|list|remove|passwd> --help`.
https://github.com/restic/restic/issues/4676
https://github.com/restic/restic/pull/4685
* Enhancement #4678: Add `--target` option to the `dump` command
Restic `dump` always printed to the standard output. It now supports specifying
a `--target` file to write its output to.
https://github.com/restic/restic/issues/4678
https://github.com/restic/restic/pull/4682
https://github.com/restic/restic/pull/4692
* Enhancement #4708: Back up and restore SecurityDescriptors on Windows
Restic now backs up and restores SecurityDescriptors for files and folders on
Windows which includes owner, group, discretionary access control list (DACL)
and system access control list (SACL).
This requires the user to be a member of backup operators or the application
must be run as admin. If that is not the case, only the current user's owner,
group and DACL will be backed up, and during restore only the DACL of the backed
up file will be restored, with the current user's owner and group being set on
the restored file.
https://github.com/restic/restic/pull/4708
* Enhancement #4733: Allow specifying `--host` via environment variable
Restic commands that operate on snapshots, such as `restic backup` and `restic
snapshots`, support the `--host` option to specify the hostname for grouping
snapshots.
Such commands now also support specifying the hostname via the environment
variable `RESTIC_HOST`. Note that `--host` still takes precedence over the
environment variable.
https://github.com/restic/restic/issues/4733
https://github.com/restic/restic/pull/4734
* Enhancement #4737: Include snapshot ID in `reason` field of `forget` JSON output
The JSON output of the `forget` command now includes `id` and `short_id` of
snapshots in the `reason` field.
https://github.com/restic/restic/pull/4737
* Enhancement #4764: Support forgetting all snapshots
The `forget` command now supports the `--unsafe-allow-remove-all` option, which
removes all snapshots in the repository.
This option must always be combined with a snapshot filter (by host, path or
tag). For example, the command `forget --tag example --unsafe-allow-remove-all`
removes all snapshots with the tag "example".
https://github.com/restic/restic/pull/4764
* Enhancement #4768: Allow specifying custom User-Agent for outgoing requests
Restic now supports setting a custom `User-Agent` for outgoing HTTP requests
using the global option `--http-user-agent` or the `RESTIC_HTTP_USER_AGENT`
environment variable.
https://github.com/restic/restic/issues/4768
https://github.com/restic/restic/pull/4810
* Enhancement #4781: Add `restore` options to read include/exclude patterns from files
Restic now supports reading include and exclude patterns from files using the
`--include-file`, `--exclude-file`, `--iinclude-file` and `--iexclude-file`
options of the `restore` command.
https://github.com/restic/restic/issues/4781
https://github.com/restic/restic/pull/4811
* Enhancement #4807: Support Extended Attributes on Windows NTFS
Restic now backs up and restores Extended Attributes for files and folders on
Windows NTFS.
https://github.com/restic/restic/pull/4807
* Enhancement #4817: Make overwrite behavior of `restore` customizable
The `restore` command now supports an `--overwrite` option to configure whether
already existing files are overwritten. The overwrite behavior can be configured
using the following option values:
- `--overwrite always` (default): Always overwrites already existing files. The
`restore` command will verify the existing file content and only restore
mismatching parts to minimize downloads. Updates the metadata of all files. -
`--overwrite if-changed`: Like `always`, but speeds up the file content check by
assuming that files with matching size and modification time (mtime) are already
up to date. In case of a mismatch, the full file content is verified like with
`always`. Updates the metadata of all files. - `--overwrite if-newer`: Like
`always`, but only overwrites existing files when the file in the snapshot has a
newer modification time (mtime) than the existing file. - `--overwrite never`:
Never overwrites existing files.
https://github.com/restic/restic/issues/4817
https://github.com/restic/restic/issues/200
https://github.com/restic/restic/issues/407
https://github.com/restic/restic/issues/2662
https://github.com/restic/restic/pull/4837
https://github.com/restic/restic/pull/4838
https://github.com/restic/restic/pull/4864
https://github.com/restic/restic/pull/4921
* Enhancement #4839: Add dry-run support to `restore` command
The `restore` command now supports the `--dry-run` option to perform a dry run.
Pass the `--verbose=2` option to see which files would remain unchanged, and
which would be updated or freshly restored.
https://github.com/restic/restic/pull/4839
# Changelog for restic 0.16.5 (2024-07-01)
The following sections list the changes in restic 0.16.5 relevant to
restic users. The changes are ordered by importance.
## Summary
* Enh #4799: Add option to force use of Azure CLI credential
* Enh #4873: Update dependencies
## Details
* Enhancement #4799: Add option to force use of Azure CLI credential
A new environment variable `AZURE_FORCE_CLI_CREDENTIAL=true` allows forcing the
use of Azure CLI credential, ignoring other credentials like managed identity.
https://github.com/restic/restic/pull/4799
* Enhancement #4873: Update dependencies
A few potentially vulnerable dependencies were updated.
https://github.com/restic/restic/issues/4873
https://github.com/restic/restic/pull/4878
# Changelog for restic 0.16.4 (2024-02-04)
The following sections list the changes in restic 0.16.4 relevant to
restic users. The changes are ordered by importance.
@ -596,7 +1330,7 @@ restic users. The changes are ordered by importance.
* Enhancement #3941: Support `--group-by` for backup parent selection
Previously, the `backup` command by default selected the parent snapshot based
on the hostname and the backup targets. When the backup path list changed, the
on the hostname and the backup paths. When the backup path list changed, the
`backup` command was unable to determine a suitable parent snapshot and had to
read all files again.
@ -2490,7 +3224,7 @@ restic users. The changes are ordered by importance.
* Fix #3151: Don't create invalid snapshots when `backup` is interrupted
* Fix #3152: Do not hang until foregrounded when completed in background
* Fix #3166: Improve error handling in the `restore` command
* Fix #3232: Correct statistics for overlapping targets
* Fix #3232: Correct statistics for overlapping backup sources
* Fix #3249: Improve error handling in `gs` backend
* Chg #3095: Deleting files on Google Drive now moves them to the trash
* Enh #909: Back up mountpoints as empty directories
@ -2657,10 +3391,10 @@ restic users. The changes are ordered by importance.
https://github.com/restic/restic/issues/3166
https://github.com/restic/restic/pull/3207
* Bugfix #3232: Correct statistics for overlapping targets
* Bugfix #3232: Correct statistics for overlapping backup sources
A user reported that restic's statistics and progress information during backup
was not correctly calculated when the backup targets (files/dirs to save)
was not correctly calculated when the backup sources (files/dirs to save)
overlap. For example, consider a directory `foo` which contains (among others) a
file `foo/bar`. When `restic backup foo foo/bar` was run, restic counted the
size of the file `foo/bar` twice, so the completeness percentage as well as the
@ -2925,7 +3659,7 @@ restic users. The changes are ordered by importance.
* Enhancement #3106: Parallelize scan of snapshot content in `copy` and `prune`
The `copy` and `prune` commands used to traverse the directories of snapshots
one by one to find used data. This snapshot traversal is now parallized which
one by one to find used data. This snapshot traversal is now parallelized which
can speed up this step several times.
In addition the `check` command now reports how many snapshots have already been
@ -3024,11 +3758,10 @@ restic users. The changes are ordered by importance.
* Bugfix #1756: Mark repository files as read-only when using the local backend
Files stored in a local repository were marked as writeable on the filesystem
for non-Windows systems, which did not prevent accidental file modifications
outside of restic. In addition, the local backend did not work with certain
filesystems and network mounts which do not permit modifications of file
permissions.
Files stored in a local repository were marked as writable on the filesystem for
non-Windows systems, which did not prevent accidental file modifications outside
of restic. In addition, the local backend did not work with certain filesystems
and network mounts which do not permit modifications of file permissions.
Restic now marks files stored in a local repository as read-only on the
filesystem on non-Windows systems. The error handling is improved to support
@ -3122,7 +3855,7 @@ restic users. The changes are ordered by importance.
was unable to backup those files before. This update enables backing up these
files.
This needs to be enabled explicitely using the --use-fs-snapshot option of the
This needs to be enabled explicitly using the --use-fs-snapshot option of the
backup command.
https://github.com/restic/restic/issues/340
@ -3332,8 +4065,8 @@ restic users. The changes are ordered by importance.
* 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.
Running 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
@ -3488,7 +4221,7 @@ restic users. The changes are ordered by importance.
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
written to the file before any of the preceding 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.
@ -3722,7 +4455,7 @@ restic users. The changes are ordered by importance.
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.
to adding a separate flag to disable just the ctime check.
https://github.com/restic/restic/issues/2179
https://github.com/restic/restic/pull/2212
@ -4096,7 +4829,7 @@ restic users. The changes are ordered by importance.
* Enhancement #1876: Display reason why forget keeps snapshots
We've added a column to the list of snapshots `forget` keeps which details the
reasons to keep a particuliar snapshot. This makes debugging policies for forget
reasons to keep a particular snapshot. This makes debugging policies for forget
much easier. Please remember to always try things out with `--dry-run`!
https://github.com/restic/restic/pull/1876
@ -4409,7 +5142,7 @@ restic users. The changes are ordered by importance.
* Enh #1665: Improve cache handling for `restic check`
* Enh #1709: Improve messages `restic check` prints
* Enh #1721: Add `cache` command to list cache dirs
* Enh #1735: Allow keeping a time range of snaphots
* Enh #1735: Allow keeping a time range of snapshots
* Enh #1758: Allow saving OneDrive folders in Windows
* Enh #1782: Use default AWS credentials chain for S3 backend
@ -4615,7 +5348,7 @@ restic users. The changes are ordered by importance.
https://github.com/restic/restic/issues/1721
https://github.com/restic/restic/pull/1749
* Enhancement #1735: Allow keeping a time range of snaphots
* Enhancement #1735: Allow keeping a time range of snapshots
We've added the `--keep-within` option to the `forget` command. It instructs
restic to keep all snapshots within the given duration since the newest
@ -4717,7 +5450,7 @@ restic users. The changes are ordered by importance.
already exists.
This is not accurate, the file could have been created between the HTTP request
testing for it, and when writing starts, so we've relaxed this requeriment,
testing for it, and when writing starts, so we've relaxed this requirement,
which saves one additional HTTP request per newly added file.
https://github.com/restic/restic/pull/1623
@ -4737,7 +5470,7 @@ restic users. The changes are ordered by importance.
## Summary
* Fix #1506: Limit bandwith at the http.RoundTripper for HTTP based backends
* Fix #1506: Limit bandwidth at the http.RoundTripper for HTTP based backends
* Fix #1512: Restore directory permissions as the last step
* Fix #1528: Correctly create missing subdirs in data/
* Fix #1589: Complete intermediate index upload
@ -4757,7 +5490,7 @@ restic users. The changes are ordered by importance.
## Details
* Bugfix #1506: Limit bandwith at the http.RoundTripper for HTTP based backends
* Bugfix #1506: Limit bandwidth at the http.RoundTripper for HTTP based backends
https://github.com/restic/restic/issues/1506
https://github.com/restic/restic/pull/1511
@ -4814,7 +5547,7 @@ restic users. The changes are ordered by importance.
* Bugfix #1595: Backup: Remove bandwidth display
This commit removes the bandwidth displayed during backup process. It is
misleading and seldomly correct, because it's neither the "read bandwidth" (only
misleading and seldom correct, because it's neither the "read bandwidth" (only
for the very first backup) nor the "upload bandwidth". Many users are confused
about (and rightly so), c.f. #1581, #1033, #1591
@ -5087,7 +5820,7 @@ restic users. The changes are ordered by importance.
We've added a local cache for metadata so that restic doesn't need to load all
metadata (snapshots, indexes, ...) from the repo each time it starts. By default
the cache is active, but there's a new global option `--no-cache` that can be
used to disable the cache. By deafult, the cache a standard cache folder for the
used to disable the cache. By default, the cache a standard cache folder for the
OS, which can be overridden with `--cache-dir`. The cache will automatically
populate, indexes and snapshots are saved as they are loaded. Cache directories
for repos that haven't been used recently can automatically be removed by restic
@ -5174,7 +5907,7 @@ restic users. The changes are ordered by importance.
* Enhancement #1319: Make `check` print `no errors found` explicitly
The `check` command now explicetly prints `No errors were found` when no errors
The `check` command now explicitly prints `No errors were found` when no errors
could be found.
https://github.com/restic/restic/issues/1303

View file

@ -1 +1 @@
0.16.4
0.17.0-dev

View file

@ -58,7 +58,7 @@ var config = Config{
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: 18, Patch: 0}, // minimum Go version supported
MinVersion: GoVersion{Major: 1, Minor: 21, Patch: 0}, // minimum Go version supported
}
// Config configures the build.

View file

@ -10,7 +10,7 @@ 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.
file can be written to the file before any of the preceding 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.

View file

@ -1,7 +1,7 @@
Bugfix: Correct statistics for overlapping targets
Bugfix: Correct statistics for overlapping backup sources
A user reported that restic's statistics and progress information during backup
was not correctly calculated when the backup targets (files/dirs to save)
was not correctly calculated when the backup sources (files/dirs to save)
overlap. For example, consider a directory `foo` which contains (among others)
a file `foo/bar`. When `restic backup foo foo/bar` was run, restic counted the
size of the file `foo/bar` twice, so the completeness percentage as well as the

View file

@ -1,7 +1,7 @@
Enhancement: Support `--group-by` for backup parent selection
Previously, the `backup` command by default selected the parent snapshot based
on the hostname and the backup targets. When the backup path list changed, the
on the hostname and the backup paths. When the backup path list changed, the
`backup` command was unable to determine a suitable parent snapshot and had to
read all files again.

View file

@ -0,0 +1,6 @@
Enhancement: Update dependencies
A few potentially vulnerable dependencies were updated.
https://github.com/restic/restic/issues/4873
https://github.com/restic/restic/pull/4878

View file

@ -0,0 +1,5 @@
Enhancement: Add option to force use of Azure CLI credential
A new environment variable `AZURE_FORCE_CLI_CREDENTIAL=true` allows forcing the use of Azure CLI credential, ignoring other credentials like managed identity.
https://github.com/restic/restic/pull/4799

View file

@ -0,0 +1,20 @@
Enhancement: Support repositories with empty password
Restic previously required a password to create or operate on repositories.
Using the new option `--insecure-no-password` it is now possible to disable
this requirement. Restic will not prompt for a password when using this option.
For security reasons, the option must always be specified when operating on
repositories with an empty password, and specifying `--insecure-no-password`
while also passing a password to restic via a CLI option or environment
variable results in an error.
The `init` and `copy` commands add the related `--from-insecure-no-password`
option, which applies to the source repository. The `key add` and `key passwd`
commands add the `--new-insecure-no-password` option to add or set an empty
password.
https://github.com/restic/restic/issues/1786
https://github.com/restic/restic/issues/4326
https://github.com/restic/restic/pull/4698
https://github.com/restic/restic/pull/4808

View file

@ -0,0 +1,12 @@
Enhancement: Add `--delete` option to `restore` command
The `restore` command now supports a `--delete` option that allows removing
files and directories from the target directory that do not exist in the
snapshot. This option also allows files in the snapshot to replace non-empty
directories having the same name.
To check that only expected files are deleted, add the `--dry-run --verbose=2`
options.
https://github.com/restic/restic/issues/2348
https://github.com/restic/restic/pull/4881

View file

@ -0,0 +1,11 @@
Bugfix: Handle unreadable xattrs in folders above `backup` source
When backup sources are specified using absolute paths, `backup` also includes
information about the parent folders of the backup sources in the snapshot.
If the extended attributes for some of these folders could not be read due to
missing permissions, this caused the backup to fail. This has now been fixed.
https://github.com/restic/restic/issues/3600
https://github.com/restic/restic/pull/4668
https://forum.restic.net/t/parent-directories-above-the-snapshot-source-path-fatal-error-permission-denied/7216

View file

@ -0,0 +1,12 @@
Enhancement: Optimize and make `prune` command resumable
Previously, if the `prune` command was interrupted, a later `prune` run would
start repacking pack files from the start, as `prune` did not update the index
while repacking.
The `prune` command now supports resuming interrupted prune runs. The update
of the repository index has also been optimized to use less memory and only
rewrite parts of the index that have changed.
https://github.com/restic/restic/issues/3806
https://github.com/restic/restic/pull/4812

View file

@ -0,0 +1,6 @@
Enhancement: Add support for FUSE-T with `mount` on macOS
The restic `mount` command now supports creating FUSE mounts using FUSE-T on macOS.
https://github.com/restic/restic/issues/4048
https://github.com/restic/restic/pull/4825

View file

@ -0,0 +1,7 @@
Bugfix: Fix slow SFTP upload performance
Since restic 0.12.1, the upload speed of the sftp backend to a remote server
has regressed significantly. This has now been fixed.
https://github.com/restic/restic/issues/4209
https://github.com/restic/restic/pull/4782

View file

@ -1,4 +1,4 @@
Enhancement: Support reading backup from a commands's standard output
Enhancement: Support reading backup from a command's standard output
The `backup` command now supports the `--stdin-from-command` option. When using
this option, the arguments to `backup` are interpreted as a command instead of

View file

@ -0,0 +1,12 @@
Enhancement: Support connection to rest-server using unix socket
Restic now supports using a unix socket to connect to a rest-server
version 0.13.0 or later. This allows running restic as follows:
```
rest-server --listen unix:/tmp/rest.socket --data /path/to/data &
restic -r rest:http+unix:///tmp/rest.socket:/my_backup_repo/ [...]
```
https://github.com/restic/restic/issues/4287
https://github.com/restic/restic/pull/4655

View file

@ -0,0 +1,11 @@
Enhancement: Make `check` command create non-existent cache directory
Previously, if a custom cache directory was specified for the `check` command,
but the directory did not exist, `check` continued with the cache disabled.
The `check` command now attempts to create the cache directory before
initializing the cache.
https://github.com/restic/restic/issues/4437
https://github.com/restic/restic/pull/4805
https://github.com/restic/restic/pull/4883

View file

@ -1,11 +1,11 @@
Enhancement: Allow AWS Assume Role to be used for S3 backend
Enhancement: Support AWS Assume Role for S3 backend
Previously only credentials discovered via the Minio discovery methods
were used to authenticate.
However, there are many circumstances where the discovered credentials have
lower permissions and need to assume a specific role. This is now possible
using the following new environment variables.
using the following new environment variables:
- RESTIC_AWS_ASSUME_ROLE_ARN
- RESTIC_AWS_ASSUME_ROLE_SESSION_NAME

View file

@ -1,6 +1,7 @@
Change: Require at least ARMv6 for ARM binaries
The official release binaries of restic now require at least ARMv6 support for ARM platforms.
The official release binaries of restic now require
at least ARMv6 support for ARM platforms.
https://github.com/restic/restic/issues/4540
https://github.com/restic/restic/pull/4542

View file

@ -0,0 +1,7 @@
Enhancement: Add `--json` option to `version` command
Restic now supports outputting restic version along with the Go version, OS
and architecture used to build restic in JSON format using `version --json`.
https://github.com/restic/restic/issues/4547
https://github.com/restic/restic/pull/4553

View file

@ -0,0 +1,11 @@
Enhancement: Add `--ncdu` option to `ls` command
NCDU (NCurses Disk Usage) is a tool to analyse disk usage of directories. It has
an option to save a directory tree and analyse it later.
The `ls` command now supports outputting snapshot information in the NCDU format
using the `--ncdu` option. Example usage: `restic ls latest --ncdu | ncdu -f -`
https://github.com/restic/restic/issues/4549
https://github.com/restic/restic/pull/4550
https://github.com/restic/restic/pull/4911

View file

@ -0,0 +1,16 @@
Bugfix: Prevent `forget --keep-tags <invalid>` from deleting all snapshots
Running `forget --keep-tags <invalid>`, where `<invalid>` is a tag that does
not exist in the repository, would remove all snapshots. This is especially
problematic if the tag name contains a typo.
The `forget` command now fails with an error if all snapshots in a snapshot
group would be deleted. This prevents the above example from deleting all
snapshots.
It is possible to temporarily disable the new check by setting the environment
variable `RESTIC_FEATURES=safe-forget-keep-tags=false`. Note that this feature
flag will be removed in the next minor restic version.
https://github.com/restic/restic/pull/4568
https://github.com/restic/restic/pull/4764

View file

@ -0,0 +1,13 @@
Enhancement: Ignore `s3.storage-class` archive tiers for metadata
Restic used to store all files on S3 using the specified `s3.storage-class`.
Now, restic will only use non-archive storage tiers for metadata, to avoid
problems when accessing a repository. To restore any data, it is still
necessary to manually warm up the required data beforehand.
NOTE: There is no official cold storage support in restic, use this option at
your own risk.
https://github.com/restic/restic/issues/4583
https://github.com/restic/restic/pull/4584

View file

@ -2,8 +2,8 @@ Enhancement: Add support for feature flags
Restic now supports feature flags that can be used to enable and disable
experimental features. The flags can be set using the environment variable
`RESTIC_FEATURES`. To get a list of currently supported feature flags,
run the `features` command.
`RESTIC_FEATURES`. To get a list of currently supported feature flags, use
the `features` command.
https://github.com/restic/restic/issues/4601
https://github.com/restic/restic/pull/4666

View file

@ -0,0 +1,22 @@
Change: Deprecate legacy index format and `s3legacy` repository layout
Support for the legacy index format used by restic before version 0.2.0 has
been deprecated and will be removed in the next minor restic version. You can
use `restic repair index` to update the index to the current format.
It is possible to temporarily reenable support for the legacy index format by
setting the environment variable `RESTIC_FEATURES=deprecate-legacy-index=false`.
Note that this feature flag will be removed in the next minor restic version.
Support for the `s3legacy` repository layout used for the S3 backend before
restic 0.7.0 has been deprecated and will be removed in the next minor restic
version. You can migrate your S3 repository to the current layout using
`RESTIC_FEATURES=deprecate-s3-legacy-layout=false restic migrate s3_layout`.
It is possible to temporarily reenable support for the `s3legacy` layout by
setting the environment variable `RESTIC_FEATURES=deprecate-s3-legacy-layout=false`.
Note that this feature flag will be removed in the next minor restic version.
https://github.com/restic/restic/issues/4602
https://github.com/restic/restic/pull/4724
https://github.com/restic/restic/pull/4743

View file

@ -0,0 +1,33 @@
Change: Redesign backend error handling to improve reliability
Restic now downloads pack files in large chunks instead of using a streaming
download. This prevents failures due to interrupted streams. The `restore`
command now also retries downloading individual blobs that could not be
retrieved.
HTTP requests that are stuck for more than two minutes while uploading or
downloading are now forcibly interrupted. This ensures that stuck requests are
retried after a short timeout.
Attempts to access a missing or truncated file will no longer be retried. This
avoids unnecessary retries in those cases. All other backend requests are
retried for up to 15 minutes. This ensures that temporarily interrupted network
connections can be tolerated.
If a download yields a corrupt file or blob, then the download will be retried
once.
Most parts of the new backend error handling can temporarily be disabled by
setting the environment variable `RESTIC_FEATURES=backend-error-redesign=false`.
Note that this feature flag will be removed in the next minor restic version.
https://github.com/restic/restic/issues/4627
https://github.com/restic/restic/issues/4193
https://github.com/restic/restic/pull/4605
https://github.com/restic/restic/pull/4792
https://github.com/restic/restic/issues/4515
https://github.com/restic/restic/issues/1523
https://github.com/restic/restic/pull/4520
https://github.com/restic/restic/pull/4800
https://github.com/restic/restic/pull/4784
https://github.com/restic/restic/pull/4844

View file

@ -1,6 +1,6 @@
Bugfix: Properly report the ID of newly added keys
Bugfix: Properly report ID of newly added keys
`restic key add` now reports the ID of a newly added key. This simplifies
`restic key add` now reports the ID of the newly added key. This simplifies
selecting a specific key using the `--key-hint key` option.
https://github.com/restic/restic/issues/4656

View file

@ -0,0 +1,8 @@
Enhancement: Make `key` command's actions separate sub-commands
Each of the `add`, `list`, `remove` and `passwd` actions provided by the `key`
command is now a separate sub-command and have its own documentation which can
be invoked using `restic key <add|list|remove|passwd> --help`.
https://github.com/restic/restic/issues/4676
https://github.com/restic/restic/pull/4685

View file

@ -0,0 +1,8 @@
Enhancement: Add `--target` option to the `dump` command
Restic `dump` always printed to the standard output. It now supports specifying
a `--target` file to write its output to.
https://github.com/restic/restic/issues/4678
https://github.com/restic/restic/pull/4682
https://github.com/restic/restic/pull/4692

View file

@ -0,0 +1,14 @@
Change: Disable S3 anonymous authentication by default
When using the S3 backend with anonymous authentication, it continuously
tried to retrieve new authentication credentials, causing bad performance.
Now, to use anonymous authentication, it is necessary to pass the extended
option `-o s3.unsafe-anonymous-auth=true` to restic.
It is possible to temporarily revert to the old behavior by setting the
environment variable `RESTIC_FEATURES=explicit-s3-anonymous-auth=false`. Note
that this feature flag will be removed in the next minor restic version.
https://github.com/restic/restic/issues/4707
https://github.com/restic/restic/pull/4908

View file

@ -0,0 +1,12 @@
Enhancement: Allow specifying `--host` via environment variable
Restic commands that operate on snapshots, such as `restic backup` and
`restic snapshots`, support the `--host` option to specify the hostname
for grouping snapshots.
Such commands now also support specifying the hostname via the environment
variable `RESTIC_HOST`. Note that `--host` still takes precedence over the
environment variable.
https://github.com/restic/restic/issues/4733
https://github.com/restic/restic/pull/4734

View file

@ -0,0 +1,9 @@
Change: Include full key ID in JSON output of `key list`
The JSON output of the `key list` command has changed to include the full key
ID instead of just a shortened version of the ID, as the latter can be ambiguous
in some rare cases. To derive the short ID, please truncate the full ID down to
eight characters.
https://github.com/restic/restic/issues/4744
https://github.com/restic/restic/pull/4745

View file

@ -0,0 +1,8 @@
Bugfix: Fix possible error on concurrent cache cleanup
If multiple restic processes concurrently cleaned up no longer existing files
from the cache, this could cause some of the processes to fail with an `no such
file or directory` error. This has now been fixed.
https://github.com/restic/restic/issues/4760
https://github.com/restic/restic/pull/4761

View file

@ -0,0 +1,8 @@
Enhancement: Allow specifying custom User-Agent for outgoing requests
Restic now supports setting a custom `User-Agent` for outgoing HTTP requests
using the global option `--http-user-agent` or the `RESTIC_HTTP_USER_AGENT`
environment variable.
https://github.com/restic/restic/issues/4768
https://github.com/restic/restic/pull/4810

View file

@ -0,0 +1,8 @@
Enhancement: Add `restore` options to read include/exclude patterns from files
Restic now supports reading include and exclude patterns from files using the
`--include-file`, `--exclude-file`, `--iinclude-file` and `--iexclude-file`
options of the `restore` command.
https://github.com/restic/restic/issues/4781
https://github.com/restic/restic/pull/4811

View file

@ -0,0 +1,26 @@
Enhancement: Make overwrite behavior of `restore` customizable
The `restore` command now supports an `--overwrite` option to configure whether
already existing files are overwritten. The overwrite behavior can be configured
using the following option values:
- `--overwrite always` (default): Always overwrites already existing files.
The `restore` command will verify the existing file content and only restore
mismatching parts to minimize downloads. Updates the metadata of all files.
- `--overwrite if-changed`: Like `always`, but speeds up the file content check
by assuming that files with matching size and modification time (mtime) are
already up to date. In case of a mismatch, the full file content is verified
like with `always`. Updates the metadata of all files.
- `--overwrite if-newer`: Like `always`, but only overwrites existing files
when the file in the snapshot has a newer modification time (mtime) than the
existing file.
- `--overwrite never`: Never overwrites existing files.
https://github.com/restic/restic/issues/4817
https://github.com/restic/restic/issues/200
https://github.com/restic/restic/issues/407
https://github.com/restic/restic/issues/2662
https://github.com/restic/restic/pull/4837
https://github.com/restic/restic/pull/4838
https://github.com/restic/restic/pull/4864
https://github.com/restic/restic/pull/4921

View file

@ -0,0 +1,8 @@
Bugfix: Handle UTF-16 password files in `key` command correctly
Previously, `key add` and `key passwd` did not properly decode UTF-16
encoded passwords read from a password file. This has now been fixed
to correctly match the encoding when opening a repository.
https://github.com/restic/restic/issues/4850
https://github.com/restic/restic/pull/4851

View file

@ -0,0 +1,8 @@
Bugfix: Update snapshot summary on `rewrite`
Restic previously did not recalculate the total number of files and bytes
processed when files were excluded from a snapshot by the `rewrite` command.
This has now been fixed.
https://github.com/restic/restic/issues/4902
https://github.com/restic/restic/pull/4905

View file

@ -0,0 +1,11 @@
Enhancement: Optionally skip snapshot creation if nothing changed
The `backup` command always created a snapshot even if nothing in the
backup set changed compared to the parent snapshot.
Restic now supports the `--skip-if-unchanged` option for the `backup`
command, which omits creating a snapshot if the new snapshot's content
would be identical to that of the parent snapshot.
https://github.com/restic/restic/issues/662
https://github.com/restic/restic/pull/4816

View file

@ -0,0 +1,13 @@
Enhancement: Include snapshot size in `snapshots` output
The `snapshots` command now prints the size for snapshots created using this
or a future restic version. To achieve this, the `backup` command now stores
the backup summary statistics in the snapshot.
The text output of the `snapshots` command only shows the snapshot size. The
other statistics are only included in the JSON output. To inspect these
statistics use `restic snapshots --json` or `restic cat snapshot <snapshotID>`.
https://github.com/restic/restic/issues/693
https://github.com/restic/restic/pull/4705
https://github.com/restic/restic/pull/4913

View file

@ -0,0 +1,11 @@
Enhancement: Improve features of the `repair packs` command
The `repair packs` command has been improved to also be able to process
truncated pack files. The `check` and `check --read-data` command will provide
instructions on using the command if necessary to repair a repository. See the
guide at https://restic.readthedocs.io/en/stable/077_troubleshooting.html for
further instructions.
https://github.com/restic/restic/issues/828
https://github.com/restic/restic/pull/4644
https://github.com/restic/restic/pull/4882

View file

@ -0,0 +1,25 @@
Enhancement: Add extended options to configure Windows Shadow Copy Service
Previous, restic always used a 120 seconds timeout and unconditionally created
VSS snapshots for all volume mount points on disk. This behavior can now be
fine-tuned by the following new extended options (available only on Windows):
- `-o vss.timeout`: Time that VSS can spend creating snapshot before timing out (default: 120s)
- `-o vss.exclude-all-mount-points`: Exclude mountpoints from snapshotting on all volumes (default: false)
- `-o vss.exclude-volumes`: Semicolon separated list of volumes to exclude from snapshotting
- `-o vss.provider`: VSS provider identifier which will be used for snapshotting
For example, change VSS timeout to five minutes and disable snapshotting of
mount points on all volumes:
restic backup --use-fs-snapshot -o vss.timeout=5m -o vss.exclude-all-mount-points=true
Exclude drive `d:`, mount point `c:\mnt` and a specific volume from snapshotting:
restic backup --use-fs-snapshot -o vss.exclude-volumes="d:\;c:\mnt\;\\?\Volume{e2e0315d-9066-4f97-8343-eb5659b35762}"
Uses 'Microsoft Software Shadow Copy provider 1.0' instead of the default provider:
restic backup --use-fs-snapshot -o vss.provider={b5946137-7b9f-4925-af80-51abd60b20d5}
https://github.com/restic/restic/pull/3067

View file

@ -0,0 +1,15 @@
Enhancement: (alpha) Store deviceID only for hardlinks
Set `RESTIC_FEATURES=device-id-for-hardlinks` to enable this alpha feature.
The feature flag will be removed after repository format version 3 becomes
available or be replaced with a different solution.
When creating backups from a filesystem snapshot, for example created using
BTRFS subvolumes, the deviceID of the filesystem changes compared to previous
snapshots. This prevented restic from deduplicating the directory metadata of
a snapshot.
When this alpha feature is enabled, the deviceID is only stored for hardlinks,
which significantly reduces the metadata duplication for most backups.
https://github.com/restic/restic/pull/4006

View file

@ -0,0 +1,7 @@
Enhancement: Significantly reduce `prune` memory usage
The `prune` command has been optimized to use up to 60% less memory.
The memory usage should now be roughly similar to creating a backup.
https://github.com/restic/restic/pull/4354
https://github.com/restic/restic/pull/4812

View file

@ -0,0 +1,8 @@
Bugfix: Correct hardlink handling in `stats` command
If files on different devices had the same inode ID, the `stats` command
did not correctly calculate the snapshot size. This has now been fixed.
https://forum.restic.net/t/possible-bug-in-stats/6461/8
https://github.com/restic/restic/pull/4503
https://github.com/restic/restic/pull/4006

View file

@ -0,0 +1,12 @@
Enhancement: Add bitrot detection to `diff` command
The output of the `diff` command now includes the modifier `?` for files to
indicate bitrot in backed up files. The `?` will appear whenever there is a
difference in content while the metadata is exactly the same.
Since files with unchanged metadata are normally not read again when creating
a backup, the detection is only effective when the right-hand side of the diff
has been created with `backup --force`.
https://github.com/restic/restic/issues/805
https://github.com/restic/restic/pull/4526

View file

@ -0,0 +1,6 @@
Enhancement: Support rewriting host and time metadata in snapshots
The `rewrite` command now supports rewriting the host and/or time metadata of
a snapshot using the new `--new-host` and `--new-time` options.
https://github.com/restic/restic/pull/4573

View file

@ -0,0 +1,6 @@
Enhancement: Speed up `mount` command's error detection
The `mount` command now checks for the existence of the mountpoint before
opening the repository, leading to quicker error detection.
https://github.com/restic/restic/pull/4590

View file

@ -0,0 +1,9 @@
Enhancement: Back up more file metadata on Windows
Previously, restic did not back up all common Windows-specific metadata.
Restic now stores file creation time and file attributes like the hidden,
read-only and encrypted flags when backing up files and folders on Windows.
https://github.com/restic/restic/pull/4611

View file

@ -1,6 +1,6 @@
Bugfix: `find` ignored directories in some cases
Bugfix: Make `find` not sometimes ignore directories
In some cases, the `find` command ignored empty or moved directories. This has
been fixed.
now been fixed.
https://github.com/restic/restic/pull/4615

View file

@ -0,0 +1,10 @@
Enhancement: Make `ls` use `message_type` field in JSON output
The `ls` command was the only restic command that used the `struct_type` field
in its JSON output format to specify the message type.
The JSON output of the `ls` command now also includes the `message_type` field,
which is consistent with other commands. The `struct_type` field is still
included, but now deprecated.
https://github.com/restic/restic/pull/4664

View file

@ -0,0 +1,11 @@
Bugfix: Shutdown cleanly when receiving SIGTERM
Previously, when restic received the SIGTERM signal it would terminate
immediately, skipping cleanup and potentially causing issues like stale locks
being left behind. This primarily effected containerized restic invocations
that use SIGTERM, but could also be triggered via a simple `killall restic`.
This has now been fixed, such that restic shuts down cleanly when receiving
the SIGTERM signal.
https://github.com/restic/restic/pull/4703

View file

@ -0,0 +1,13 @@
Enhancement: Back up and restore SecurityDescriptors on Windows
Restic now backs up and restores SecurityDescriptors for files and folders on
Windows which includes owner, group, discretionary access control list (DACL)
and system access control list (SACL).
This requires the user to be a member of backup operators or the application
must be run as admin. If that is not the case, only the current user's owner,
group and DACL will be backed up, and during restore only the DACL of the
backed up file will be restored, with the current user's owner and group
being set on the restored file.
https://github.com/restic/restic/pull/4708

View file

@ -0,0 +1,10 @@
Bugfix: Correct `--no-lock` handling of `ls` and `tag` commands
The `ls` command never locked the repository. This has now been fixed, with the
old behavior still being supported using `ls --no-lock`. The latter invocation
also works with older restic versions.
The `tag` command erroneously accepted the `--no-lock` command. This command
now always requires an exclusive lock.
https://github.com/restic/restic/pull/4709

View file

@ -0,0 +1,6 @@
Enhancement: Include snapshot ID in `reason` field of `forget` JSON output
The JSON output of the `forget` command now includes `id` and `short_id` of
snapshots in the `reason` field.
https://github.com/restic/restic/pull/4737

View file

@ -0,0 +1,10 @@
Enhancement: Support forgetting all snapshots
The `forget` command now supports the `--unsafe-allow-remove-all` option, which
removes all snapshots in the repository.
This option must always be combined with a snapshot filter (by host, path or
tag). For example, the command `forget --tag example --unsafe-allow-remove-all`
removes all snapshots with the tag "example".
https://github.com/restic/restic/pull/4764

View file

@ -0,0 +1,8 @@
Enhancement: Improve `dump` performance for large files
The `dump` command now retrieves the data chunks for a file in
parallel. This improves the download performance by up to as many
times as the configured number of parallel backend connections.
https://github.com/restic/restic/issues/3406
https://github.com/restic/restic/pull/4796

View file

@ -0,0 +1,6 @@
Enhancement: Support Extended Attributes on Windows NTFS
Restic now backs up and restores Extended Attributes for files
and folders on Windows NTFS.
https://github.com/restic/restic/pull/4807

View file

@ -0,0 +1,7 @@
Enhancement: Add dry-run support to `restore` command
The `restore` command now supports the `--dry-run` option to perform
a dry run. Pass the `--verbose=2` option to see which files would
remain unchanged, and which would be updated or freshly restored.
https://github.com/restic/restic/pull/4839

View file

@ -0,0 +1,11 @@
Change: Return exit code 10 and 11 for non-existing and locked repository
If a repository does not exist or cannot be locked, restic previously always
returned exit code 1. This made it difficult to distinguish these cases from
other errors.
Restic now returns exit code 10 if the repository does not exist, and exit code
11 if the repository could be not locked due to a conflicting lock.
https://github.com/restic/restic/issues/956
https://github.com/restic/restic/pull/4884

View file

@ -0,0 +1,19 @@
Bugfix: Correctly handle passing volume name to `backup` command
On Windows, when the specified backup target only included the volume
name without a trailing slash, for example, `C:`, then restoring the
resulting snapshot would result in an error. Note that using `C:\`
as backup target worked correctly.
Specifying volume names now works correctly.
To restore snapshots created before this bugfix, use the `<snapshot>:<subpath>`
syntax. For a snapshot with ID `12345678` and a backup of `C:`, the following
command can be used:
```
restic restore 12345678:/C/C:./ --target output/folder
```
https://github.com/restic/restic/issues/2004
https://github.com/restic/restic/pull/5028

View file

@ -1,8 +0,0 @@
Change: Don't retry to load files that don't exist
Restic used to always retry to load files. It now only retries to load
files if they exist.
https://github.com/restic/restic/issues/4515
https://github.com/restic/restic/issues/1523
https://github.com/restic/restic/pull/4520

View file

@ -1,7 +0,0 @@
Enhancement: Add support for `--json` option to `version` command
Restic now supports outputting restic version and used go version, OS and
architecture via JSON when using the version command.
https://github.com/restic/restic/issues/4547
https://github.com/restic/restic/pull/4553

View file

@ -1,11 +0,0 @@
Enhancement: Add `--ncdu` option to `ls` command
NCDU (NCurses Disk Usage) is a tool to analyse disk usage of directories.
It has an option to save a directory tree and analyse it later.
The `ls` command now supports the `--ncdu` option which outputs information
about a snapshot in the NCDU format.
You can use it as follows: `restic ls latest --ncdu | ncdu -f -`
https://github.com/restic/restic/issues/4549
https://github.com/restic/restic/pull/4550

View file

@ -1,12 +0,0 @@
Enhancement: Ignore s3.storage-class for metadata if archive tier is specified
There is no official cold storage support in restic, use this option at your
own risk.
Restic always stored all files on s3 using the specified `s3.storage-class`.
Now, restic will store metadata using a non-archive storage tier to avoid
problems when accessing a repository. To restore any data, it is still
necessary to manually warm up the required data beforehand.
https://github.com/restic/restic/issues/4583
https://github.com/restic/restic/pull/4584

View file

@ -1,8 +0,0 @@
Enhancement: Move key add, list, remove and passwd as separate sub-commands
Restic now provides usage documentation for the `key` command. Each sub-command;
`add`, `list`, `remove` and `passwd` now have their own sub-command documentation
which can be invoked using `restic key <add|list|remove|passwd> --help`.
https://github.com/restic/restic/issues/4676
https://github.com/restic/restic/pull/4685

View file

@ -1,8 +0,0 @@
Enhancement: Add --target flag to the dump command
Restic `dump` always printed to the standard output. It now permits to select a
`--target` file to write the output to.
https://github.com/restic/restic/issues/4678
https://github.com/restic/restic/pull/4682
https://github.com/restic/restic/pull/4692

View file

@ -0,0 +1,7 @@
Enhancement: `restore --verify` shows progress with a progress bar
If restore command was run with `--verify` restic didn't show any progress indication, now it shows a progress bar while 'verification' is running.
The progress bar is text only for now and doesn't respect `--json` flag.
https://github.com/restic/restic/issues/4795
https://github.com/restic/restic/pull/4989

View file

@ -0,0 +1,8 @@
Enhancement: Clear removed snapshots from local cache of the current host
Restic only removed snapshots from the cache on the host that runs the `forget` command.
On other hosts that use the same repository, the old snapshots remained in the cache.
Restic now, automatically clears old snapshots from the local cache of the current host.
https://github.com/restic/restic/issues/4934
https://github.com/restic/restic/pull/4981

View file

@ -0,0 +1,8 @@
Enhancement: Print JSON-formatted errors during `restore --json`
Restic printed any restore errors directly to the console as freeform
text messages, even with `--json`. Restic now prints them as JSON formatted
messages when `--json` is passed.
https://github.com/restic/restic/issues/4944
https://github.com/restic/restic/pull/4946

View file

@ -0,0 +1,8 @@
Bugfix: Include missing backup error text with `--json`
Restic was not actually providing the text of an error message during
backup if `--json` was passed, instead only printing `"error": {}`.
Restic now includes the error text in JSON output.
https://github.com/restic/restic/issues/4945
https://github.com/restic/restic/pull/4946

View file

@ -0,0 +1,6 @@
Enhancement: Format exit errors as JSON with --json
Restic now prints any exit error messages as JSON when requested.
https://github.com/restic/restic/issues/4948
https://github.com/restic/restic/pull/4952

View file

@ -0,0 +1,7 @@
Bugfix: Correctly handle long paths on older Windows versions
When using older Windows versions, like Windows Server 2012, restic 0.17.0
failed to back up files with long paths. This has been fixed.
https://github.com/restic/restic/issues/4953
https://github.com/restic/restic/pull/4954

View file

@ -0,0 +1,10 @@
Bugfix: Fix delayed cancelation of some commands
Since restic 0.17.0, some commands no longer promptly reacted to being canceled
via Ctrl-C (SIGINT) and continued to run for a limited amount of time. The most
affected commands were `diff`,`find`, `ls`, `stats` and `rewrite`.
This has been fixed.
https://github.com/restic/restic/issues/4957
https://github.com/restic/restic/pull/4960

View file

@ -0,0 +1,7 @@
Bugfix: Correctly restore timestamp for files with resource forks on macOS
On macOS, timestamps were incorrectly restored for files with resource forks.
This has been fixed.
https://github.com/restic/restic/issues/4969
https://github.com/restic/restic/pull/5006

View file

@ -0,0 +1,13 @@
Enhancement: Make timeout for stuck requests customizable
Restic monitors connections to the backend to detect stuck requests. If a request
does not return any data within five minutes, restic assumes the request is stuck and
retries it. However, for large repositories it sometimes takes longer than that to
collect a list of all files, causing the following error:
`List(data) returned error, retrying after 1s: [...]: request timeout`
It is now possible to increase the timeout using the `--stuck-request-timeout` option.
https://github.com/restic/restic/issues/4970
https://github.com/restic/restic/pull/5014

View file

@ -0,0 +1,6 @@
Bugfix: Prevent `backup --stdin-from-command` from panicking
If --stdin-from-command is used, restic now checks whether there is a command behind it.
https://github.com/restic/restic/issues/4975
https://github.com/restic/restic/pull/4976

View file

@ -0,0 +1,12 @@
Bugfix: Fix spurious "A Required Privilege Is Not Held by the Client" error
On Windows, creating a backup could sometimes print the following error
```
error: nodeFromFileInfo [...]: get named security info failed with: a required privilege is not held by the client.
```
This has been fixed.
https://github.com/restic/restic/issues/5004
https://github.com/restic/restic/pull/5019

View file

@ -0,0 +1,13 @@
Bugfix: Fix rare failures to retry locking a repository
Restic 0.17.0 could in rare cases fail to retry locking a repository if
one of the lock files failed to load. The lock operation failed with error
`unable to create lock in backend: circuit breaker open for file <lock/1234567890>`
The error handling has been fixed to correctly retry locking the repository.
In addition, restic now waits a few seconds between locking retries to
increase chances of success.
https://github.com/restic/restic/issues/5005
https://github.com/restic/restic/pull/5011
https://github.com/restic/restic/pull/5012

View file

@ -1,7 +0,0 @@
Bugfix: Correct hardlink handling in `stats` command
If files on different devices had the same inode id, then the `stats` command
did not correctly calculate the snapshot size. This has been fixed.
https://github.com/restic/restic/pull/4503
https://forum.restic.net/t/possible-bug-in-stats/6461/8

View file

@ -1,11 +0,0 @@
Enhancement: Add bitrot detection to `diff` command
The output of the `diff` command now includes the modifier `?` for files
to indicate bitrot in backed up files. It will appear whenever there is a
difference in content while the metadata is exactly the same. Since files with
unchanged metadata are normally not read again when creating a backup, the
detection is only effective if the right-hand side of the diff has been created
with "backup --force".
https://github.com/restic/restic/issues/805
https://github.com/restic/restic/pull/4526

View file

@ -1,5 +0,0 @@
Enhancement: Add `--new-host` and `--new-time` options to `rewrite` command
`restic rewrite` now allows rewriting the host and / or time metadata of a snapshot.
https://github.com/restic/restic/pull/4573

View file

@ -1,7 +0,0 @@
Enhancement: `mount` tests mountpoint existence before opening the repository
The restic `mount` command now checks for the existence of the
mountpoint before opening the repository, leading to quicker error
detection.
https://github.com/restic/restic/pull/4590

View file

@ -1,7 +0,0 @@
Enhancement: Back up windows created time and file attributes like hidden flag
Restic did not back up windows-specific meta-data like created time and file attributes like hidden flag.
Restic now backs up file created time and file attributes like hidden, readonly and encrypted flag when backing up files and folders on windows.
https://github.com/restic/restic/pull/4611

View file

@ -1,10 +0,0 @@
Enhancement: Improve `repair packs` command
The `repair packs` command has been improved to also be able to process
truncated pack files. The `check --read-data` command will provide instructions
on using the command if necessary to repair a repository. See the guide at
https://restic.readthedocs.io/en/stable/077_troubleshooting.html for further
instructions.
https://github.com/restic/restic/pull/4644
https://github.com/restic/restic/pull/4655

View file

@ -1,8 +0,0 @@
Enhancement: `ls` uses `message_type` field to distinguish JSON messages
The `ls` command was the only command that used the `struct_type` field to determine
the message type in the JSON output format. Now, the JSON output of the
`ls` command also includes the `message_type`. The `struct_type` field is
still included, but it deprecated.
https://github.com/restic/restic/pull/4664

View file

@ -1,9 +0,0 @@
Bugfix: Shutdown cleanly when SIGTERM is received
Prior, if restic received SIGTERM it'd just immediately terminate skipping
cleanup- resulting in potential issues like stale locks being left behind.
This primarily effected containerized restic invocations- they use SIGTERM-
but this could be triggered via a simple `killall restic` in addition.
https://github.com/restic/restic/pull/4703

View file

@ -0,0 +1,7 @@
Change: Update dependencies and require Go 1.21 or newer
We have updated all dependencies. Since some libraries require newer Go standard
library features, support for Go 1.19 and 1.20 has been dropped, which means that
restic now requires at least Go 1.21 to build.
https://github.com/restic/restic/pull/4938

View file

@ -0,0 +1,7 @@
Bugfix: Don't ignore metadata-setting errors during restore
Restic was accidentally ignoring errors when setting timestamps,
attributes, or file modes during restore. It will now report those
errors (unless it's just a permission error when not running as root).
https://github.com/restic/restic/pull/4958

View file

@ -0,0 +1,6 @@
Enhancement: Return exit code 12 for "bad password"
Restic now returns exit code 12 when it can't open the repository
because of a bad password.
https://github.com/restic/restic/pull/4959

View file

@ -0,0 +1,15 @@
Change: let `backup` store files with incomplete metadata
If restic failed to read the extended metadata for a file or folder while
creating a backup, then the file or folder was not included in the resulting
snapshot. Instead, only a warning message was printed along with exiting
with exit code 3.
Now, restic also includes items for which the extended metadata could not
be read in a snapshot. The warning message has been changed to read
```
incomplete metadata for /path/to/file: details on error
```
https://github.com/restic/restic/issues/4953
https://github.com/restic/restic/pull/4977

View file

@ -0,0 +1,13 @@
Bugfix: Skip EA processing in Windows for volumes that do not support EA
Restic was failing to backup files on some windows paths like network
drives because of errors while fetching extended attributes.
Either they return error codes like windows.E_NOT_SET or
windows.ERROR_INVALID_FUNCTION or it results in slower backups.
Restic now completely skips the attempt to fetch extended attributes
for such volumes where it is not supported.
https://github.com/restic/restic/pull/4980
https://github.com/restic/restic/pull/4998
https://github.com/restic/restic/issues/4955
https://github.com/restic/restic/issues/4950

View file

@ -0,0 +1,13 @@
Bugfix: Improve HTTP2 support for rest backend
If rest-server tried to gracefully shut down an HTTP2 connection still used by the client,
this could result in the following error.
```
http2: Transport: cannot retry err [http2: Transport received Server's graceful shutdown GOAWAY] after Request.Body was written; define Request.GetBody to avoid this error
```
This has been fixed.
https://github.com/restic/restic/pull/5018
https://forum.restic.net/t/receiving-http2-goaway-messages-with-windows-restic-v0-17-0/8367

View file

@ -1,89 +1,41 @@
package main
import (
"context"
"os"
"os/signal"
"sync"
"syscall"
"github.com/restic/restic/internal/debug"
)
var cleanupHandlers struct {
sync.Mutex
list []func(code int) (int, error)
done bool
ch chan os.Signal
func createGlobalContext() context.Context {
ctx, cancel := context.WithCancel(context.Background())
ch := make(chan os.Signal, 1)
go cleanupHandler(ch, cancel)
signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM)
return ctx
}
func init() {
cleanupHandlers.ch = make(chan os.Signal, 1)
go CleanupHandler(cleanupHandlers.ch)
signal.Notify(cleanupHandlers.ch, syscall.SIGINT, syscall.SIGTERM)
}
// cleanupHandler handles the SIGINT and SIGTERM signals.
func cleanupHandler(c <-chan os.Signal, cancel context.CancelFunc) {
s := <-c
debug.Log("signal %v received, cleaning up", s)
Warnf("%ssignal %v received, cleaning up\n", clearLine(0), s)
// AddCleanupHandler adds the function f to the list of cleanup handlers so
// that it is executed when all the cleanup handlers are run, e.g. when SIGINT
// is received.
func AddCleanupHandler(f func(code int) (int, error)) {
cleanupHandlers.Lock()
defer cleanupHandlers.Unlock()
// reset the done flag for integration tests
cleanupHandlers.done = false
cleanupHandlers.list = append(cleanupHandlers.list, f)
}
// RunCleanupHandlers runs all registered cleanup handlers
func RunCleanupHandlers(code int) int {
cleanupHandlers.Lock()
defer cleanupHandlers.Unlock()
if cleanupHandlers.done {
return code
if val, _ := os.LookupEnv("RESTIC_DEBUG_STACKTRACE_SIGINT"); val != "" {
_, _ = os.Stderr.WriteString("\n--- STACKTRACE START ---\n\n")
_, _ = os.Stderr.WriteString(debug.DumpStacktrace())
_, _ = os.Stderr.WriteString("\n--- STACKTRACE END ---\n")
}
cleanupHandlers.done = true
for _, f := range cleanupHandlers.list {
var err error
code, err = f(code)
if err != nil {
Warnf("error in cleanup handler: %v\n", err)
}
}
cleanupHandlers.list = nil
return code
cancel()
}
// CleanupHandler handles the SIGINT and SIGTERM signals.
func CleanupHandler(c <-chan os.Signal) {
for s := range c {
debug.Log("signal %v received, cleaning up", s)
Warnf("%ssignal %v received, cleaning up\n", clearLine(0), s)
if val, _ := os.LookupEnv("RESTIC_DEBUG_STACKTRACE_SIGINT"); val != "" {
_, _ = os.Stderr.WriteString("\n--- STACKTRACE START ---\n\n")
_, _ = os.Stderr.WriteString(debug.DumpStacktrace())
_, _ = os.Stderr.WriteString("\n--- STACKTRACE END ---\n")
}
code := 0
if s == syscall.SIGINT || s == syscall.SIGTERM {
code = 130
} else {
code = 1
}
Exit(code)
}
}
// Exit runs the cleanup handlers and then terminates the process with the
// given exit code.
// Exit terminates the process with the given exit code.
func Exit(code int) {
code = RunCleanupHandlers(code)
debug.Log("exiting with status code %d", code)
os.Exit(code)
}

View file

@ -20,10 +20,12 @@ import (
"github.com/restic/restic/internal/archiver"
"github.com/restic/restic/internal/debug"
"github.com/restic/restic/internal/errors"
"github.com/restic/restic/internal/filter"
"github.com/restic/restic/internal/fs"
"github.com/restic/restic/internal/repository"
"github.com/restic/restic/internal/restic"
"github.com/restic/restic/internal/textfile"
"github.com/restic/restic/internal/ui"
"github.com/restic/restic/internal/ui/backup"
"github.com/restic/restic/internal/ui/termstatus"
)
@ -41,6 +43,9 @@ 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).
Exit status is 10 if the repository does not exist.
Exit status is 11 if the repository is already locked.
Exit status is 12 if the password is incorrect.
`,
PreRun: func(_ *cobra.Command, _ []string) {
if backupOptions.Host == "" {
@ -52,6 +57,7 @@ Exit status is 3 if some source data could not be read (incomplete snapshot crea
backupOptions.Host = hostname
}
},
GroupID: cmdGroupDefault,
DisableAutoGenTag: true,
RunE: func(cmd *cobra.Command, args []string) error {
term, cancel := setupTermstatus()
@ -62,7 +68,7 @@ Exit status is 3 if some source data could not be read (incomplete snapshot crea
// BackupOptions bundles all options for the backup command.
type BackupOptions struct {
excludePatternOptions
filter.ExcludePatternOptions
Parent string
GroupBy restic.SnapshotGroupByOptions
@ -87,6 +93,7 @@ type BackupOptions struct {
DryRun bool
ReadConcurrency uint
NoScan bool
SkipIfUnchanged bool
}
var backupOptions BackupOptions
@ -101,9 +108,9 @@ func init() {
f.StringVar(&backupOptions.Parent, "parent", "", "use this parent `snapshot` (default: latest snapshot in the group determined by --group-by and not newer than the timestamp determined by --time)")
backupOptions.GroupBy = restic.SnapshotGroupByOptions{Host: true, Path: true}
f.VarP(&backupOptions.GroupBy, "group-by", "g", "`group` snapshots by host, paths and/or tags, separated by comma (disable grouping with '')")
f.BoolVarP(&backupOptions.Force, "force", "f", false, `force re-reading the target files/directories (overrides the "parent" flag)`)
f.BoolVarP(&backupOptions.Force, "force", "f", false, `force re-reading the source files/directories (overrides the "parent" flag)`)
initExcludePatternOptions(f, &backupOptions.excludePatternOptions)
backupOptions.ExcludePatternOptions.Add(f)
f.BoolVarP(&backupOptions.ExcludeOtherFS, "one-file-system", "x", false, "exclude other file systems, don't cross filesystem boundaries and subvolumes")
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)")
@ -114,7 +121,7 @@ func init() {
f.BoolVar(&backupOptions.StdinCommand, "stdin-from-command", false, "interpret arguments as command to execute and store its stdout")
f.Var(&backupOptions.Tags, "tag", "add `tags` for the new snapshot in the format `tag[,tag,...]` (can be specified multiple times)")
f.UintVar(&backupOptions.ReadConcurrency, "read-concurrency", 0, "read `n` files concurrently (default: $RESTIC_READ_CONCURRENCY or 2)")
f.StringVarP(&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 (default: $RESTIC_HOST). To prevent an expensive rescan use the \"parent\" flag")
f.StringVar(&backupOptions.Host, "hostname", "", "set the `hostname` for the snapshot manually")
err := f.MarkDeprecated("hostname", "use --host")
if err != nil {
@ -133,10 +140,16 @@ func init() {
if runtime.GOOS == "windows" {
f.BoolVar(&backupOptions.UseFsSnapshot, "use-fs-snapshot", false, "use filesystem snapshot where possible (currently only Windows VSS)")
}
f.BoolVar(&backupOptions.SkipIfUnchanged, "skip-if-unchanged", false, "skip snapshot creation if identical to parent snapshot")
// parse read concurrency from env, on error the default value will be used
readConcurrency, _ := strconv.ParseUint(os.Getenv("RESTIC_READ_CONCURRENCY"), 10, 32)
backupOptions.ReadConcurrency = uint(readConcurrency)
// parse host from env, if not exists or empty the default value will be used
if host := os.Getenv("RESTIC_HOST"); host != "" {
backupOptions.Host = host
}
}
// filterExisting returns a slice of all existing items, or an error if no
@ -153,7 +166,7 @@ func filterExisting(items []string) (result []string, err error) {
}
if len(result) == 0 {
return nil, errors.Fatal("all target directories/files do not exist")
return nil, errors.Fatal("all source directories/files do not exist")
}
return
@ -252,7 +265,7 @@ func readFilenamesRaw(r io.Reader) (names []string, err error) {
// Check returns an error when an invalid combination of options was set.
func (opts BackupOptions) Check(gopts GlobalOptions, args []string) error {
if gopts.password == "" {
if gopts.password == "" && !gopts.InsecureNoPassword {
if opts.Stdin {
return errors.Fatal("cannot read both password and data from stdin")
}
@ -286,7 +299,7 @@ func (opts BackupOptions) Check(gopts GlobalOptions, args []string) error {
// collectRejectByNameFuncs returns a list of all functions which may reject data
// from being saved in a snapshot based on path only
func collectRejectByNameFuncs(opts BackupOptions, repo *repository.Repository) (fs []RejectByNameFunc, err error) {
func collectRejectByNameFuncs(opts BackupOptions, repo *repository.Repository) (fs []archiver.RejectByNameFunc, err error) {
// exclude restic cache
if repo.Cache != nil {
f, err := rejectResticCache(repo)
@ -297,23 +310,12 @@ func collectRejectByNameFuncs(opts BackupOptions, repo *repository.Repository) (
fs = append(fs, f)
}
fsPatterns, err := opts.excludePatternOptions.CollectPatterns()
fsPatterns, err := opts.ExcludePatternOptions.CollectPatterns(Warnf)
if err != nil {
return nil, err
}
fs = append(fs, fsPatterns...)
if opts.ExcludeCaches {
opts.ExcludeIfPresent = append(opts.ExcludeIfPresent, "CACHEDIR.TAG:Signature: 8a477f597d28d172789f06886806bc55")
}
for _, spec := range opts.ExcludeIfPresent {
f, err := rejectIfPresent(spec)
if err != nil {
return nil, err
}
fs = append(fs, f)
for _, pat := range fsPatterns {
fs = append(fs, archiver.RejectByNameFunc(pat))
}
return fs, nil
@ -321,25 +323,43 @@ func collectRejectByNameFuncs(opts BackupOptions, repo *repository.Repository) (
// collectRejectFuncs returns a list of all functions which may reject data
// from being saved in a snapshot based on path and file info
func collectRejectFuncs(opts BackupOptions, targets []string) (fs []RejectFunc, err error) {
func collectRejectFuncs(opts BackupOptions, targets []string, fs fs.FS) (funcs []archiver.RejectFunc, err error) {
// allowed devices
if opts.ExcludeOtherFS && !opts.Stdin {
f, err := rejectByDevice(targets)
if opts.ExcludeOtherFS && !opts.Stdin && !opts.StdinCommand {
f, err := archiver.RejectByDevice(targets, fs)
if err != nil {
return nil, err
}
fs = append(fs, f)
funcs = append(funcs, f)
}
if len(opts.ExcludeLargerThan) != 0 && !opts.Stdin {
f, err := rejectBySize(opts.ExcludeLargerThan)
if len(opts.ExcludeLargerThan) != 0 && !opts.Stdin && !opts.StdinCommand {
maxSize, err := ui.ParseBytes(opts.ExcludeLargerThan)
if err != nil {
return nil, err
}
fs = append(fs, f)
f, err := archiver.RejectBySize(maxSize)
if err != nil {
return nil, err
}
funcs = append(funcs, f)
}
return fs, nil
if opts.ExcludeCaches {
opts.ExcludeIfPresent = append(opts.ExcludeIfPresent, "CACHEDIR.TAG:Signature: 8a477f597d28d172789f06886806bc55")
}
for _, spec := range opts.ExcludeIfPresent {
f, err := archiver.RejectIfPresent(spec, Warnf)
if err != nil {
return nil, err
}
funcs = append(funcs, f)
}
return funcs, nil
}
// collectTargets returns a list of target files/dirs from several sources.
@ -398,7 +418,7 @@ func collectTargets(opts BackupOptions, args []string) (targets []string, err er
// and have the ability to use both files-from and args at the same time.
targets = append(targets, args...)
if len(targets) == 0 && !opts.Stdin {
return nil, errors.Fatal("nothing to backup, please specify target files/dirs")
return nil, errors.Fatal("nothing to backup, please specify source files/dirs")
}
targets, err = filterExisting(targets)
@ -440,7 +460,16 @@ func findParentSnapshot(ctx context.Context, repo restic.ListerLoaderUnpacked, o
}
func runBackup(ctx context.Context, opts BackupOptions, gopts GlobalOptions, term *termstatus.Terminal, args []string) error {
err := opts.Check(gopts, args)
var vsscfg fs.VSSConfig
var err error
if runtime.GOOS == "windows" {
if vsscfg, err = fs.ParseVSSConfig(gopts.extended); err != nil {
return err
}
}
err = opts.Check(gopts, args)
if err != nil {
return err
}
@ -451,6 +480,7 @@ func runBackup(ctx context.Context, opts BackupOptions, gopts GlobalOptions, ter
}
timeStamp := time.Now()
backupStart := timeStamp
if opts.TimeStamp != "" {
timeStamp, err = time.ParseInLocation(TimeFormat, opts.TimeStamp, time.Local)
if err != nil {
@ -462,10 +492,11 @@ func runBackup(ctx context.Context, opts BackupOptions, gopts GlobalOptions, ter
Verbosef("open repository\n")
}
repo, err := OpenRepository(ctx, gopts)
ctx, repo, unlock, err := openWithAppendLock(ctx, gopts, opts.DryRun)
if err != nil {
return err
}
defer unlock()
var progressPrinter backup.ProgressPrinter
if gopts.JSON {
@ -477,34 +508,12 @@ func runBackup(ctx context.Context, opts BackupOptions, gopts GlobalOptions, ter
calculateProgressInterval(!gopts.Quiet, gopts.JSON))
defer progressReporter.Done()
if opts.DryRun {
repo.SetDryRun()
}
if !gopts.JSON {
progressPrinter.V("lock repository")
}
if !opts.DryRun {
var lock *restic.Lock
lock, ctx, err = lockRepo(ctx, repo, gopts.RetryLock, gopts.JSON)
defer unlockRepo(lock)
if err != nil {
return err
}
}
// rejectByNameFuncs collect functions that can reject items from the backup based on path only
rejectByNameFuncs, err := collectRejectByNameFuncs(opts, repo)
if err != nil {
return err
}
// rejectFuncs collect functions that can reject items from the backup based on path and file info
rejectFuncs, err := collectRejectFuncs(opts, targets)
if err != nil {
return err
}
var parentSnapshot *restic.Snapshot
if !opts.Stdin {
parentSnapshot, err = findParentSnapshot(ctx, repo, opts, targets, timeStamp)
@ -526,38 +535,19 @@ func runBackup(ctx context.Context, opts BackupOptions, gopts GlobalOptions, ter
}
bar := newIndexTerminalProgress(gopts.Quiet, gopts.JSON, term)
err = repo.LoadIndex(ctx, bar)
if err != nil {
return err
}
selectByNameFilter := func(item string) bool {
for _, reject := range rejectByNameFuncs {
if reject(item) {
return false
}
}
return true
}
selectFilter := func(item string, fi os.FileInfo) bool {
for _, reject := range rejectFuncs {
if reject(item, fi) {
return false
}
}
return true
}
var targetFS fs.FS = fs.Local{}
if runtime.GOOS == "windows" && opts.UseFsSnapshot {
if err = fs.HasSufficientPrivilegesForVSS(); err != nil {
return err
}
errorHandler := func(item string, err error) error {
return progressReporter.Error(item, err)
errorHandler := func(item string, err error) {
_ = progressReporter.Error(item, err)
}
messageHandler := func(msg string, args ...interface{}) {
@ -566,7 +556,7 @@ func runBackup(ctx context.Context, opts BackupOptions, gopts GlobalOptions, ter
}
}
localVss := fs.NewLocalVss(errorHandler, messageHandler)
localVss := fs.NewLocalVss(errorHandler, messageHandler, vsscfg)
defer localVss.DeleteSnapshots()
targetFS = localVss
}
@ -592,6 +582,15 @@ func runBackup(ctx context.Context, opts BackupOptions, gopts GlobalOptions, ter
targets = []string{filename}
}
// rejectFuncs collect functions that can reject items from the backup based on path and file info
rejectFuncs, err := collectRejectFuncs(opts, targets, targetFS)
if err != nil {
return err
}
selectByNameFilter := archiver.CombineRejectByNames(rejectByNameFuncs)
selectFilter := archiver.CombineRejects(rejectFuncs)
wg, wgCtx := errgroup.WithContext(ctx)
cancelCtx, cancel := context.WithCancel(wgCtx)
defer cancel()
@ -638,18 +637,20 @@ func runBackup(ctx context.Context, opts BackupOptions, gopts GlobalOptions, ter
}
snapshotOpts := archiver.SnapshotOptions{
Excludes: opts.Excludes,
Tags: opts.Tags.Flatten(),
Time: timeStamp,
Hostname: opts.Host,
ParentSnapshot: parentSnapshot,
ProgramVersion: "restic " + version,
Excludes: opts.Excludes,
Tags: opts.Tags.Flatten(),
BackupStart: backupStart,
Time: timeStamp,
Hostname: opts.Host,
ParentSnapshot: parentSnapshot,
ProgramVersion: "restic " + version,
SkipIfUnchanged: opts.SkipIfUnchanged,
}
if !gopts.JSON {
progressPrinter.V("start backup on %v", targets)
}
_, id, err := arch.Snapshot(ctx, targets, snapshotOpts)
_, id, summary, err := arch.Snapshot(ctx, targets, snapshotOpts)
// cleanly shutdown all running goroutines
cancel()
@ -663,10 +664,7 @@ func runBackup(ctx context.Context, opts BackupOptions, gopts GlobalOptions, ter
}
// Report finished execution
progressReporter.Finish(id, opts.DryRun)
if !gopts.JSON && !opts.DryRun {
progressPrinter.P("snapshot %s saved\n", id.Str())
}
progressReporter.Finish(id, summary, opts.DryRun)
if !success {
return ErrInvalidSourceData
}

View file

@ -9,7 +9,6 @@ import (
"runtime"
"testing"
"github.com/restic/restic/internal/backend"
"github.com/restic/restic/internal/fs"
"github.com/restic/restic/internal/restic"
rtest "github.com/restic/restic/internal/test"
@ -250,29 +249,18 @@ func TestBackupTreeLoadError(t *testing.T) {
opts := BackupOptions{}
// Backup a subdirectory first, such that we can remove the tree pack for the subdirectory
testRunBackup(t, env.testdata, []string{"test"}, opts, env.gopts)
r, err := OpenRepository(context.TODO(), env.gopts)
rtest.OK(t, err)
rtest.OK(t, r.LoadIndex(context.TODO(), nil))
treePacks := restic.NewIDSet()
r.Index().Each(context.TODO(), func(pb restic.PackedBlob) {
if pb.Type == restic.TreeBlob {
treePacks.Insert(pb.PackID)
}
})
treePacks := listTreePacks(env.gopts, t)
testRunBackup(t, filepath.Dir(env.testdata), []string{filepath.Base(env.testdata)}, opts, env.gopts)
testRunCheck(t, env.gopts)
// delete the subdirectory pack first
for id := range treePacks {
rtest.OK(t, r.Backend().Remove(context.TODO(), backend.Handle{Type: restic.PackFile, Name: id.String()}))
}
removePacks(env.gopts, t, treePacks)
testRunRebuildIndex(t, env.gopts)
// now the repo is missing the tree blob in the index; check should report this
testRunCheckMustFail(t, env.gopts)
// second backup should report an error but "heal" this situation
err = testRunBackupAssumeFailure(t, filepath.Dir(env.testdata), []string{filepath.Base(env.testdata)}, opts, env.gopts)
err := testRunBackupAssumeFailure(t, filepath.Dir(env.testdata), []string{filepath.Base(env.testdata)}, opts, env.gopts)
rtest.Assert(t, err != nil, "backup should have reported an error for the subdirectory")
testRunCheck(t, env.gopts)
@ -406,6 +394,7 @@ func TestIncrementalBackup(t *testing.T) {
t.Logf("repository grown by %d bytes", stat3.size-stat2.size)
}
// nolint: staticcheck // false positive nil pointer dereference check
func TestBackupTags(t *testing.T) {
env, cleanup := withTestEnvironment(t)
defer cleanup()
@ -441,6 +430,7 @@ func TestBackupTags(t *testing.T) {
"expected parent to be %v, got %v", parent.ID, newest.Parent)
}
// nolint: staticcheck // false positive nil pointer dereference check
func TestBackupProgramVersion(t *testing.T) {
env, cleanup := withTestEnvironment(t)
defer cleanup()
@ -637,3 +627,32 @@ func TestStdinFromCommandFailNoOutputAndExitCode(t *testing.T) {
testRunCheck(t, env.gopts)
}
func TestBackupEmptyPassword(t *testing.T) {
// basic sanity test that empty passwords work
env, cleanup := withTestEnvironment(t)
defer cleanup()
env.gopts.password = ""
env.gopts.InsecureNoPassword = true
testSetupBackupData(t, env)
testRunBackup(t, filepath.Dir(env.testdata), []string{"testdata"}, BackupOptions{}, env.gopts)
testListSnapshots(t, env.gopts, 1)
testRunCheck(t, env.gopts)
}
func TestBackupSkipIfUnchanged(t *testing.T) {
env, cleanup := withTestEnvironment(t)
defer cleanup()
testSetupBackupData(t, env)
opts := BackupOptions{SkipIfUnchanged: true}
for i := 0; i < 3; i++ {
testRunBackup(t, filepath.Dir(env.testdata), []string{"testdata"}, opts, env.gopts)
testListSnapshots(t, env.gopts, 1)
}
testRunCheck(t, env.gopts)
}

View file

@ -8,9 +8,8 @@ import (
"strings"
"time"
"github.com/restic/restic/internal/cache"
"github.com/restic/restic/internal/backend/cache"
"github.com/restic/restic/internal/errors"
"github.com/restic/restic/internal/fs"
"github.com/restic/restic/internal/ui"
"github.com/restic/restic/internal/ui/table"
"github.com/spf13/cobra"
@ -25,8 +24,10 @@ 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.
Exit status is 0 if the command was successful.
Exit status is 1 if there was any error.
`,
GroupID: cmdGroupDefault,
DisableAutoGenTag: true,
RunE: func(_ *cobra.Command, args []string) error {
return runCache(cacheOptions, globalOptions, args)
@ -87,7 +88,7 @@ func runCache(opts CacheOptions, gopts GlobalOptions, args []string) error {
for _, item := range oldDirs {
dir := filepath.Join(cachedir, item.Name())
err = fs.RemoveAll(dir)
err = os.RemoveAll(dir)
if err != nil {
Warnf("unable to remove %v: %v\n", dir, err)
}

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