Skip to content

fs APIs don't understand AppExecLink reparse points on Windows #36790

Open
@TylerLeonhardt

Description

@TylerLeonhardt
  • Version: v14.15.3
  • Platform: Windows
  • Subsystem: fs

What steps will reproduce the bug?

  1. Install an app from the Microsoft Store like PowerShell, PowerShell Preview, or Python.
  2. Run the following in Node.js:
// 1
fs.statSync("C:\\Users\\tyleonha\\AppData\\Local\\Microsoft\\WindowsApps\\pwsh.exe")

// 2
fs.existsSync("C:\\Users\\tyleonha\\AppData\\Local\\Microsoft\\WindowsApps\\pwsh.exe")

How often does it reproduce? Is there a required condition?

100% repro rate

What is the expected behavior?

// 1
Stats {
  dev: 2191433689,
  mode: 33206,
  nlink: 1,
  uid: 0,
  gid: 0,
  rdev: 0,
  blksize: 4096,
  ino: 2251799813690117,
  size: 6,
  blocks: 0,
  atimeMs: 1609796639210.8977,
  mtimeMs: 1609794509320.4253,
  ctimeMs: 1609794563739.3364,
  birthtimeMs: 1609794509315.4263,
  atime: 2021-01-04T21:43:59.211Z,
  mtime: 2021-01-04T21:08:29.320Z,
  ctime: 2021-01-04T21:09:23.739Z,
  birthtime: 2021-01-04T21:08:29.315Z
}

// 2
true

What do you see instead?

// 1
Uncaught:
Error: EACCES: permission denied, stat 'C:\Users\tyleonha\AppData\Local\Microsoft\WindowsApps\pwsh.exe'
    at Object.statSync (fs.js:1086:3) {
  errno: -4092,
  syscall: 'stat',
  code: 'EACCES',
  path: 'C:\\Users\\tyleonha\\AppData\\Local\\Microsoft\\WindowsApps\\pwsh.exe'
}

// 2
false

Additional information

This only seems to happen with AppExecLink reparse points on Windows. Regular SymbolicLinks are fine on Windows and give the expected behavior.

Also, fs.lstatSync works with these AppExecLink's which I'm guessing is because lstat operates on the symlnk and not the file that the symlnk points to.

Related issues:
#33024
microsoft/vscode#95828

Metadata

Metadata

Assignees

No one assigned

    Labels

    fsIssues and PRs related to the fs subsystem / file system.libuvIssues and PRs related to the libuv dependency or the uv binding.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