forked from yarnpkg/berry
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(plugin-pnpm) Pnpm linker avoids symlink loops on the file system (y…
…arnpkg#4542) * Pnpm linker avoids symlink loops on the file system * symlinkDst -> symlinkDstPath for uniformity with nearby code * Avoids self-require trap * Store paths rather than linkType, and remove now-irrelevant cleanup code * Adds test * Don't create self-references for workspaces, to avoid infinite loops Co-authored-by: Maël Nison <[email protected]>
- Loading branch information
Showing
4 changed files
with
151 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
releases: | ||
"@yarnpkg/cli": patch | ||
"@yarnpkg/plugin-pnpm": patch | ||
|
||
declined: | ||
- "@yarnpkg/plugin-compat" | ||
- "@yarnpkg/plugin-constraints" | ||
- "@yarnpkg/plugin-dlx" | ||
- "@yarnpkg/plugin-essentials" | ||
- "@yarnpkg/plugin-init" | ||
- "@yarnpkg/plugin-interactive-tools" | ||
- "@yarnpkg/plugin-nm" | ||
- "@yarnpkg/plugin-npm-cli" | ||
- "@yarnpkg/plugin-pack" | ||
- "@yarnpkg/plugin-patch" | ||
- "@yarnpkg/plugin-pnp" | ||
- "@yarnpkg/plugin-stage" | ||
- "@yarnpkg/plugin-typescript" | ||
- "@yarnpkg/plugin-version" | ||
- "@yarnpkg/plugin-workspace-tools" | ||
- "@yarnpkg/builder" | ||
- "@yarnpkg/core" | ||
- "@yarnpkg/doctor" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
packages/acceptance-tests/pkg-tests-specs/sources/features/pnpm.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import {PortablePath, ppath, xfs} from '@yarnpkg/fslib'; | ||
|
||
describe(`Features`, () => { | ||
describe(`Pnpm Mode `, () => { | ||
test( | ||
`it shouldn't crash if we recursively traverse a node_modules`, | ||
makeTemporaryEnv({ | ||
dependencies: { | ||
[`no-deps`]: `1.0.0`, | ||
}, | ||
}, { | ||
nodeLinker: `pnpm`, | ||
}, async ({path, run, source}) => { | ||
await run(`install`); | ||
|
||
let iterationCount = 0; | ||
|
||
const getRecursiveDirectoryListing = async (p: PortablePath) => { | ||
if (iterationCount++ > 500) | ||
throw new Error(`Possible infinite recursion detected`); | ||
|
||
for (const entry of await xfs.readdirPromise(p)) { | ||
const entryPath = ppath.join(p, entry); | ||
const stat = await xfs.statPromise(entryPath); | ||
|
||
if (stat.isDirectory()) { | ||
await getRecursiveDirectoryListing(entryPath); | ||
} | ||
} | ||
}; | ||
|
||
await getRecursiveDirectoryListing(path); | ||
}), | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters