diff --git a/.yarn/versions/30b3d908.yml b/.yarn/versions/30b3d908.yml new file mode 100644 index 000000000000..2d6a48f178d8 --- /dev/null +++ b/.yarn/versions/30b3d908.yml @@ -0,0 +1,34 @@ +releases: + "@yarnpkg/cli": patch + "@yarnpkg/core": patch + +declined: + - "@yarnpkg/plugin-compat" + - "@yarnpkg/plugin-constraints" + - "@yarnpkg/plugin-dlx" + - "@yarnpkg/plugin-essentials" + - "@yarnpkg/plugin-exec" + - "@yarnpkg/plugin-file" + - "@yarnpkg/plugin-git" + - "@yarnpkg/plugin-github" + - "@yarnpkg/plugin-http" + - "@yarnpkg/plugin-init" + - "@yarnpkg/plugin-interactive-tools" + - "@yarnpkg/plugin-link" + - "@yarnpkg/plugin-nm" + - "@yarnpkg/plugin-npm" + - "@yarnpkg/plugin-npm-cli" + - "@yarnpkg/plugin-pack" + - "@yarnpkg/plugin-patch" + - "@yarnpkg/plugin-pnp" + - "@yarnpkg/plugin-pnpm" + - "@yarnpkg/plugin-stage" + - "@yarnpkg/plugin-typescript" + - "@yarnpkg/plugin-version" + - "@yarnpkg/plugin-workspace-tools" + - "@yarnpkg/builder" + - "@yarnpkg/doctor" + - "@yarnpkg/extensions" + - "@yarnpkg/nm" + - "@yarnpkg/pnpify" + - "@yarnpkg/sdks" diff --git a/packages/acceptance-tests/pkg-tests-specs/sources/features/immutablePatterns.test.ts b/packages/acceptance-tests/pkg-tests-specs/sources/features/immutablePatterns.test.ts index 899537f23d7f..8b9232182a52 100644 --- a/packages/acceptance-tests/pkg-tests-specs/sources/features/immutablePatterns.test.ts +++ b/packages/acceptance-tests/pkg-tests-specs/sources/features/immutablePatterns.test.ts @@ -159,5 +159,20 @@ describe(`Features`, () => { }, ), ); + + it(`shouldn't fail when running an install from a subdirectory`, + makeTemporaryEnv( + {}, + async ({path, run, source}) => { + await xfs.writeFilePromise(ppath.join(path, Filename.rc), `immutablePatterns: [".pnp.cjs"]`); + + const subPath = ppath.join(path, `subdir`); + await xfs.mkdirPromise(subPath); + + await run(`install`, {cwd: subPath}); + await run(`install`, `--immutable`, {cwd: subPath}); + }, + ), + ); }); }); diff --git a/packages/yarnpkg-core/sources/hashUtils.ts b/packages/yarnpkg-core/sources/hashUtils.ts index 0af5aa68dbcb..d825c41ed198 100644 --- a/packages/yarnpkg-core/sources/hashUtils.ts +++ b/packages/yarnpkg-core/sources/hashUtils.ts @@ -1,6 +1,6 @@ -import {PortablePath, xfs, npath, FakeFS} from '@yarnpkg/fslib'; -import {createHash, BinaryLike} from 'crypto'; -import fastGlob from 'fast-glob'; +import {PortablePath, xfs, npath, FakeFS, ppath} from '@yarnpkg/fslib'; +import {createHash, BinaryLike} from 'crypto'; +import fastGlob from 'fast-glob'; export function makeHash(...args: Array): T { const hash = createHash(`sha512`); @@ -70,7 +70,7 @@ export async function checksumPattern(pattern: string, {cwd}: {cwd: PortablePath const hashes = await Promise.all(listing.map(async entry => { const parts: Array = [Buffer.from(entry)]; - const p = npath.toPortablePath(entry); + const p = ppath.join(cwd, npath.toPortablePath(entry)); const stat = await xfs.lstatPromise(p); if (stat.isSymbolicLink())