Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: #66324
Assisted-by: a closed-source coding agent
Signed-off-by: Maksim Romanov <romanov.maxim.98@gmail.com>
  • Loading branch information
maksim-romanov committed Sep 26, 2026
commit 1f56017e84f918272d2934dfc3cf2446291c0598
10 changes: 3 additions & 7 deletions test/parallel/test-fs-cp-async-socket.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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();
}));
Expand Down
10 changes: 3 additions & 7 deletions test/parallel/test-fs-cp-sync-copy-socket-error.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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();
Expand Down
Loading