Closed
Description
Version
18.12.1
Platform
Darwin Nathanaels-MBP.fritz.box 22.1.0 Darwin Kernel Version 22.1.0: Sun Oct 9 20:14:30 PDT 2022; root:xnu-8792.41.9~2/RELEASE_ARM64_T8103 arm64
Subsystem
fs
What steps will reproduce the bug?
mkdir repro
cd repro
ln -s a b && ln -s b a
node -e 'fs.rmSync("a")'
cd ..
rm -r repro
How often does it reproduce? Is there a required condition?
Always. No.
What is the expected behavior?
Can delete symlinks that form a loop.
What do you see instead?
This error
Uncaught Error: ELOOP: too many symbolic links encountered, stat 'a'
at Object.statSync (node:fs:1596:3)
at __node_internal_ (node:internal/fs/utils:804:8)
at Object.rmSync (node:fs:1272:13) {
errno: -62,
syscall: 'stat',
code: 'ELOOP',
path: 'a'
}
Additional information
This stat
call should probably be a lstat
call.
Line 772 in 1b97188