-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
Labels
fsIssues and PRs related to the fs subsystem / file system.Issues and PRs related to the fs subsystem / file system.windowsIssues and PRs related to the Windows platform.Issues and PRs related to the Windows platform.
Description
Version
v20.15.1
Platform
Microsoft Windows NT 10.0.19045.0 x64
Subsystem
No response
What steps will reproduce the bug?
const disk = require('fs').openSync('\\\\.\\PhysicalDrive2', fs.constants.O_RDWR)
How often does it reproduce? Is there a required condition?
every call
What is the expected behavior? Why is that the expected behavior?
open disk for RW, no error
What do you see instead?
Error: EIO: i/o error, open '\\.\PhysicalDrive2\'
at Object.openSync (node:fs:573:18)
at Object.<anonymous> (***)
at Module._compile (node:internal/modules/cjs/loader:1358:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
at Module.load (node:internal/modules/cjs/loader:1208:32)
at Module._load (node:internal/modules/cjs/loader:1024:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
at node:internal/main/run_main_module:28:49 {
errno: -4070,
code: 'EIO',
syscall: 'open',
path: '\\\\.\\PhysicalDrive2\\'
}
Node.js v20.15.1
Additional information
I think the problem is in the call of getValidatedPath()
or pathModule.toNamespacedPath()
in the openSync()
implementation, which adds an additional backslash to the path, because the error looks like error, open '\\.\PhysicalDrive2\'
. Using
node --expose-internals
const { internalBinding, primordials } = require('internal/test/binding')
const binding = internalBinding('fs');
const { stringToFlags } = require('internal/fs/utils');
const { parseFileMode } = require('internal/validators');
const disk = binding.open('\\\\.\\PhysicalDrive2', stringToFlags(fs.constants.O_RDWR), parseFileMode(undefined, 'mode', 0o666),);
it works.
Metadata
Metadata
Assignees
Labels
fsIssues and PRs related to the fs subsystem / file system.Issues and PRs related to the fs subsystem / file system.windowsIssues and PRs related to the Windows platform.Issues and PRs related to the Windows platform.