Bug
library/std/src/sys/fs/windows.rs junction_point creates a real directory (create_new) before FSCTL_SET_REPARSE_POINT. On path-conversion failure or DeviceIoControl failure, it returns Err but does not remove the empty directory. Callers retrying get AlreadyExists; the path is not a junction.
Combined with #263 (uninit substitute-name NUL in the reparse buffer), failed creates are more likely.
Impact
Orphan empty directories; broken retry behavior; non-junction path left behind.
Origin
| Lines |
Commit |
Date |
Author |
| 1636-1712 (create-then-reparse, no rollback) |
d6945f6d8c1 |
2025-07-17 |
ltdk |
Suggested fix
On error after create: drop the handle, best-effort RemoveDirectoryW/rmdir on link. Also write the substitute-name terminating NUL (#263).
Bug
library/std/src/sys/fs/windows.rsjunction_pointcreates a real directory (create_new) beforeFSCTL_SET_REPARSE_POINT. On path-conversion failure orDeviceIoControlfailure, it returnsErrbut does not remove the empty directory. Callers retrying getAlreadyExists; the path is not a junction.Combined with #263 (uninit substitute-name NUL in the reparse buffer), failed creates are more likely.
Impact
Orphan empty directories; broken retry behavior; non-junction path left behind.
Origin
d6945f6d8c1Suggested fix
On error after create: drop the handle, best-effort
RemoveDirectoryW/rmdironlink. Also write the substitute-name terminating NUL (#263).