diff options
author | Æx <3017586-ax10336@users.noreply.gitlab.com> | 2021-09-08 21:30:13 +0300 |
---|---|---|
committer | Æx <3017586-ax10336@users.noreply.gitlab.com> | 2021-09-09 10:04:57 +0300 |
commit | 3db4ac6aa075a157851006d4e23f1d7088a982f6 (patch) | |
tree | 86f60a951052570f33cde8933030e71f63088acf | |
parent | 85c4291724f713a37a047e9baacb9cd2187d9de2 (diff) |
fix: unaligned 64-bit atomic operation
Changelog: fixed
-rw-r--r-- | internal/vfs/zip/archive.go | 2 | ||||
-rw-r--r-- | internal/vfs/zip/vfs.go | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/internal/vfs/zip/archive.go b/internal/vfs/zip/archive.go index 087ddda8..3d6a9ff1 100644 --- a/internal/vfs/zip/archive.go +++ b/internal/vfs/zip/archive.go @@ -69,7 +69,7 @@ func newArchive(fs *zipVFS, openTimeout time.Duration) *zipArchive { files: make(map[string]*zip.File), directories: make(map[string]*zip.FileHeader), openTimeout: openTimeout, - cacheNamespace: strconv.FormatInt(atomic.AddInt64(&fs.archiveCount, 1), 10) + ":", + cacheNamespace: strconv.FormatInt(atomic.AddInt64(fs.archiveCount, 1), 10) + ":", } } diff --git a/internal/vfs/zip/vfs.go b/internal/vfs/zip/vfs.go index 3dade30f..1617c033 100644 --- a/internal/vfs/zip/vfs.go +++ b/internal/vfs/zip/vfs.go @@ -48,7 +48,9 @@ type zipVFS struct { dataOffsetCache *lruCache readlinkCache *lruCache - archiveCount int64 + // the `int64` needs to be 64bit aligned on some 32bit systems + // https://gitlab.com/gitlab-org/gitlab/-/issues/337261 + archiveCount *int64 httpClient *http.Client } @@ -72,6 +74,7 @@ func New(cfg *config.ZipServing) vfs.VFS { httptransport.DefaultTTFBTimeout, ), }, + archiveCount: new(int64), } zipVFS.resetCache() |