https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97813
Bug ID: 97813 Summary: std::filesystem::equivalent returning incorrect results on MinGW due to symlinks Product: gcc Version: 10.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: markus.boeck02 at gmail dot com Target Milestone: --- Given two std::filesystem::path that are identical except for maybe spelling std::filesystem::equivalent will fail if the path is a or a subdirectory of a symlink. This is due to the use of _wstat. Microsoft states here: https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2013/14h5k7ff(v=vs.120) that _wstat does not work with symlinks. Using stat would be possible but converting to a multibyte coding seems dirty and could lead to localization issues I believe? There is a forum discussion here that I read through as well. http://gtk.10911.n7.nabble.com/wstat-on-Windows-actually-stat-stuff-in-general-td19965.html It seems like the best way of working around this is to not use _wstat on Windows, wherever possible. I saw in the implementation of equivalent that additional code for windows already exists that opens the files and compares Fileinformation. Maybe this could be used instead on Windows?