public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "tomas.kalibera at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug other/115189] libiberty introduces UNC paths waking up binutils bug
Date: Mon, 27 May 2024 13:10:37 +0000	[thread overview]
Message-ID: <bug-115189-4-JbsAitbQpv@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-115189-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #8 from Tomas Kalibera <tomas.kalibera at gmail dot com> ---
(In reply to Bill Zissimopoulos from comment #4)

> A more robust alternative to GetFinalPathNameByHandleW/VOLUME_NAME_DOS may
> be the following:
> 
> - Use GetFinalPathNameByHandleW with VOLUME_NAME_NORMALIZED|VOLUME_NAME_NT.
> 
> - Enumerate all available drives for the current process using
> GetLogicalDrives.
> 
> - For each logical drive use QueryDosDeviceW to see if the returned prefix
> matches the NT namespace prefix returned by the earlier call to
> GetFinalPathNameByHandleW.
> 
> For an example of this approach see the chromium code here:
> 
> https://chromium.googlesource.com/chromium/src/base/+/master/files/
> file_util_win.cc#828
> 
> (See functions NormalizeFilePath and DevicePathToDriveLetterPath.)

I am not sure how this would work. On my system, I get a number of different NT
namespace prefixes from QueryDosDevice:

(1) \??\UNC\tsclient\share
(2) \??\UNC\192.168.0.45\share
(3) \Device\LanmanRedirector\;Y:0000000001189cc1\192.168.0.45\share
(4) \Device\RdpDr\;Z:2\tsclient\share

the forms of (1),(2) are with "subst". The form of (3) is when using Explorer
on a real samba drive (also "net use"). The form of (4) is when using Explorer
on an RDP share (also "net use").

But, GetFinalPathNameByHandle() returns prefixes in a yet different form:

(A) /Device/Mup/192.168.0.45/share
(B) /Device/Mup/tsclient/share

where (A) is for a real samba drive and (B) for the RDP share.

So, simply matching the prefix (whether the result of QueryDosDevice() is a
prefix of the result of GetFinalPathNameByHandle) probably wouldn't work?

      parent reply	other threads:[~2024-05-27 13:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-22 14:19 [Bug other/115189] New: " tomas.kalibera at gmail dot com
2024-05-22 20:55 ` [Bug other/115189] " pinskia at gcc dot gnu.org
2024-05-23  6:56 ` rguenth at gcc dot gnu.org
2024-05-23 18:11 ` tomas.kalibera at gmail dot com
2024-05-26 12:29 ` gnu.org at billz dot fastmail.fm
2024-05-27 10:04 ` tomas.kalibera at gmail dot com
2024-05-27 10:42 ` gnu.org at billz dot fastmail.fm
2024-05-27 12:47 ` tomas.kalibera at gmail dot com
2024-05-27 13:10 ` tomas.kalibera at gmail dot com [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-115189-4-JbsAitbQpv@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).