From 80db02fc3521612c7dc7ce86a9e57f17e20ee9df Mon Sep 17 00:00:00 2001 From: lou Date: Thu, 8 Feb 2024 14:11:57 +0800 Subject: [PATCH 1/2] dump flag --target should be allowed to write existing file Signed-off-by: lou --- cmd/restic/cmd_dump.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/restic/cmd_dump.go b/cmd/restic/cmd_dump.go index 1628d6a95..9178f2abe 100644 --- a/cmd/restic/cmd_dump.go +++ b/cmd/restic/cmd_dump.go @@ -174,7 +174,7 @@ func runDump(ctx context.Context, opts DumpOptions, gopts GlobalOptions, args [] canWriteArchiveFunc := checkStdoutArchive if opts.Target != "" { - file, err := os.OpenFile(opts.Target, os.O_RDWR|os.O_CREATE|os.O_EXCL, 0o666) + file, err := os.Create(opts.Target) if err != nil { return fmt.Errorf("cannot dump to file: %w", err) } From 15d6fa1f8374449346eb86cb4919bf8629671c84 Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Sat, 10 Feb 2024 18:38:36 +0100 Subject: [PATCH 2/2] dump: update docs for --target option --- changelog/unreleased/issue-4678 | 1 + doc/050_restore.rst | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/changelog/unreleased/issue-4678 b/changelog/unreleased/issue-4678 index f98711ea4..9f9a213e1 100644 --- a/changelog/unreleased/issue-4678 +++ b/changelog/unreleased/issue-4678 @@ -5,3 +5,4 @@ Restic `dump` always printed to the standard output. It now permits to select a https://github.com/restic/restic/issues/4678 https://github.com/restic/restic/pull/4682 +https://github.com/restic/restic/pull/4692 diff --git a/doc/050_restore.rst b/doc/050_restore.rst index 3cd05500b..916b11c86 100644 --- a/doc/050_restore.rst +++ b/doc/050_restore.rst @@ -176,8 +176,7 @@ To include the folder content at the root of the archive, you can use the `` restore.tar It is also possible to ``dump`` the contents of a selected snapshot and folder -structure to a file using the ``--target`` flag. The ``dump`` command will fail -if the already file exists. +structure to a file using the ``--target`` flag. .. code-block:: console $ restic -r /srv/restic-repo dump latest / --target /home/linux.user/output.tar -a tar \ No newline at end of file