From 7af69fd7b9b05f792eb4c8d020e1b82bf226a26d Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Sat, 5 Mar 2022 10:29:13 +0100 Subject: [PATCH 1/2] list: Never lock the repository when listing lock files There's no point in locking the repository just to list the currently existing lock files. This won't work for an exclusively locked repository and is also confusing to users. --- changelog/unreleased/issue-1106 | 10 ++++++++++ cmd/restic/cmd_list.go | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 changelog/unreleased/issue-1106 diff --git a/changelog/unreleased/issue-1106 b/changelog/unreleased/issue-1106 new file mode 100644 index 000000000..1df3e1981 --- /dev/null +++ b/changelog/unreleased/issue-1106 @@ -0,0 +1,10 @@ +Bugfix: Never lock repository for `list locks` + +The `list locks` command previously locked to the repository by default. This +has the problem that it won't work for an exclusively locked repository and +that the command will also display its own lock file which can be confusing. + +Now, the `list locks` command cnever locks the repository. + +https://github.com/restic/restic/issues/1106 +https://github.com/restic/restic/pull/3665 diff --git a/cmd/restic/cmd_list.go b/cmd/restic/cmd_list.go index af711da3d..811b17e41 100644 --- a/cmd/restic/cmd_list.go +++ b/cmd/restic/cmd_list.go @@ -39,7 +39,7 @@ func runList(cmd *cobra.Command, opts GlobalOptions, args []string) error { return err } - if !opts.NoLock { + if !opts.NoLock && args[0] != "locks" { lock, err := lockRepo(opts.ctx, repo) defer unlockRepo(lock) if err != nil { From 32e61f262026b86734a7b3ea6629f2ce58d292ad Mon Sep 17 00:00:00 2001 From: Alexander Neumann <123276+fd0@users.noreply.github.com> Date: Mon, 21 Mar 2022 11:04:04 +0100 Subject: [PATCH 2/2] Update changelog/unreleased/issue-1106 Co-authored-by: greatroar <61184462+greatroar@users.noreply.github.com> --- changelog/unreleased/issue-1106 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog/unreleased/issue-1106 b/changelog/unreleased/issue-1106 index 1df3e1981..e24baa549 100644 --- a/changelog/unreleased/issue-1106 +++ b/changelog/unreleased/issue-1106 @@ -4,7 +4,7 @@ The `list locks` command previously locked to the repository by default. This has the problem that it won't work for an exclusively locked repository and that the command will also display its own lock file which can be confusing. -Now, the `list locks` command cnever locks the repository. +Now, the `list locks` command never locks the repository. https://github.com/restic/restic/issues/1106 https://github.com/restic/restic/pull/3665