Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

fs.rm cannot delete a symlink which is part of a loop #45404

Copy link
Copy link
@nathanael-ruf

Description

@nathanael-ruf
Issue body actions

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 lstatcall.

lazyLoadFs().stat(path, (err, stats) => {

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.fsIssues and PRs related to the fs subsystem / file system.Issues and PRs related to the fs subsystem / file system.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.