[PATCH 1/2] libstdc++: Support UNC paths on MinGW in fs::path
Karl Ljungkvist
karl@kalj.se
Sun Nov 22 19:03:04 GMT 2026
Hi,
This is to bump this for review. PR 99333 also affects OpenSCAD where a
workaround has been done
(https://github.com/openscad/openscad/pull/7222). So it would be great
if this could be fixed.
I've tested the fix and it solves the issue. I have some comments though:
- The gnu.ver hunk no longer applies (GCC 16 already uses
GLIBCXX_3.4.35). The rest applies cleanly to master.
- operator+= now strips two characters from any root-name in the
appended path, including "C:": path("dir\\") += path("C:file") gives
components {dir} {} {file}. Checking is_dir_sep(s[0]) first would
avoid that.
- "\/server" isn't recognized as a root-name, because root_path()
requires input[1] == input[0]. MSVC accepts mixed separators.
- Jonathan: is the new exported _M_is_unc_path() wanted? Without it, a
bare "\\server" is relative, but "\\server\share\..." is still
absolute.
My testing was done on a GitHub runner (windows-latest, MSYS2 GCC
16.2.0, UCRT64 and MINGW64,
https://github.com/kalj/congenial-tribble/actions/runs/44894793307). No
regressions, and the new tests pass. On a real SMB share, is_absolute()
is now true and absolute() leaves the path unchanged (it used to give
"D:\localhost\..."). canonical() still fails on MINGW64, but that looks
like PR 99311 rather than this patch. It's
not a full bootstrap.
I include a patch for some additional tests (implemented with help from
Claude Code as indicated in the patch). These test +=, lexically_normal
and lexically_relative, the \\?\ and \\.\ prefixes, and absolute(). They
pass with your fix and fail without it. Feel free to include them.
Claude was also used during the investigation.
I'd be happy to test an updated version too.
Regards,
Karl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-libstdc-Add-more-tests-for-UNC-paths-on-Windows-PR99333.patch
Type: text/x-patch
Size: 5476 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20261122/19a4ab35/attachment.bin>
More information about the Libstdc++
mailing list