From 9da3b87b07706956e8dc5fd5cb259b99ec940f51 Mon Sep 17 00:00:00 2001 From: Winfried Plappert <18740761+wplapper@users.noreply.github.com> Date: Sun, 11 Oct 2026 21:15:25 +0100 Subject: [PATCH] forget - missing lock for 'failedSnIDs' (#22100) --- cmd/restic/cmd_forget.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/restic/cmd_forget.go b/cmd/restic/cmd_forget.go index c00ff1dd5..d2ddd5386 100644 --- a/cmd/restic/cmd_forget.go +++ b/cmd/restic/cmd_forget.go @@ -6,6 +6,7 @@ import ( "fmt" "io" "strconv" + "sync" "github.com/restic/restic/internal/data" "github.com/restic/restic/internal/errors" @@ -317,10 +318,13 @@ func runForget(ctx context.Context, opts ForgetOptions, pruneOptions PruneOption if len(removeSnIDs) > 0 { if !opts.DryRun { bar := printer.NewCounter("files deleted") + var lock sync.Mutex err := restic.ParallelRemove(ctx, repo, removeSnIDs, restic.WriteableSnapshotFile, func(id restic.ID, err error) error { if err != nil { printer.E("unable to remove %v/%v from the repository\n", restic.SnapshotFile, id) + lock.Lock() failedSnIDs.Insert(id) + lock.Unlock() } else { printer.VV("removed %v/%v\n", restic.SnapshotFile, id) }