Control: tags 1097131 + patch
Control: tags 1097131 + pending
Control: tags 1099916 + patch
Control: tags 1099916 + pending
Control: tags 1101369 + patch
Control: tags 1101369 + pending

Dear maintainer,

I've prepared an NMU for gocryptfs (versioned as 2.5.1-1.1) and uploaded 
it to DELAYED/2. Please feel free to tell me if I should cancel it.

cu
Adrian
diffstat for gocryptfs-2.5.1 gocryptfs-2.5.1

 changelog                                                  |    9 
 control                                                    |    5 
 patches/0001-Switch-to-the-new-atomic-Uint64.Add-api.patch |  158 +++++++++++++
 patches/series                                             |    1 
 4 files changed, 170 insertions(+), 3 deletions(-)

diff -Nru gocryptfs-2.5.1/debian/changelog gocryptfs-2.5.1/debian/changelog
--- gocryptfs-2.5.1/debian/changelog	2025-01-29 07:53:20.000000000 +0200
+++ gocryptfs-2.5.1/debian/changelog	2025-05-11 16:03:27.000000000 +0300
@@ -1,3 +1,12 @@
+gocryptfs (2.5.1-1.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Add upstream fix for FTBFS on 32-bit. (Closes: #1097131)
+  * Promote fuse3 from Recommends to Depends. (Closes: #1101369)
+  * Update Uploaders. (Closes: #1099916)
+
+ -- Adrian Bunk <b...@debian.org>  Sun, 11 May 2025 16:03:27 +0300
+
 gocryptfs (2.5.1-1) unstable; urgency=medium
 
   * New upstream release.
diff -Nru gocryptfs-2.5.1/debian/control gocryptfs-2.5.1/debian/control
--- gocryptfs-2.5.1/debian/control	2025-01-29 07:53:20.000000000 +0200
+++ gocryptfs-2.5.1/debian/control	2025-05-11 16:03:27.000000000 +0300
@@ -2,7 +2,7 @@
 Section: devel
 Priority: optional
 Maintainer: Debian Go Packaging Team <pkg-go-maintain...@lists.alioth.debian.org>
-Uploaders: Felix Lechner <felix.lech...@lease-up.com>, Dmitry Smirnov <only...@debian.org>
+Uploaders: Dmitry Smirnov <only...@debian.org>
 Build-Depends: debhelper-compat (= 13),
                dh-golang,
                golang-any,
@@ -29,8 +29,7 @@
 Package: gocryptfs
 Architecture: any
 Built-Using: ${misc:Built-Using}, ${misc:Static-Built-Using}
-Depends: ${shlibs:Depends}, ${misc:Depends}
-Recommends: fuse3
+Depends: ${shlibs:Depends}, ${misc:Depends}, fuse3
 Suggests: fido2-tools
 Description: Encrypted overlay filesystem written in Go
  gocryptfs is built on top of the excellent go-fuse
diff -Nru gocryptfs-2.5.1/debian/patches/0001-Switch-to-the-new-atomic-Uint64.Add-api.patch gocryptfs-2.5.1/debian/patches/0001-Switch-to-the-new-atomic-Uint64.Add-api.patch
--- gocryptfs-2.5.1/debian/patches/0001-Switch-to-the-new-atomic-Uint64.Add-api.patch	1970-01-01 02:00:00.000000000 +0200
+++ gocryptfs-2.5.1/debian/patches/0001-Switch-to-the-new-atomic-Uint64.Add-api.patch	2025-05-11 16:01:50.000000000 +0300
@@ -0,0 +1,158 @@
+From aeb4fa4e96b0e540d20043e11a408deb6678738b Mon Sep 17 00:00:00 2001
+From: Jakob Unterwurzacher <jakob...@gmail.com>
+Date: Tue, 6 May 2025 09:11:49 +0200
+Subject: Switch to the new atomic Uint64.Add api
+
+The new api guarantees that the value is aligned, preventing
+stuff like this on 32 bit platforms:
+
+	goroutine 26 [running]:
+	internal/runtime/atomic.panicUnaligned()
+		/usr/lib/go-1.24/src/internal/runtime/atomic/unaligned.go:8 +0x24
+	internal/runtime/atomic.Xadd64(0x2496c74, 0x1)
+		/usr/lib/go-1.24/src/internal/runtime/atomic/atomic_arm.s:318 +0x14
+	github.com/rfjakob/gocryptfs/internal/inomap.(*InoMap).NextSpillIno(0x2496c60)
+
+Fixes https://github.com/rfjakob/gocryptfs/issues/912
+---
+ internal/fusefrontend/node_helpers.go      |  3 +--
+ internal/fusefrontend/root_node.go         |  3 ++-
+ internal/fusefrontend_reverse/root_node.go |  4 ++--
+ internal/inomap/inomap.go                  | 11 ++++++-----
+ internal/openfiletable/open_file_table.go  |  6 +++---
+ 5 files changed, 14 insertions(+), 13 deletions(-)
+
+diff --git a/internal/fusefrontend/node_helpers.go b/internal/fusefrontend/node_helpers.go
+index f5dfeb6..2ad2466 100644
+--- a/internal/fusefrontend/node_helpers.go
++++ b/internal/fusefrontend/node_helpers.go
+@@ -2,7 +2,6 @@ package fusefrontend
+ 
+ import (
+ 	"context"
+-	"sync/atomic"
+ 	"syscall"
+ 
+ 	"github.com/hanwen/go-fuse/v2/fs"
+@@ -91,7 +90,7 @@ func (n *Node) newChild(ctx context.Context, st *syscall.Stat_t, out *fuse.Entry
+ 	if rn.args.SharedStorage || rn.quirks&syscallcompat.QuirkDuplicateIno1 != 0 {
+ 		// Make each directory entry a unique node by using a unique generation
+ 		// value - see the comment at RootNode.gen for details.
+-		gen = atomic.AddUint64(&rn.gen, 1)
++		gen = rn.gen.Add(1)
+ 	}
+ 
+ 	// Create child node
+diff --git a/internal/fusefrontend/root_node.go b/internal/fusefrontend/root_node.go
+index ac814ad..d2950a1 100644
+--- a/internal/fusefrontend/root_node.go
++++ b/internal/fusefrontend/root_node.go
+@@ -4,6 +4,7 @@ import (
+ 	"os"
+ 	"strings"
+ 	"sync"
++	"sync/atomic"
+ 	"syscall"
+ 	"time"
+ 
+@@ -55,7 +56,7 @@ type RootNode struct {
+ 	// This makes each directory entry unique (even hard links),
+ 	// makes go-fuse hand out separate FUSE Node IDs for each, and prevents
+ 	// bizarre problems when inode numbers are reused behind our back.
+-	gen uint64
++	gen atomic.Uint64
+ 	// quirks is a bitmap that enables workaround for quirks in the filesystem
+ 	// backing the cipherdir
+ 	quirks uint64
+diff --git a/internal/fusefrontend_reverse/root_node.go b/internal/fusefrontend_reverse/root_node.go
+index cb04151..cf2410f 100644
+--- a/internal/fusefrontend_reverse/root_node.go
++++ b/internal/fusefrontend_reverse/root_node.go
+@@ -50,7 +50,7 @@ type RootNode struct {
+ 	// makes go-fuse hand out separate FUSE Node IDs for each, and prevents
+ 	// bizarre problems when inode numbers are reused behind our back,
+ 	// like this one: https://github.com/rfjakob/gocryptfs/issues/802
+-	gen uint64
++	gen atomic.Uint64
+ 	// rootIno is the inode number that we report for the root node on mount
+ 	rootIno uint64
+ }
+@@ -175,7 +175,7 @@ func (rn *RootNode) uniqueStableAttr(mode uint32, ino uint64) fs.StableAttr {
+ 		Ino:  ino,
+ 		// Make each directory entry a unique node by using a unique generation
+ 		// value. Also see the comment at RootNode.gen for details.
+-		Gen: atomic.AddUint64(&rn.gen, 1),
++		Gen: rn.gen.Add(1),
+ 	}
+ }
+ 
+diff --git a/internal/inomap/inomap.go b/internal/inomap/inomap.go
+index b4dbf27..5749202 100644
+--- a/internal/inomap/inomap.go
++++ b/internal/inomap/inomap.go
+@@ -45,7 +45,7 @@ type InoMap struct {
+ 	// spill is used once the namespaces map is full
+ 	spillMap map[QIno]uint64
+ 	// spillNext is the next free inode number in the spill map
+-	spillNext uint64
++	spillNext atomic.Uint64
+ }
+ 
+ // New returns a new InoMap.
+@@ -57,8 +57,9 @@ func New(rootDev uint64) *InoMap {
+ 		namespaceMap:  make(map[namespaceData]uint16),
+ 		namespaceNext: 0,
+ 		spillMap:      make(map[QIno]uint64),
+-		spillNext:     spillSpaceStart,
+ 	}
++	m.spillNext.Store(spillSpaceStart)
++
+ 	if rootDev > 0 {
+ 		// Reserve namespace 0 for rootDev
+ 		m.namespaceMap[namespaceData{rootDev, 0}] = 0
+@@ -74,10 +75,10 @@ var spillWarn sync.Once
+ // Reverse mode NextSpillIno() for gocryptfs.longname.*.name files where a stable
+ // mapping is not needed.
+ func (m *InoMap) NextSpillIno() (out uint64) {
+-	if m.spillNext == math.MaxUint64 {
+-		log.Panicf("spillMap overflow: spillNext = 0x%x", m.spillNext)
++	if m.spillNext.Load() == math.MaxUint64 {
++		log.Panicf("spillMap overflow: spillNext = 0x%x", m.spillNext.Load())
+ 	}
+-	return atomic.AddUint64(&m.spillNext, 1) - 1
++	return m.spillNext.Add(1) - 1
+ }
+ 
+ func (m *InoMap) spill(in QIno) (out uint64) {
+diff --git a/internal/openfiletable/open_file_table.go b/internal/openfiletable/open_file_table.go
+index ce8df76..420d070 100644
+--- a/internal/openfiletable/open_file_table.go
++++ b/internal/openfiletable/open_file_table.go
+@@ -29,7 +29,7 @@ type table struct {
+ 	// The variable is accessed without holding any locks so atomic operations
+ 	// must be used. It must be the first element of the struct to guarantee
+ 	// 64-bit alignment.
+-	writeOpCount uint64
++	writeOpCount atomic.Uint64
+ 	// Protects map access
+ 	sync.Mutex
+ 	// Table entries
+@@ -85,13 +85,13 @@ type countingMutex struct {
+ 
+ func (c *countingMutex) Lock() {
+ 	c.RWMutex.Lock()
+-	atomic.AddUint64(&t.writeOpCount, 1)
++	t.writeOpCount.Add(1)
+ }
+ 
+ // WriteOpCount returns the write lock counter value. This value is incremented
+ // each time writeLock.Lock() on a file table entry is called.
+ func WriteOpCount() uint64 {
+-	return atomic.LoadUint64(&t.writeOpCount)
++	return t.writeOpCount.Load()
+ }
+ 
+ // CountOpenFiles returns how many entries are currently in the table
+-- 
+2.30.2
+
diff -Nru gocryptfs-2.5.1/debian/patches/series gocryptfs-2.5.1/debian/patches/series
--- gocryptfs-2.5.1/debian/patches/series	2025-01-29 07:22:06.000000000 +0200
+++ gocryptfs-2.5.1/debian/patches/series	2025-05-11 16:03:27.000000000 +0300
@@ -2,3 +2,4 @@
 001-disable-emulated-getdents.patch
 002-disable-getdents-test.patch
 003-revert-jacobsa-fork.patch
+0001-Switch-to-the-new-atomic-Uint64.Add-api.patch

Reply via email to