public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/97813] New: std::filesystem::equivalent returning incorrect results on MinGW due to symlinks
@ 2020-11-12 14:30 markus.boeck02 at gmail dot com
  2020-11-12 14:32 ` [Bug libstdc++/97813] " redi at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: markus.boeck02 at gmail dot com @ 2020-11-12 14:30 UTC (permalink / raw)
  To: gcc-bugs

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?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libstdc++/97813] std::filesystem::equivalent returning incorrect results on MinGW due to symlinks
  2020-11-12 14:30 [Bug libstdc++/97813] New: std::filesystem::equivalent returning incorrect results on MinGW due to symlinks markus.boeck02 at gmail dot com
@ 2020-11-12 14:32 ` redi at gcc dot gnu.org
  2024-01-29 17:40 ` lennoxhoe at gmail dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2020-11-12 14:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97813

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-11-12
             Status|UNCONFIRMED                 |NEW
             Target|                            |*-*-mingw*
     Ever confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
We don't currently support symlinks on Windows. There's a lot more than just
equivalent that needs to change to support them.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libstdc++/97813] std::filesystem::equivalent returning incorrect results on MinGW due to symlinks
  2020-11-12 14:30 [Bug libstdc++/97813] New: std::filesystem::equivalent returning incorrect results on MinGW due to symlinks markus.boeck02 at gmail dot com
  2020-11-12 14:32 ` [Bug libstdc++/97813] " redi at gcc dot gnu.org
@ 2024-01-29 17:40 ` lennoxhoe at gmail dot com
  2024-01-29 20:15 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: lennoxhoe at gmail dot com @ 2024-01-29 17:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97813

Lennox Ho <lennoxhoe at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lennoxhoe at gmail dot com

--- Comment #2 from Lennox Ho <lennoxhoe at gmail dot com> ---
> We don't currently support symlinks on Windows.
> There's a lot more than just equivalent that needs to change to support them.

Hi Jonathan, can you elaborate on this?
Is this a simple matter of nobody has bothered to implement this, or are there
blocking issues?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libstdc++/97813] std::filesystem::equivalent returning incorrect results on MinGW due to symlinks
  2020-11-12 14:30 [Bug libstdc++/97813] New: std::filesystem::equivalent returning incorrect results on MinGW due to symlinks markus.boeck02 at gmail dot com
  2020-11-12 14:32 ` [Bug libstdc++/97813] " redi at gcc dot gnu.org
  2024-01-29 17:40 ` lennoxhoe at gmail dot com
@ 2024-01-29 20:15 ` redi at gcc dot gnu.org
  2024-01-29 20:28 ` redi at gcc dot gnu.org
  2024-01-29 23:44 ` lennoxhoe at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2024-01-29 20:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97813

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Nobody has even tried to implement symlink support, so I have no idea if there
are any blocking issues. It's probably just a case of somebody doing the work.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libstdc++/97813] std::filesystem::equivalent returning incorrect results on MinGW due to symlinks
  2020-11-12 14:30 [Bug libstdc++/97813] New: std::filesystem::equivalent returning incorrect results on MinGW due to symlinks markus.boeck02 at gmail dot com
                   ` (2 preceding siblings ...)
  2024-01-29 20:15 ` redi at gcc dot gnu.org
@ 2024-01-29 20:28 ` redi at gcc dot gnu.org
  2024-01-29 23:44 ` lennoxhoe at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2024-01-29 20:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97813

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
For example, filesystem::is_symlink doesn't work on Windows, and
create_symlink, and create_directory_symlink etc. etc.

So we could make equivalent work, but that's just a small part of what's
missing.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libstdc++/97813] std::filesystem::equivalent returning incorrect results on MinGW due to symlinks
  2020-11-12 14:30 [Bug libstdc++/97813] New: std::filesystem::equivalent returning incorrect results on MinGW due to symlinks markus.boeck02 at gmail dot com
                   ` (3 preceding siblings ...)
  2024-01-29 20:28 ` redi at gcc dot gnu.org
@ 2024-01-29 23:44 ` lennoxhoe at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: lennoxhoe at gmail dot com @ 2024-01-29 23:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97813

--- Comment #5 from Lennox Ho <lennoxhoe at gmail dot com> ---
Thanks for the insight.

I think the only potential blocker would be CreateSymbolicLinkW requires at
least Vista/WinSer2008.
I'm not able to figure out MinGW (or at least mingw-w64)'s OS requirements.

I might look into contributing a patch to enable Windows symlink support
sometime in the future.

In the meantime, I have a patch for std::filesytem::hard_link_count for
Windows.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113663

Thanks

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-01-29 23:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-12 14:30 [Bug libstdc++/97813] New: std::filesystem::equivalent returning incorrect results on MinGW due to symlinks markus.boeck02 at gmail dot com
2020-11-12 14:32 ` [Bug libstdc++/97813] " redi at gcc dot gnu.org
2024-01-29 17:40 ` lennoxhoe at gmail dot com
2024-01-29 20:15 ` redi at gcc dot gnu.org
2024-01-29 20:28 ` redi at gcc dot gnu.org
2024-01-29 23:44 ` lennoxhoe at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).