在 2023/3/28 10:49, LIU Hao 写道:
According to Microsoft documentation about paths, which I linked yesterday, the `\\host\share` part
is the name of a volume, so I think only the CMD behavior is right: `dirname()` should not remove `..` which would move to a different volume. And here is the alternative patch.

I had some discussion with Corinna Vinschen about these implementation details: The behavior of Cygwin about `\\host` is emulated, so it looks like Explorer. Our conclusion is that `\\host\` without a share name is not a valid UNC path.

So far the question is all about whether `dirname()` is allowed to remove the shared name from a UNC path. I suspect not, mainly due to the following reasons:

1. `\\host` is valid for Cygwin because of the aforementioned emulation. It is
   however not a valid path for mingw-w64, and `dirname()` should not provide
   invalid paths.
2. As its consequence, `basename("\\host\share")` would yield `share` as if
   it was a directory. It is not.
3. It would be confusing that `dirname("\\host\share")` and `"\\host\share\.."`
   do not designate the same location. [Note in the latest patch
   `basename("\\host\share")` yields `"\"`.]


--
Best regards,
LIU Hao
I

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to