fix(runtime): normalize Windows workspace paths - #3286
Conversation
Keep extended-length and regular Windows paths comparable when enforcing workspace boundaries, including first-run roots that cannot yet be canonicalized. Add regression coverage for DOS and UNC path forms. Signed-off-by: Suliman Abdulrazzaq <suliman9000a@gmail.com>
|
Nice catch on the \\?\ prefix. One edge case worth confirming: does this also handle \\.\ device namespace paths (e.g. \\.\C:\foo)? Those can appear when calling GetFullPathName without the FILE_FLAG_OPEN_REPARSE_POINT flag on symlinks/junctions. Also, short (8.3) name normalization via GetLongPathName may be relevant for paths coming from legacy tooling. |
|
Confirmed - I've hit this on Windows too: some APIs hand back paths with the \?\ prefix while the workspace root is stored without it, so the boundary check falsely reports escapes. Normalizing both forms before comparison is the right approach, and covering DOS/UNC variants in regression tests is good. One thing worth checking: Windows path comparisons should also be case-insensitive - make sure the normalized comparison doesn't regress on case differences (e.g. C:\Users vs c:\users). |
Summary
\\?\) and regular path representations before enforcing workspace boundaries.Fixes #3278
Anti-slop triage
Verification
cargo fmt --manifest-path rust/Cargo.toml --all -- --checkgit diff --checkcargo +stable-x86_64-pc-windows-gnu check --manifest-path rust/Cargo.toml --target x86_64-pc-windows-gnu -p runtimecargo +stable-x86_64-pc-windows-gnu clippy --manifest-path rust/Cargo.toml --target x86_64-pc-windows-gnu -p runtime --lib(completed with existing warnings outside this change)std::os::unix::fs::PermissionsExttests; the default MSVC toolchain also lackslink.exein this environment.Resolution gate