From d7e644272f4787fb3a16e0057824637896f35689 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Tue, 19 Sep 2017 10:50:07 +0200 Subject: [PATCH] prune: Add plausibility check --- cmd/restic/cmd_prune.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/restic/cmd_prune.go b/cmd/restic/cmd_prune.go index c50b3413e..8e3c5b53d 100644 --- a/cmd/restic/cmd_prune.go +++ b/cmd/restic/cmd_prune.go @@ -179,6 +179,12 @@ func pruneRepository(gopts GlobalOptions, repo restic.Repository) error { } bar.Done() + if len(usedBlobs) > stats.blobs { + return errors.Fatalf("number of used blobs is larger than number of available blobs!\n" + + "Please report this error (along with the output of the 'prune' run) at\n" + + "https://github.com/restic/restic/issues/new") + } + Verbosef("found %d of %d data blobs still in use, removing %d blobs\n", len(usedBlobs), stats.blobs, stats.blobs-len(usedBlobs))