Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node 23.2 fs lost the ability to enumerate named pipes on Windows #56002

Open
connor4312 opened this issue Nov 26, 2024 · 1 comment · May be fixed by #56088
Open

Node 23.2 fs lost the ability to enumerate named pipes on Windows #56002

connor4312 opened this issue Nov 26, 2024 · 1 comment · May be fixed by #56088
Labels
path Issues and PRs related to the path subsystem. windows Issues and PRs related to the Windows platform.

Comments

@connor4312
Copy link
Contributor

Version

23.2.0

Platform

Microsoft Windows NT 10.0.22631.0 x64

Subsystem

fs

What steps will reproduce the bug?

This regressed in 23.2:

PS C:\Users\conno> fnm use 23.1
Using Node v23.1.0
PS C:\Users\conno> node
Welcome to Node.js v23.1.0.
Type ".help" for more information.
> fs.readdirSync('\\\\.\\pipe').length
510

PS C:\Users\conno> fnm use 23.2
Using Node v23.2.0
PS C:\Users\conno> node
Welcome to Node.js v23.2.0.
Type ".help" for more information.
> fs.readdirSync('\\\\.\\pipe').length
Uncaught Error: ENOTDIR: not a directory, scandir '\\.\pipe'
    at Object.readdirSync (node:fs:1499:26) {
  errno: -4052,
  code: 'ENOTDIR',
  syscall: 'scandir',
  path: '\\\\.\\pipe'
}

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

100%

What is the expected behavior? Why is that the expected behavior?

The contents of \\.\pipe should be able to be read as a directory.

What do you see instead?

ENOTDIR when enumerating \\.\pipe

Additional information

This causes js-debug's debugger to break #55948. There is not really a good workaround.

Windows lacks any kind of API aside from this for checking the existence of a named pipe--as exists / stat actually connects to the pipe--so listing \\.\pipe is a common pattern for Windows applications who need to check (e.g. https://berserkerdotnet.github.io/blog/detecting-namedpipe-exists/)

@Flarna
Copy link
Member

Flarna commented Nov 29, 2024

bisect a bit on 23 branch and found that commit 038ac01 seems to cause this.
The corresponding commit on main is 7f68e54 from PR #55623.

The diff introduced with above commit is that node:ToNamespacedPath() appended \ before, after the commit it doesn't.
\\\\.\\pipe\\ - works
\\\\.\\pipe - fails

@huseyinacacak-janea any hints how to fix this.

@Flarna Flarna added windows Issues and PRs related to the Windows platform. path Issues and PRs related to the path subsystem. labels Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
path Issues and PRs related to the path subsystem. windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants