public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "moritz at bunkus dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/99430] New: std::filesystem::path: UNC device paths with \\?\… not supported properly
Date: Sat, 06 Mar 2021 16:11:51 +0000	[thread overview]
Message-ID: <bug-99430-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 99430
           Summary: std::filesystem::path: UNC device paths with \\?\… not
                    supported properly
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: moritz at bunkus dot org
  Target Milestone: ---

Created attachment 50317
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50317&action=edit
test case highlighting the issue

Paths such as \\?\C:\WINDOWS or \\?\UNC\LOCALHOST\c$\WINDOWS don't work
properly with std::filesystem::path (e.g. exists() & is_directory() return
false).

According to Microsoft's documentation those are valid.[1]

The corresponding variants starting with \\.\ seem to fare better (safe for the
root name & absolute issues, but I've filed 99333 for that already).

boost::filesystem works fine with all of these paths.

The attached sample program outputs the following, showing how Boost's & std's
implementation differ:

-----------------------------------------
std::filesystem::path for \\?\C:\WINDOWS
  is_aboslute 0
  has_root_path 1
  has_root_name 0
  exists 0
  is_directory 0
boost::filesystem::path for \\?\C:\WINDOWS
  is_aboslute 1
  has_root_path 1
  has_root_name 1
  exists 1
  is_directory 1
std::filesystem::path for \\?\UNC\localhost\c$\WINDOWS
  is_aboslute 0
  has_root_path 1
  has_root_name 0
  exists 0
  is_directory 0
boost::filesystem::path for \\?\UNC\localhost\c$\WINDOWS
  is_aboslute 1
  has_root_path 1
  has_root_name 1
  exists 1
  is_directory 1
std::filesystem::path for \\.\C:\WINDOWS
  is_aboslute 0
  has_root_path 1
  has_root_name 0
  exists 1
  is_directory 1
boost::filesystem::path for \\.\C:\WINDOWS
  is_aboslute 1
  has_root_path 1
  has_root_name 1
  exists 1
  is_directory 1
std::filesystem::path for \\.\UNC\localhost\c$\WINDOWS
  is_aboslute 0
  has_root_path 1
  has_root_name 0
  exists 1
  is_directory 1
boost::filesystem::path for \\.\UNC\localhost\c$\WINDOWS
  is_aboslute 1
  has_root_path 1
  has_root_name 1
  exists 1
  is_directory 1
-----------------------------------------

gcc mingw 10.2.0 from MXE (cross-compiling from Linux to Windows), Boost 1.74.0

[1] https://docs.microsoft.com/en-us/dotnet/standard/io/file-path-formats

             reply	other threads:[~2021-03-06 16:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-06 16:11 moritz at bunkus dot org [this message]
2021-03-07 16:33 ` [Bug libstdc++/99430] " redi at gcc dot gnu.org

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-99430-4@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).