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

fs.statSync broken on Windows #49949

Closed
slavek-kucera opened this issue Sep 29, 2023 · 1 comment
Closed

fs.statSync broken on Windows #49949

slavek-kucera opened this issue Sep 29, 2023 · 1 comment
Labels
duplicate Issues and PRs that are duplicates of other issues or PRs. fs Issues and PRs related to the fs subsystem / file system. windows Issues and PRs related to the Windows platform.

Comments

@slavek-kucera
Copy link

Version

v18.18.0

Platform

Microsoft Windows NT 10.0.19045.0 x64

Subsystem

No response

What steps will reproduce the bug?

Create a file with 4-byte utf-8 symbol in its name e.g. test¾_🧼utf@_8_☕.
Run node -e "console.log(require('fs').statSync('test¾_🧼utf@_8_☕'))"

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

No response

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

The existence of the file should be reported correclty. e.g.

Stats {
  dev: 750874418,
  mode: 33206,
  nlink: 1,
  uid: 0,
  gid: 0,
  rdev: 0,
  blksize: 4096,
  ino: 216735732067912130,
  size: 0,
  blocks: 0,
  atimeMs: 1695990997989.8892,
  mtimeMs: 1695990997989.8892,
  ctimeMs: 1695990997989.629,
  birthtimeMs: 1695990997988.6287,
  atime: 2023-09-29T12:36:37.990Z,
  mtime: 2023-09-29T12:36:37.990Z,
  ctime: 2023-09-29T12:36:37.990Z,
  birthtime: 2023-09-29T12:36:37.989Z
}

What do you see instead?

node:internal/fs/utils:350
    throw err;
    ^

Error: ENOENT: no such file or directory, stat 'test¾_🧼utf@_8_☕'
    at Object.statSync (node:fs:1690:3)
    at [eval]:1:27
    at Script.runInThisContext (node:vm:123:12)
    at Object.runInThisContext (node:vm:299:38)
    at node:internal/process/execution:82:21
    at [eval]-wrapper:6:24
    at runScript (node:internal/process/execution:81:62)
    at evalScript (node:internal/process/execution:103:10)
    at node:internal/main/eval_string:29:3 {
  errno: -4058,
  syscall: 'stat',
  code: 'ENOENT',
  path: 'test¾_🧼utf@_8_☕'
}

Additional information

It works correctly on v18.16.1

@richardlau richardlau added fs Issues and PRs related to the fs subsystem / file system. windows Issues and PRs related to the Windows platform. duplicate Issues and PRs that are duplicates of other issues or PRs. labels Sep 29, 2023
@richardlau
Copy link
Member

Duplicate of #48673.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate Issues and PRs that are duplicates of other issues or PRs. fs Issues and PRs related to the fs subsystem / file system. windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

No branches or pull requests

2 participants