Skip to content

windows: recognize reserved DOS device names before NtCreateFile - #34770

Open
robobun wants to merge 21 commits into
mainfrom
farm/620f5a19/windows-dos-device-names
Open

windows: recognize reserved DOS device names before NtCreateFile#34770
robobun wants to merge 21 commits into
mainfrom
farm/620f5a19/windows-dos-device-names

[autofix.ci] apply automated fixes

0aee1f5
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Jul 20, 2026 in 31m 10s

Code review found 2 important issues

Found 3 candidates, confirmed 3. See review comments for details.

Details

Severity Count
🔴 Important 2
🟡 Nit 1
🟣 Pre-existing 0
Severity File:Line Issue
🔴 Important src/sys/lib.rs:9984-9985 Windows unit test asserts wrong output for .foo. and foo.bar.
🟡 Nit src/sys/lib.rs:6705-6712 Trailing-dot strip runs on the raw last component, so foo.. and foo. \ escape it

Annotations

Check failure on line 9985 in src/sys/lib.rs

See this annotation in the file changed.

@claude claude / Claude Code Review

Windows unit test asserts wrong output for .foo. and foo.bar.

Two entries in this loop will fail `cargo test -p bun_sys` on Windows: `".foo."` and `"foo.bar."` strip to `.foo` / `foo.bar`, which still contain a `.`, so `classify_rel_t` sets `has_dot=true` and the bare-relative fast path at line 6802 is skipped — they resolve through `GetFinalPathNameByHandle(cwd)` and return `\Device\HarddiskVolumeN\<cwd>\.foo` / `...\foo.bar`, not the bare strings asserted here. Either drop these two entries from the verbatim loop, or assert them the way `relative_resolve

Check warning on line 6712 in src/sys/lib.rs

See this annotation in the file changed.

@claude claude / Claude Code Review

Trailing-dot strip runs on the raw last component, so foo.\. and foo. \ escape it

Minor completeness gap (not a regression): the trailing-dot/space strip inspects the raw `path[comp_start..]`, so an input whose last raw component is empty or all-dot — e.g. `"foo.\\."` or `"foo. \\"` — sees `rposition` return `None`, skips the strip, and then `normalize_string_generic_tz` resolves the `.`/trailing sep afterwards, leaving `foo.` / `foo. ` to reach `NtCreateFile`. Win32 canonicalizes first and strips second, so `CreateFileW` on the same inputs creates `foo`. Contrived enough not