From 30c7590a264a069b7da674cec5c147babd657a07 Mon Sep 17 00:00:00 2001 From: Scarab Systems Date: Tue, 16 Jun 2026 16:31:03 -0400 Subject: [PATCH] fix: shorten CAFS temp directory names (#12327) ## Summary - use `fs.mkdtemp()` with a short `_tmp_` prefix for CAFS temporary package directories - remove `path-temp` from `@pnpm/store.create-cafs-store` - add git-fetcher regression coverage for short CAFS temp directories during git package preparation - add a patch changeset for `@pnpm/store.create-cafs-store` and `pnpm` ## Why This leaves more Unix socket path budget for lifecycle tools that create IPC sockets under `TMPDIR` during git-hosted dependency preparation. Closes pnpm/pnpm#12222. ## Pacquet No pacquet change is included because the Rust git fetcher already uses `tempfile::tempdir()` instead of the TypeScript CAFS `path-temp` suffix changed here. --- .changeset/short-pipes-dance.md | 6 ++++++ fetching/git-fetcher/test/index.ts | 9 +++++++++ pnpm-lock.yaml | 3 --- store/create-cafs-store/package.json | 1 - store/create-cafs-store/src/index.ts | 6 ++---- 5 files changed, 17 insertions(+), 8 deletions(-) create mode 100644 .changeset/short-pipes-dance.md diff --git a/.changeset/short-pipes-dance.md b/.changeset/short-pipes-dance.md new file mode 100644 index 0000000000..b940493cbc --- /dev/null +++ b/.changeset/short-pipes-dance.md @@ -0,0 +1,6 @@ +--- +"@pnpm/store.create-cafs-store": patch +"pnpm": patch +--- + +Create shorter CAFS temporary package directories to leave room for lifecycle scripts that create IPC socket paths under TMPDIR. diff --git a/fetching/git-fetcher/test/index.ts b/fetching/git-fetcher/test/index.ts index f69e33a320..62f42436da 100644 --- a/fetching/git-fetcher/test/index.ts +++ b/fetching/git-fetcher/test/index.ts @@ -47,6 +47,15 @@ beforeEach(() => { jest.mocked(globalWarn).mockClear() }) +test('uses short CAFS temp directories for git package preparation', async () => { + const storeDir = temporaryDirectory() + const tmpDir = await createCafsStore(storeDir).tempDir() + + expect(path.dirname(tmpDir)).toBe(path.join(storeDir, 'tmp')) + expect(path.basename(tmpDir)).toMatch(/^_tmp_[a-zA-Z0-9]{6}$/) + expect(path.basename(tmpDir).length).toBeLessThanOrEqual(11) +}) + test('fetch', async () => { const storeDir = temporaryDirectory() const fetch = createGitFetcher({ storeIndex: createStoreIndex(storeDir) }).git diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index dcd5b0ac62..d16ae79b66 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9306,9 +9306,6 @@ importers: memoize: specifier: 'catalog:' version: 11.0.0 - path-temp: - specifier: 'catalog:' - version: 3.0.0 ramda: specifier: 'catalog:' version: '@pnpm/ramda@0.28.1' diff --git a/store/create-cafs-store/package.json b/store/create-cafs-store/package.json index c28ebc4fdf..a9b76e1a94 100644 --- a/store/create-cafs-store/package.json +++ b/store/create-cafs-store/package.json @@ -48,7 +48,6 @@ "@pnpm/store.cafs": "workspace:*", "@pnpm/store.controller-types": "workspace:*", "memoize": "catalog:", - "path-temp": "catalog:", "ramda": "catalog:" }, "peerDependencies": { diff --git a/store/create-cafs-store/src/index.ts b/store/create-cafs-store/src/index.ts index bd8b587e69..603f737e25 100644 --- a/store/create-cafs-store/src/index.ts +++ b/store/create-cafs-store/src/index.ts @@ -14,7 +14,6 @@ import type { ImportPackageFunctionAsync, } from '@pnpm/store.controller-types' import memoize from 'memoize' -import { pathTemp } from 'path-temp' export { type CafsLocker } @@ -140,9 +139,8 @@ export function createCafsStore ( storeDir, importPackage, tempDir: async () => { - const tmpDir = pathTemp(baseTempDir) - await fs.mkdir(tmpDir, { recursive: true }) - return tmpDir + await fs.mkdir(baseTempDir, { recursive: true }) + return fs.mkdtemp(path.join(baseTempDir, '_tmp_')) }, } }