From a259c185109e692befdd870e92d6b87f12201ee1 Mon Sep 17 00:00:00 2001 From: Dominik Schulz Date: Sat, 20 Mar 2021 07:32:20 +0100 Subject: [PATCH] Ensure 8-byte alignment of progressbar counters (#1855) Fixes #1854 RELEASE_NOTES=[BUGFIX] Fix progress bar on 32 bit archs Signed-off-by: Dominik Schulz --- pkg/termio/progress.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/termio/progress.go b/pkg/termio/progress.go index ffc943a387..7b989f6984 100644 --- a/pkg/termio/progress.go +++ b/pkg/termio/progress.go @@ -22,9 +22,12 @@ var ( // ProgressBar is a gopass progress bar type ProgressBar struct { - hidden bool + // keep both int64 fields at the top to ensure correct + // 8-byte alignment on 32 bit systems. See https://golang.org/pkg/sync/atomic/#pkg-note-BUG + // and https://github.com/golang/go/issues/36606 total int64 current int64 + hidden bool mutex chan struct{} lastUpd time.Time }