From f025e3ce8a522396c7bf9411166e41c272cda01c Mon Sep 17 00:00:00 2001 From: Matteo Collina Date: Thu, 8 Oct 2026 08:32:55 +0000 Subject: [PATCH] test: keep the h2c unix socket path within sun_path limits os.tmpdir() can be long enough (e.g. under CITGM on macOS, where TMPDIR points inside the CITGM work dir) that the socket path exceeds the 104-byte sun_path limit. Node.js >= 24 rejects such paths with EINVAL instead of silently truncating them, so the test failed on Node.js 24 and 26. Fall back to /tmp when the path would be too long. Refs: https://github.com/nodejs/citgm/issues/1185 --- test/h2c-client.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/h2c-client.js b/test/h2c-client.js index 153c7dfd1d7..3e569d2d3f6 100644 --- a/test/h2c-client.js +++ b/test/h2c-client.js @@ -194,7 +194,11 @@ test('Connect to h2c server over a unix domain socket', { skip: process.platform const { join } = require('node:path') const { tmpdir } = require('node:os') - const tmpDir = await mkdtemp(join(tmpdir(), 'h2c-client-')) + // Unix socket paths are limited to 104 bytes on macOS (108 on Linux), and + // Node.js >= 24 rejects longer ones with EINVAL instead of truncating them. + // os.tmpdir() can be long (e.g. under CITGM on macOS), so fall back to /tmp. + const base = join(tmpdir(), 'h2c-client-XXXXXX', 'server.sock').length < 104 ? tmpdir() : '/tmp' + const tmpDir = await mkdtemp(join(base, 'h2c-client-')) const socketPath = join(tmpDir, 'server.sock') const authority = 'localhost'