bun icon indicating copy to clipboard operation
bun copied to clipboard

[win][fs] `path.toNamespacedPath` does nothing

Open AlttiRi opened this issue 5 months ago • 1 comments

What version of Bun is running?

1.0.23

What platform is your computer?

Window 10

What steps can reproduce the bug?

import path from "node:path";

const fp1 = "C:\\Downloads\\bun-windows-x64\\bun.exe";
const fp2 = "bun.exe";
const fp3 = "\\\\KEENETIC\\USB";
const fp4 = "\\\\KEENETIC\\USB\\A";
console.log(path.toNamespacedPath(fp1));
console.log(path.toNamespacedPath(fp2));
console.log(path.toNamespacedPath(fp2) === "\\\\?\\" + path.resolve(fp2));
console.log(path.toNamespacedPath(fp3));
console.log(path.toNamespacedPath(fp4));

What is the expected behavior?

\\?\C:\Downloads\bun-windows-x64\bun.exe
\\?\C:\Downloads\bun-windows-x64\bun.exe
true                               
\\?\UNC\KEENETIC\USB\
\\?\UNC\KEENETIC\USB\A

What do you see instead?

C:\Downloads\bun-windows-x64\bun.exe
bun.exe
false
\\KEENETIC\USB
\\KEENETIC\USB\A

Additional information

Rel:

  • https://github.com/oven-sh/bun/issues/8246
  • https://github.com/oven-sh/bun/issues/8836
  • https://github.com/oven-sh/bun/issues/8248

AlttiRi avatar Jan 18 '24 04:01 AlttiRi

Context: https://nodejs.org/api/path.html#pathtonamespacedpathpath https://github.com/oven-sh/bun/blob/c21dc25a6546f0b74af62f4826fcf2a494805882/src/bun.js/bindings/Path.cpp#L125-L127

See zig's wToPrefixedFileW

jdalton avatar Jan 22 '24 23:01 jdalton

Fixed in #8469

paperdave avatar Feb 13 '24 21:02 paperdave