community/tailscale: fix atomicfile_test with GOTMPDIR set

Due to us setting GOTMPDIR, the filepath for a socket becomes too large.
This commit is contained in:
Kevin Daudt 2026-03-04 17:15:33 +00:00
parent c2d25ee5ca
commit 1669f230df
2 changed files with 42 additions and 0 deletions

View File

@ -49,6 +49,7 @@ source="$pkgname-$pkgver.tar.gz::https://github.com/tailscale/tailscale/archive/
test-bump-conn-max-overhead.patch
systemd-nftables.patch
fix-tsnet_test-bump-bytesSentTolerance-to-30pct.patch
test-atomicfile-use-tmpdir.patch
"
export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
@ -156,4 +157,5 @@ e0161c3e19a10876ac27c498b951a796ae06d32808710b95169477f4cb41760a6210397a2201be7d
8e7cae496f9910c202cdf7216affcddb6f54df3f8fffb35257fe77bf90c4508b5025498b340b4f38d08a42f62d387ffcdaff24b33aeeadfdb4663fd9f7c2c03b test-bump-conn-max-overhead.patch
fbe51d41fe0e52edbdb13c8b5d7f38901a02cd662a3dbfbcd17732890efc729f91b3ba4fd861ee7ca1ad1cd40debdb24dd2d0b50137dfeff4f16f9a25900a63a systemd-nftables.patch
5a79ddbf3e04e349900f6e94c3dda04e9fec5889636d2ac6c6845211101907364905b19d4fc9a61f74807e91e4d434a4c9c562b46fff2f482e3dfcf891386155 fix-tsnet_test-bump-bytesSentTolerance-to-30pct.patch
88b25746b8769c9f3ef43f950863941c53fa4d313b01b5a6bfe76b44c0d972c14995a140cd4aca7057366048a86e365a8dadbf1cb71a1b32a85f809fcae34379 test-atomicfile-use-tmpdir.patch
"

View File

@ -0,0 +1,40 @@
The test tries to create a unix socket in GOTMPDIR, and fails with
'bind: invalid argument'. This is because tha max file path for a unix
socket is [108 characters][0].
We set GOTMPDIR to be located in $srcdir, which causes the filepath to become
>108 characters.
Force the test to use `/tmp` dir to make sure the path length does not
become too large.
[0]: https://man7.org/linux/man-pages/man7/unix.7.html
diff --git a/atomicfile/atomicfile_test.go b/atomicfile/atomicfile_test.go
index a081c90..f4b85db 100644
--- a/atomicfile/atomicfile_test.go
+++ b/atomicfile/atomicfile_test.go
@@ -9,7 +9,6 @@
"net"
"os"
"path/filepath"
- "runtime"
"strings"
"testing"
)
@@ -21,13 +20,9 @@ func TestDoesNotOverwriteIrregularFiles(t *testing.T) {
const filename = "TestDoesNotOverwriteIrregularFiles"
var path string
- // macOS private temp does not allow unix socket creation, but /tmp does.
- if runtime.GOOS == "darwin" {
- path = filepath.Join("/tmp", filename)
- t.Cleanup(func() { os.Remove(path) })
- } else {
- path = filepath.Join(t.TempDir(), filename)
- }
+
+ path = filepath.Join("/tmp", filename)
+ t.Cleanup(func() { os.Remove(path) })
// The least troublesome thing to make that is not a file is a unix socket.
// Making a null device sadly requires root.