ckerr

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

Merged
Created: Sep 21, 2026, 12:19:06 PM
Merged: Sep 21, 2026, 3:14:52 PM
5 comments
Target: main

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.

Backports

42-x-y
In-flight
PR Number
#54188
Waiting to be merged
43-x-y
In-flight
PR Number
#54187
Waiting to be merged
44-x-y
In-flight
PR Number
#54189
Waiting to be merged
45-x-y
In-flight
PR Number
#54190
Waiting to be merged

Semver Impact

Major
Breaking changes
Minor
New features
Patch
Bug fixes
None
Docs, tests, etc.

Semantic Versioning helps users understand the impact of updates:

  • Major (X.y.z): Breaking changes that may require code modifications
  • Minor (x.Y.z): New features that maintain backward compatibility
  • Patch (x.y.Z): Bug fixes that don't change the API
  • None: Changes that don't affect using facing parts of Electron