Merge pull request #4356 from MichaelEischer/fix-unlock-hint

lock: fix missing hint to unlock command if repository is locked
This commit is contained in:
Michael Eischer 2023-06-06 21:03:06 +02:00 committed by GitHub
commit 49a6a4f5bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -2,6 +2,7 @@ package main
import ( import (
"context" "context"
"fmt"
"sync" "sync"
"time" "time"
@ -97,7 +98,7 @@ retryLoop:
return nil, ctx, errors.Fatalf("%v\n\nthe `unlock --remove-all` command can be used to remove invalid locks. Make sure that no other restic process is accessing the repository when running the command", err) return nil, ctx, errors.Fatalf("%v\n\nthe `unlock --remove-all` command can be used to remove invalid locks. Make sure that no other restic process is accessing the repository when running the command", err)
} }
if err != nil { if err != nil {
return nil, ctx, errors.Fatalf("unable to create lock in backend: %v", err) return nil, ctx, fmt.Errorf("unable to create lock in backend: %w", err)
} }
debug.Log("create lock %p (exclusive %v)", lock, exclusive) debug.Log("create lock %p (exclusive %v)", lock, exclusive)

View File

@ -90,6 +90,7 @@ func TestLockConflict(t *testing.T) {
if err == nil { if err == nil {
t.Fatal("second lock should have failed") t.Fatal("second lock should have failed")
} }
test.Assert(t, restic.IsAlreadyLocked(err), "unexpected error %v", err)
} }
type writeOnceBackend struct { type writeOnceBackend struct {