From 77ef92b95ca5f9f10850dd72c567a44ff55d2b1e Mon Sep 17 00:00:00 2001 From: "Leo R. Lundgren" Date: Fri, 22 Nov 2019 17:00:23 +0100 Subject: [PATCH] diff: Fix wrong bytes reported in diff stats (#2469) --- changelog/unreleased/issue-2469 | 5 +++++ cmd/restic/cmd_diff.go | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 changelog/unreleased/issue-2469 diff --git a/changelog/unreleased/issue-2469 b/changelog/unreleased/issue-2469 new file mode 100644 index 000000000..5cad5cd4d --- /dev/null +++ b/changelog/unreleased/issue-2469 @@ -0,0 +1,5 @@ +Bugfix: Fix incorrect bytes stats in `diff` command + +In some cases, the wrong number of bytes (e.g. 16777215.998 TiB) were reported by the `diff` command. This is now fixed. + +https://github.com/restic/restic/issues/2469 diff --git a/cmd/restic/cmd_diff.go b/cmd/restic/cmd_diff.go index f37c2c7ef..773ff64f3 100644 --- a/cmd/restic/cmd_diff.go +++ b/cmd/restic/cmd_diff.go @@ -66,7 +66,7 @@ type Comparer struct { type DiffStat struct { Files, Dirs, Others int DataBlobs, TreeBlobs int - Bytes int + Bytes uint64 } // Add adds stats information for node to s. @@ -141,7 +141,7 @@ func updateBlobs(repo restic.Repository, blobs restic.BlobSet, stats *DiffStat) continue } - stats.Bytes += int(size) + stats.Bytes += uint64(size) } }