[PATCH v4] libstdc++: Add symlink support on Windows
Jonathan Wakely
jwakely@redhat.com
Wed Mar 4 16:13:58 GMT 2026
On Mon, 16 Feb 2026 at 22:42, Adam Wood <adam.wood@mines.sdsmt.edu> wrote:
>
> Tested on x86_64-w64-mingw32 on Windows 11.
>
> The changes in v4 make sure the new symlink functions are only defined/enabled
> on versions of Windows with symlink support.
>
> Because path resolution may be different between Windows and POSIX when a
> dotdot follows a symlink, I also made some edits to tests involving that
> specific case. I removed my changes to fs::absolute and
> fs::canonical because I was misplaced and was trying to force Windows to
> act like POSIX in that specific case.
>
> Finally, I dealt with the issue that creating symlinks with the unprivileged
> flag returns an error in earlier versions of Windows by just trying again
> if ERROR_INVALID_PARAMETER occurs without the unpriviledged flag. This
> is how MSVC STL does it as well.
>
> The patch does not support junctions or mount points.
Hi Adam,
Thanks for the new patch. I'm still reviewing it, but I see these
tests failing using a mingw-w64 cross compiler and testing under Wine:
/home/jwakely/src/gcc/gcc/libstdc++-v3/testsuite/27_io/filesystem/operations/copy_symlink/1.cc:27:
void test_successful_copy(const std::filesystem::__cxx11::path&, bool
(*)(const std::filesystem::__cxx11::path&)): Assertion
'is_some_file_type(p2)' failed.
FAIL: /home/jwakely/src/gcc/gcc/libstdc++-v3/testsuite/27_io/filesystem/operations/copy_symlink/1.cc
/home/jwakely/src/gcc/gcc/libstdc++-v3/testsuite/27_io/filesystem/operations/symlink_status.cc:36:
void test01(): Assertion 'st1.type() == fs::file_type::directory'
failed.
FAIL: /home/jwakely/src/gcc/gcc/libstdc++-v3/testsuite/27_io/filesystem/operations/symlink_status.cc
Do these PASS for you on real Windows?
More information about the Libstdc++
mailing list