Commit ae9c25acc57 for nodejs
commit ae9c25acc5713ccdfb0306bf641d2b7927407fb0
Author: Maksim Romanov <romanov.maxim.98@gmail.com>
Date: Mon Sep 28 22:12:21 2026 +0200
test: use common.PIPE in fs.cp socket tests
The socket was created under a nested tmpdir using an absolute path,
which can exceed the 104-byte sun_path limit on macOS when the
checkout lives in a long directory. common.PIPE uses a path relative
to the cwd, as the other pipe tests do.
Fixes: https://github.com/nodejs/node/issues/66324
Assisted-by: a closed-source coding agent
Signed-off-by: Maksim Romanov <romanov.maxim.98@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/66329
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
diff --git a/test/parallel/test-fs-cp-async-socket.mjs b/test/parallel/test-fs-cp-async-socket.mjs
index f2010e6b3fe..41c37d26d47 100644
--- a/test/parallel/test-fs-cp-async-socket.mjs
+++ b/test/parallel/test-fs-cp-async-socket.mjs
@@ -2,9 +2,8 @@
import * as common from '../common/index.mjs';
import assert from 'node:assert';
-import { cp, mkdirSync } from 'node:fs';
+import { cp } from 'node:fs';
import { createServer } from 'node:net';
-import { join } from 'node:path';
import { nextdir } from '../common/fs.js';
import tmpdir from '../common/tmpdir.js';
@@ -21,13 +20,10 @@ if (common.isInsideDirWithUnusualChars) {
tmpdir.refresh();
{
- const src = nextdir();
- mkdirSync(src);
const dest = nextdir();
- const sock = join(src, `${process.pid}.sock`);
const server = createServer();
- server.listen(sock);
- cp(sock, dest, common.mustCall((err) => {
+ server.listen(common.PIPE);
+ cp(common.PIPE, dest, common.mustCall((err) => {
assert.strictEqual(err.code, 'ERR_FS_CP_SOCKET');
server.close();
}));
diff --git a/test/parallel/test-fs-cp-sync-copy-socket-error.mjs b/test/parallel/test-fs-cp-sync-copy-socket-error.mjs
index dae8786a78d..f198ca33bba 100644
--- a/test/parallel/test-fs-cp-sync-copy-socket-error.mjs
+++ b/test/parallel/test-fs-cp-sync-copy-socket-error.mjs
@@ -2,9 +2,8 @@
import * as common from '../common/index.mjs';
import { nextdir } from '../common/fs.js';
import assert from 'node:assert';
-import { cpSync, mkdirSync } from 'node:fs';
+import { cpSync } from 'node:fs';
import { createServer } from 'node:net';
-import { join } from 'node:path';
import tmpdir from '../common/tmpdir.js';
const isWindows = process.platform === 'win32';
@@ -20,14 +19,11 @@ if (common.isInsideDirWithUnusualChars) {
tmpdir.refresh();
{
- const src = nextdir();
- mkdirSync(src);
const dest = nextdir();
- const sock = join(src, `${process.pid}.sock`);
const server = createServer();
- server.listen(sock);
+ server.listen(common.PIPE);
assert.throws(
- () => cpSync(sock, dest),
+ () => cpSync(common.PIPE, dest),
{ code: 'ERR_FS_CP_SOCKET' }
);
server.close();