https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113589
Bug ID: 113589
Summary: FAIL: experimental/filesystem/operations/absolute.cc
on Windows
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: nightstrike at gmail dot com
Target Milestone: ---
(Probably related to PR88884)
The absolute.cc test fails this assertion:
VERIFY( absolute(p).is_absolute() );
on the second path in __gnu_test::test_paths, I think because
absolute(p).has_root_name() returns false:
```
std::cout << absolute(p) << std::endl;
std::cout << "has: " << absolute(p).has_root_name() << " " <<
absolute(p).has_root_directory() << std::endl;
VERIFY( absolute(p).is_absolute() );
```
```
spawn wine64 ./absolute.exe^M
"H:/"^M^M
has: 1 1^M^M
"//\\home\\user\\p\\gcc\\src\\gcc-git\\_w\\x86_64-w64-mingw32\\libstdc++-v3\\testsuite"^M^M
has: 0 1^M^M
```
So H:/ works, but //\\path doesn't. I guess all these extra slashes are due to
running under wine, but presumably real applications may do so.
absolute() does the following:
```
if (p.has_root_directory()) // implies !p.has_root_name()
{
// GetFullPathNameW("//") gives unwanted result (PR 88884).
// If there are multiple directory separators at the start,
// skip all but the last of them.
const auto pos = s.find_first_not_of(L"/\\");
__glibcxx_assert(pos != 0);
s.remove_prefix(std::min(s.length(), pos) - 1);
}
```
So I guess this needs to be a little bit smarter to handle Wine paths maybe?
Sorry I couldn't take this further, but I'll be happy to test a fix.