-
-
Notifications
You must be signed in to change notification settings - Fork 34.1k
Fix/fs rmsync broken symlink 61020 #61040
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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
🚀 New features to boost your workflow:
|
Renegade334
left a comment
There was a problem hiding this comment.
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?
6b1b314 to
00ad33d
Compare
00ad33d to
f7000b5
Compare
Summary
Fix
fs.rmSync()so it correctly removes broken symbolic links (and symlinks todirectories) instead of becoming a no-op or throwing
ERR_FS_EISDIR.Fixes: #61020
Details
rmSyncwas usingstd::filesystem::status(), which follows symlinks. Forbroken symlinks this reports
not_found, causingrmSyncto return earlywithout unlinking the symlink itself. Switching to
std::filesystem::symlink_status()makes
rmSyncoperate on the symlink entry, matchingfs.rm()behavior.Tests
./node test/parallel/test-fs-rm.js