Skip to content

symlink is - stateful? #27795

Description

@TanninOne

Version: v11.6.0
Platform: Windows 10 (64bit)
Subsystem: fs

This is easiest to describe with sample code:

let shortPath = 'c:\\temp\\long pathname test';
undefined
let longPath = 'c:\\temp\\long pathname test\\01234567890123456789012345678901234567890123456789\\01234567890123456789012345678901234567890123456789\\01234567890123456789012345678901234567890123456789\\01234567890123456789012345678901234567890123456789\\01234567890123456789012345678901234567890123456789';
undefined
fs.symlinkSync(path.join(shortPath, 'foobar1.jpg'), path.join(longPath, 'foobar1.jpg'));
undefined
fs.symlinkSync(path.join(longPath, 'foobar2.jpg'), path.join(shortPath, 'foobar2.jpg'));
{ Error: EPERM: operation not permitted, symlink ...}
fs.unlinkSync(path.join(longPath, 'foobar1.jpg'))
undefined
fs.symlinkSync(path.join(shortPath, 'foobar1.jpg'), path.join(longPath, 'foobar1.jpg'));
{ Error: EPERM: operation not permitted, symlink ...}

Now there are a few oddities here
a) I can link from a short path to a long one (> MAX_PATH) but not the other way around
b) The error reported is EPERM for some reason, not ENAMETOOLONG or EINVAL
c) after that error has been reported, even the original call linking from short to long fails

c is the most scary of them because it indicates there is some global internal state that gets flipped and breaks all further calls? How does that make sense?

This is independent of the unlink call btw., this problem also happens if I remove the link outside node or if I use a third file.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues and PRs for confirmed bugs.fsIssues and PRs related to file-system APIs and the fs module.windowsIssues and PRs related to the Windows platform.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions