From d951b2e76b8932a48588acb0a349b6ee8982cafc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Tue, 7 Oct 2025 12:33:00 +0300 Subject: [PATCH] [libcxx] Map Windows ERROR_NETNAME_DELETED to no_such_file_or_directory This fixes spurious failures in std/input.output/filesystems/fs.op.funcs/fs.op.proximate/proximate.pass.cpp on Windows. As part of that test, libcxx tries to open a fake network path such as "//foo/a". Normally, this sets the error ERROR_BAD_NETPATH, which is mapped to no_such_file_or_directory. However occasionally, it can end up setting the error ERROR_NETNAME_DELETED instead. Map ERROR_NETNAME_DELETED to no_such_file_or_directory just like ERROR_BAD_NETPATH is mapped. This makes these cases be treated equally within the create_file_status function in src/filesystem/file_descriptor.h, causing the __weakly_canonical function in operations.cpp to keep iterating, rather than erroring out. --- libcxx/src/system_error.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libcxx/src/system_error.cpp b/libcxx/src/system_error.cpp index 164fb72621c17..6397a94932b63 100644 --- a/libcxx/src/system_error.cpp +++ b/libcxx/src/system_error.cpp @@ -95,6 +95,8 @@ std::optional __win_err_to_errc(int err) { return errc::no_lock_available; case ERROR_NEGATIVE_SEEK: return errc::invalid_argument; + case ERROR_NETNAME_DELETED: + return errc::no_such_file_or_directory; case ERROR_NOACCESS: return errc::permission_denied; case ERROR_NOT_ENOUGH_MEMORY: