Skip to content

Commit 87ac2d7

Browse files
authored
fix: Stop using EBADF workaround for Node 24.16.0+ (#7152)
<!-- IMPORTANT: While Yarn 4.x is still actively developed we're now focusing work on our next major releases (5.x and 6.x). These sister releases use the same pattern as TypeScript-Go: - 5.x will only contain a handful of breaking changes to provide a safe migration path. - 6.x will be the "true" release, notable for being implemented in Rust and including a significantly improved core. While PRs can still be opened against 4.x, we recommend power users to try Yarn 6.x now and help us get it over the finish line. It uses the same testsuite as Berry, so compatibility should be at its best. To check out the working trunk for Yarn 6.x, please refer to this repository: https://github.com/yarnpkg/zpm --> ## What's the problem this PR addresses? Node backported nodejs/node#62835 restoring `fs` patchability, so we can now disable the same EBADF workaround for it. This follows the same pattern as #7133. ... ## How did you fix it? Changed the condition to only enable the workaround for node 24.15.x, as it is the only release with the issue. I tested the adjusted version works on 24.16.0. ... ## Checklist <!--- Don't worry if you miss something, chores are automatically tested. --> <!--- This checklist exists to help you remember doing the chores when you submit a PR. --> <!--- Put an `x` in all the boxes that apply. --> - [x] I have read the [Contributing Guide](https://yarnpkg.com/advanced/contributing). <!-- See https://yarnpkg.com/advanced/contributing#preparing-your-pr-to-be-released for more details. --> <!-- Check with `yarn version check` and fix with `yarn version check -i` --> - [x] I have set the packages that need to be released for my changes to be effective. (I used the same version bumps as #7133) <!-- The "Testing chores" workflow validates that your PR follows our guidelines. --> <!-- If it doesn't pass, click on it to see details as to what your PR might be missing. --> - [x] I will check that all automated PR checks pass before the PR gets reviewed.
1 parent 6861e75 commit 87ac2d7

5 files changed

Lines changed: 32 additions & 4 deletions

File tree

β€Ž.pnp.loader.mjsβ€Ž

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Ž.yarn/versions/abc065bf.ymlβ€Ž

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
releases:
2+
"@yarnpkg/cli": patch
3+
"@yarnpkg/plugin-pnp": patch
4+
"@yarnpkg/pnp": patch
5+
6+
declined:
7+
- "@yarnpkg/plugin-compat"
8+
- "@yarnpkg/plugin-constraints"
9+
- "@yarnpkg/plugin-dlx"
10+
- "@yarnpkg/plugin-essentials"
11+
- "@yarnpkg/plugin-init"
12+
- "@yarnpkg/plugin-interactive-tools"
13+
- "@yarnpkg/plugin-nm"
14+
- "@yarnpkg/plugin-npm-cli"
15+
- "@yarnpkg/plugin-pack"
16+
- "@yarnpkg/plugin-patch"
17+
- "@yarnpkg/plugin-pnpm"
18+
- "@yarnpkg/plugin-stage"
19+
- "@yarnpkg/plugin-typescript"
20+
- "@yarnpkg/plugin-version"
21+
- "@yarnpkg/plugin-workspace-tools"
22+
- "@yarnpkg/builder"
23+
- "@yarnpkg/core"
24+
- "@yarnpkg/doctor"
25+
- "@yarnpkg/nm"
26+
- "@yarnpkg/pnpify"
27+
- "@yarnpkg/sdks"

β€Žpackages/yarnpkg-pnp/sources/esm-loader/built-loader.jsβ€Ž

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Žpackages/yarnpkg-pnp/sources/esm-loader/loaderFlags.tsβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ export const SUPPORTS_IMPORT_ATTRIBUTES = major >= 21 || (major === 20 && minor
2222
export const SUPPORTS_IMPORT_ATTRIBUTES_ONLY = major >= 22;
2323

2424
// https://github.com/nodejs/node/pull/61769 β€” backported to v24.15.0 and v22.22.3
25-
// https://github.com/nodejs/node/pull/62835 fixed the broken stat (v26.1.0)
25+
// https://github.com/nodejs/node/pull/62835 fixed the broken stat (v26.1.0, backported to v24.16.0)
2626
export const HAS_BROKEN_FSTAT_FOR_ZIP_FDS =
2727
(major === 26 && minor < 1) ||
2828
(major === 25 && minor >= 7) ||
29-
(major === 24 && minor >= 15) ||
29+
(major === 24 && minor === 15) ||
3030
(major === 22 && (minor > 22 || (minor === 22 && patch >= 3)));

β€Žpackages/yarnpkg-pnp/tests/loaderFlags.test.tsβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ describe(`loaderFlags`, () => {
3131
it(`should keep the existing affected version ranges`, () => {
3232
expect(hasBrokenFstatForZipFds(`24.14.0`)).toBe(false);
3333
expect(hasBrokenFstatForZipFds(`24.15.0`)).toBe(true);
34+
expect(hasBrokenFstatForZipFds(`24.16.0`)).toBe(false);
3435
expect(hasBrokenFstatForZipFds(`25.6.0`)).toBe(false);
3536
expect(hasBrokenFstatForZipFds(`25.7.0`)).toBe(true);
3637
expect(hasBrokenFstatForZipFds(`26.0.0`)).toBe(true);

0 commit comments

Comments
Β (0)