Issue 147131
Summary [libc++] Calling `std::filesystem::canonical` on ramdisks throws an exception on Windows
Labels libc++
Assignees
Reporter wepavos293
    Calling `std::filesystem::canonical` on paths located on ramdisk throws `std::__1::__fs::filesystem::filesystem_error`. It's caused by internal call to `GetFinalPathNameByHandleW`.

The problematic call:
[posix_compat.h#L344](https://github.com/llvm/llvm-project/blob/main/libcxx/src/filesystem/posix_compat.h#L344)

A similar issue was resolved in the past by adding special handling for these cases:
[Path.inc#L384](https://github.com/llvm/llvm-project/blob/main/llvm/lib/Support/Windows/Path.inc#L384)

**Reproduction Steps:**

1. Create a ramdisk using software like ImDisk.
2. Compile and run the following code on the ramdisk:
```
#include <filesystem>
#include <iostream>

int main(){
	std::cout << std::filesystem::canonical(std::filesystem::current_path()) << std::endl; 
	return 0;
}
```

Sorry for posting from a burner account, GitHub now enforces 2FA for accounts interacting with high-impact projects.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to