Open diinngg opened 6 months ago
See https://github.com/diinngg/STL/commit/87e9619bd66fcf46266fc0d27027630a0d072be6 for an example fix, though it's mostly untested
We talked about this at the weekly maintainer meeting and we want to follow up with the Windows team to see whether we should actually support pipes with backslashes in their names, or if they need to fix the API to properly reject this as documented.
Describe the bug
Attempting to use
directory_iterator
orrecursive_directory_iterator
with the path\\\\.\\pipe
(to list named pipes) can produce invalid paths. It seems that although the documentation states that pipe names can't include backslashes, this isn't actually enforced. If a pipe under\\\\.\\pipe\\
does include a backslash in its name then_Dir_enum_impl::_Refresh
only replaces the previous pipe name from the last backslash onwards, producing paths like"\\\\.\\pipe\\Winsock2\\Winsock2\\Winsock2\\Winsock2\\Winsock2\\Winsock2\\Winsock2\\def"
, where a previously found pipe was named"\\\\.\\pipe\\WinSock2\\abc"
.Command-line test case
Expected behavior
In the example above there should be no output, in general pipe names with backslashes should be handled correctly
STL version
Microsoft Visual Studio Professional 2022 (64-bit) - Preview Version 17.10.0 Preview 1.0
Additional context
I have no idea whether supporting
\\\\.\\pipe
withstd::filesystem
is even intended, though it would be nice