Skip to content

fix: remove read-only files with fs.rmSync on Windows - #54180

Merged
MarshallOfSound merged 1 commit into
mainfrom
fix/node-rmsync-readonly
Sep 21, 2026
Merged

MarshallOfSound merged 1 commit into
mainfrom
fix/node-rmsync-readonly

Conversation

@ckerr

@ckerr ckerr commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

Description of Change

A downstream test suite encountered nodejs/node#64374 while upgrading from Electron v43.6.0 to v43.7.1: fs.rmSync fails with EPERM when removing read-only files on Windows.

Node's C++ implementation uses std::filesystem, but libc++ does not clear the Windows read-only attribute before removal as MSVC STL does. Electron builds Node with libc++, exposing this difference from official Node builds.

Backport nodejs/node#64453 (2987a5965f1f) to clear the attribute and retry removal, retaining the upstream regression test.

Fixes #52253.

Note: this patch doesn't let us remove test_account_for_libc_rm_error_on_electron_linux.patch 🤷‍♂️

CC @deepak1556 as downstream stakeholder
CC @jkleinsc as this week's Node.js roll stakeholder

Checklist

Release Notes

Notes: Fixed fs.rmSync failing to remove read-only files on Windows.

Electron's libc++ builds fail with EPERM for read-only files on Windows.
Backport nodejs/node@2987a5965f1f to clear the attribute and retry removal.

Fixes #52253.

Assisted-By: GitHub Copilot
@ckerr
ckerr requested a review from a team as a code owner September 21, 2026 17:19
@ckerr ckerr added semver/patch backwards-compatible bug fixes target/42-x-y PR should also be added to the "42-x-y" branch. target/43-x-y PR should also be added to the "43-x-y" branch. target/44-x-y PR should also be added to the "44-x-y" branch. target/45-x-y PR should also be added to the "45-x-y" branch. labels Sep 21, 2026
@MarshallOfSound
MarshallOfSound merged commit 1e93884 into main Sep 21, 2026
114 checks passed
@MarshallOfSound
MarshallOfSound deleted the fix/node-rmsync-readonly branch September 21, 2026 20:14
@release-clerk

release-clerk Bot commented Sep 21, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed fs.rmSync failing to remove read-only files on Windows.

@trop

trop Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "43-x-y", please check out #54187

@trop

trop Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "42-x-y", please check out #54188

@trop trop Bot removed the target/43-x-y PR should also be added to the "43-x-y" branch. label Sep 21, 2026
@trop trop Bot removed the target/42-x-y PR should also be added to the "42-x-y" branch. label Sep 21, 2026
@trop

trop Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "44-x-y", please check out #54189

@trop

trop Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "45-x-y", please check out #54190

@trop trop Bot added in-flight/44-x-y in-flight/45-x-y and removed target/44-x-y PR should also be added to the "44-x-y" branch. target/45-x-y PR should also be added to the "45-x-y" branch. labels Sep 21, 2026
@trop

trop Bot commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

@MarshallOfSound has manually backported this PR to "44-x-y", please check out #54255

@trop

trop Bot commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

@MarshallOfSound has manually backported this PR to "43-x-y", please check out #54256

@trop

trop Bot commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

@MarshallOfSound has manually backported this PR to "42-x-y", please check out #54257

dsanders11 pushed a commit that referenced this pull request Sep 23, 2026
fix: remove read-only files with fs.rmSync on Windows (#54180)

fix: remove read-only files with fs.rmSync

Electron's libc++ builds fail with EPERM for read-only files on Windows.
Backport nodejs/node@2987a5965f1f to clear the attribute and retry removal.

Fixes #52253.

Assisted-By: GitHub Copilot
(cherry picked from commit 1e93884)

Co-authored-by: Charles Kerr <charles@charleskerr.com>
@trop trop Bot added merged/42-x-y PR was merged to the "42-x-y" branch. and removed in-flight/42-x-y labels Sep 23, 2026
dsanders11 pushed a commit that referenced this pull request Sep 23, 2026
fix: remove read-only files with fs.rmSync on Windows (#54180)

fix: remove read-only files with fs.rmSync

Electron's libc++ builds fail with EPERM for read-only files on Windows.
Backport nodejs/node@2987a5965f1f to clear the attribute and retry removal.

Fixes #52253.

Assisted-By: GitHub Copilot
(cherry picked from commit 1e93884)

Co-authored-by: Charles Kerr <charles@charleskerr.com>
@trop trop Bot added the merged/43-x-y PR was merged to the "43-x-y" branch. label Sep 23, 2026
dsanders11 pushed a commit that referenced this pull request Sep 23, 2026
fix: remove read-only files with fs.rmSync on Windows (#54180)

fix: remove read-only files with fs.rmSync

Electron's libc++ builds fail with EPERM for read-only files on Windows.
Backport nodejs/node@2987a5965f1f to clear the attribute and retry removal.

Fixes #52253.

Assisted-By: GitHub Copilot
(cherry picked from commit 1e93884)

Co-authored-by: Charles Kerr <charles@charleskerr.com>
@trop trop Bot added merged/44-x-y PR was merged to the "44-x-y" branch. merged/45-x-y PR was merged to the "45-x-y" branch. and removed in-flight/45-x-y labels Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

46-x-y merged/42-x-y PR was merged to the "42-x-y" branch. merged/43-x-y PR was merged to the "43-x-y" branch. merged/44-x-y PR was merged to the "44-x-y" branch. merged/45-x-y PR was merged to the "45-x-y" branch. semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fs.rmSync fails on read-only file with EPERM

2 participants