Closed
Description
Version
v20.9.0, v20.10.0
Platform
Microsoft Windows NT 10.0.22621.0 x64
Subsystem
fs
What steps will reproduce the bug?
Save the following script in a path that has more than 10 characters (e.g. C:\\abcdefghi
).
Then, run it.
import { resolve } from 'node:path'
import { realpath, writeFile } from 'node:fs/promises'
import { realpath as realpathCallback, realpathSync } from 'node:fs'
const p = `./test_${'a'.repeat(240)}.txt`
await writeFile(p, '')
console.log('length: ', resolve(p).length)
try {
await realpath(p)
} catch (e) {
console.log('error with fs.promises.realpath', e)
}
try {
await new Promise((res, rej) => {
realpathCallback(p, (err, resolved) => {
if (err) {
rej(err)
return
}
res(resolved)
})
})
} catch (e) {
console.log('error with fs.realpath', e)
}
try {
await new Promise((res, rej) => {
realpathCallback.native(p, (err, resolved) => {
if (err) {
rej(err)
return
}
res(resolved)
})
})
} catch (e) {
console.log('error with fs.realpath.native', e)
}
try {
realpathSync(p)
} catch (e) {
console.log('error with fs.realpathSync', e)
}
try {
realpathSync.native(p)
} catch (e) {
console.log('error with fs.realpathSync.native', e)
}
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
No error happens.
What do you see instead?
The following error happens:
error with fs.promises.realpath [Error: ENOENT: no such file or directory, realpath './test_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.txt']
Additional information
Maybe related to #50753, but running (Get-Item -Path "Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem").GetValue("LongPathsEnabled")
(in both normal mode and admin mode) returns 0
on my machine.
Also #39721 might be related.
Metadata
Metadata
Assignees
Labels
No labels
Activity