From 8eb83029a8ae9c696ee6bd1c2546205956602119 Mon Sep 17 00:00:00 2001 From: Kyle Brennan Date: Fri, 3 Dec 2021 09:50:28 -0800 Subject: [PATCH 1/3] Make copy honor --no-lock --- cmd/restic/cmd_copy.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cmd/restic/cmd_copy.go b/cmd/restic/cmd_copy.go index d16cd1742..030abc37d 100644 --- a/cmd/restic/cmd_copy.go +++ b/cmd/restic/cmd_copy.go @@ -73,10 +73,12 @@ func runCopy(opts CopyOptions, gopts GlobalOptions, args []string) error { return err } - srcLock, err := lockRepo(ctx, srcRepo) - defer unlockRepo(srcLock) - if err != nil { - return err + if !gopts.NoLock { + srcLock, err := lockRepo(ctx, srcRepo) + defer unlockRepo(srcLock) + if err != nil { + return err + } } dstLock, err := lockRepo(ctx, dstRepo) From d5ed5da85ca556c06029d06811dd44583bb8f50e Mon Sep 17 00:00:00 2001 From: Kyle Brennan Date: Fri, 3 Dec 2021 09:50:47 -0800 Subject: [PATCH 2/3] update changelog for copy --no-lock --- changelog/unreleased/issue-3518 | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 changelog/unreleased/issue-3518 diff --git a/changelog/unreleased/issue-3518 b/changelog/unreleased/issue-3518 new file mode 100644 index 000000000..f0d200b85 --- /dev/null +++ b/changelog/unreleased/issue-3518 @@ -0,0 +1,6 @@ +Bugfix: Make copy honor `--no-lock` for source repository + +When passing the `--no-lock` flag to the copy command, the source directory still attempted to issue a lock, causing failures on read-only source directories. `--no-lock` is now respected and copy no longer attempts a lock. + +https://github.com/restic/restic/issues/3518 +https://github.com/restic/restic/pull/3589 From 64e733f3d6e42ec795e799a702dbdf834b4c1fca Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Mon, 27 Dec 2021 18:22:25 +0100 Subject: [PATCH 3/3] tweak copy --no-lock changelog --- changelog/unreleased/issue-3518 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/changelog/unreleased/issue-3518 b/changelog/unreleased/issue-3518 index f0d200b85..5a8edc4ea 100644 --- a/changelog/unreleased/issue-3518 +++ b/changelog/unreleased/issue-3518 @@ -1,6 +1,9 @@ -Bugfix: Make copy honor `--no-lock` for source repository +Bugfix: Make copy command honor `--no-lock` for source repository -When passing the `--no-lock` flag to the copy command, the source directory still attempted to issue a lock, causing failures on read-only source directories. `--no-lock` is now respected and copy no longer attempts a lock. +When passing the `--no-lock` flag to the copy command, restic still attempted +to lock the source repository, causing failures on read-only storage backends. +`--no-lock` is now respected and copy then no longer creates a lock in the +source repository. https://github.com/restic/restic/issues/3518 https://github.com/restic/restic/pull/3589