nodejs / nodejs/node

fs: can't require non-ASCII file paths in Shift-JIS filesystem

Open
#56,670 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

fs never-stale windows
Dominant language
JavaScript
Stars
122k
Forks
37.3k
Avg merge
4d 2h
Merged PRs (30d)
283

Description

Version

v22.13.0, v23.6.0

Platform
Microsoft Windows NT 10.0.26100.0 x64
Subsystem

fs

What steps will reproduce the bug?
  1. Use Japanese Windows with Shift-JIS (aka CP932)
  2. Load a non-ASCII file path with require such as ヘルプ.js
How often does it reproduce? Is there a required condition?

Always reproduceable under a Shift-JIS filesystem.

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

The file is loaded correctly.

What do you see instead?

"Process exited with code 3221225477"

Additional information
  • May be similar to https://github.com/nodejs/node/issues/56049, although it's an issue for a different method and doesn't mention the Shift-JIS requirement.
  • The issue was found in https://github.com/sapphiredev/pieces/issues/460 for reference, which used require in the user's case, the aforementioned issue also links a reproducible example repository, although not a minimal one for testing purposes, the issue has been reproduced with a simple require in REPL as well.
  • The same code works fine:
    • If the filesystem isn't Shift-JIS (UNIX, non-Japanese Windows).
    • ASCII names are used instead.
    • When run with an alternative runtime such as Deno.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in the fs subsystem by reproducing the simple require case described on Japanese Windows with a Shift-JIS filesystem, then compare it with ASCII paths and non-Shift-JIS systems. The linked reproducible repository and the REPL case provide starting examples. Done means require loads a non-ASCII path successfully under Shift-JIS without the reported process exit.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.