Skip to content

fs.stat or fs.lstat throws unknown error on some files (reparse point) #33024

Description

@karthiknadig
  • Version: v12.16.2
  • Platform: 64 bit Microsoft Windows 10 [Version 10.0.18362.778]
  • Subsystem: fs

What steps will reproduce the bug?

  1. Check if %USERPROFILE%\AppData\Local\Microsoft\WindowsApps exists.
  2. Install https://www.microsoft.com/en-us/p/python-38/9mssztt1n39l
  3. Call fs.statSync("c:\\Users\\kanadig\\AppData\\Local\\Microsoft\\WindowsApps\\python.exe")

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

This repros 100%, make sure you are calling it on the files under %USERPROFILE%\AppData\Local\Microsoft\WindowsApps\ with 0 size.

What is the expected behavior?

Should not throw exception.

What do you see instead?

> fs.statSync("c:\\Users\\bpasero\\AppData\\Local\\Microsoft\\WindowsApps\\GameBarElevatedFT_Alias.exe")                 
Thrown:                                                                                                                  
{ Error: UNKNOWN: unknown error, stat 'c:\Users\bpasero\AppData\Local\Microsoft\WindowsApps\GameBarElevatedFT_Alias.exe' 
    at Object.statSync (fs.js:855:3)                                                                                     
  errno: -4094,                                                                                                          
  syscall: 'stat',                                                                                                       
  code: 'UNKNOWN',                                                                                                       
  path:                                                                                                                  
   'c:\\Users\\bpasero\\AppData\\Local\\Microsoft\\WindowsApps\\GameBarElevatedFT_Alias.exe' }                           
> fs.lstatSync("c:\\Users\\bpasero\\AppData\\Local\\Microsoft\\WindowsApps\\GameBarElevatedFT_Alias.exe")                
Thrown:                                                                                                                  
{ Error: UNKNOWN: unknown error, lstat 'c:\Users\bpasero\AppData\Local\Microsoft\WindowsApps\GameBarElevatedFT_Alias.exe'
    at Object.lstatSync (fs.js:845:3)                                                                                    
  errno: -4094,                                                                                                          
  syscall: 'lstat',                                                                                                      
  code: 'UNKNOWN',                                                                                                       
  path:                                                                                                                  
   'c:\\Users\\bpasero\\AppData\\Local\\Microsoft\\WindowsApps\\GameBarElevatedFT_Alias.exe' }                           
>     

Additional information

See microsoft/vscode#95828

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues and PRs for confirmed bugs.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