Skip to content

Fix/fs rmsync broken symlink 61020 - #61040

Merged
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
sangwook-dev:fix/fs-rmsync-broken-symlink-61020
Dec 23, 2025
Merged

nodejs-github-bot merged 1 commit into
nodejs:mainfrom
sangwook-dev:fix/fs-rmsync-broken-symlink-61020

Conversation

@sangwook-dev

Copy link
Copy Markdown
Contributor

Summary

Fix fs.rmSync() so it correctly removes broken symbolic links (and symlinks to
directories) instead of becoming a no-op or throwing ERR_FS_EISDIR.

Fixes: #61020

Details

rmSync was using std::filesystem::status(), which follows symlinks. For
broken symlinks this reports not_found, causing rmSync to return early
without unlinking the symlink itself. Switching to std::filesystem::symlink_status()
makes rmSync operate on the symlink entry, matching fs.rm() behavior.

Tests

  • ./node test/parallel/test-fs-rm.js

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. fs Issues and PRs related to file-system APIs and the fs module. needs-ci PRs that need a full CI run. labels Dec 13, 2025
@codecov

ghost commented Dec 13, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.51%. Comparing base (4f24aff) to head (f7000b5).
⚠️ Report is 48 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #61040      +/-   ##
==========================================
- Coverage   88.53%   88.51%   -0.03%     
==========================================
  Files         703      703              
  Lines      208546   208546              
  Branches    40217    40222       +5     
==========================================
- Hits       184634   184590      -44     
- Misses      15926    15968      +42     
- Partials     7986     7988       +2     
Files with missing lines Coverage Δ
src/node_file.cc 75.51% <100.00%> (-0.04%) ⬇️

... and 30 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

ghost left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like the correct approach to me, we use lstat-based checks in rimraf etc.

Could you please squash your commits, so that the final commit message is the fs: one, not the test: one?

@sangwook-dev
sangwook-dev force-pushed the fix/fs-rmsync-broken-symlink-61020 branch from 6b1b314 to 00ad33d Compare December 13, 2025 15:15
@sangwook-dev
sangwook-dev force-pushed the fix/fs-rmsync-broken-symlink-61020 branch from 00ad33d to f7000b5 Compare December 14, 2025 00:20
@Renegade334 Renegade334 added author ready PRs with CI started, the required approvals, and no outstanding review comments. request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. dont-land-on-v20.x dont-land-on-v22.x PRs that should not land on the v22.x-staging branch and should not be released in v22.x. labels Dec 14, 2025
@Renegade334
Renegade334 requested a review from anonrig December 14, 2025 15:11
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Dec 19, 2025
@nodejs-github-bot

ghost commented Dec 19, 2025

Copy link
Copy Markdown
Collaborator

@sangwook-dev

ghost commented Dec 21, 2025

Copy link
Copy Markdown
Contributor Author

@Renegade334
It looks like the CI failed due to a transient issue.
Could you please re-run the failed CI jobs only?

@nodejs-github-bot

ghost commented Dec 23, 2025

Copy link
Copy Markdown
Collaborator

@Renegade334 Renegade334 added the commit-queue PRs queued for automated landing through the Commit Queue. label Dec 23, 2025
@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Dec 23, 2025
@nodejs-github-bot
nodejs-github-bot merged commit dc8215b into nodejs:main Dec 23, 2025
@nodejs-github-bot

ghost commented Dec 23, 2025

Copy link
Copy Markdown
Collaborator

Landed in dc8215b

@ifreefly

ghost commented Dec 24, 2025

Copy link
Copy Markdown

Hi @Renegade334 ,When will it be merged into branch node.js 24?

@Renegade334

ghost commented Dec 24, 2025

Copy link
Copy Markdown
Member

When will it be merged into branch node.js 24?

Usually a few weeks, depending on release schedule. It needs to be releaased on the active branch frst.

@sangwook-dev
sangwook-dev deleted the fix/fs-rmsync-broken-symlink-61020 branch February 8, 2026 05:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. c++ Issues and PRs that require attention from people who are familiar with C++. dont-land-on-v22.x PRs that should not land on the v22.x-staging branch and should not be released in v22.x. fs Issues and PRs related to file-system APIs and the fs module. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fs.rmSync() cannot remove broken symbolic link

6 participants