public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/106127] New: experimental::filesystem::path("//") should be a root-directory not a root-name
@ 2022-06-28 20:40 redi at gcc dot gnu.org
  2022-06-28 20:47 ` [Bug libstdc++/106127] " redi at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2022-06-28 20:40 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106127
           Summary: experimental::filesystem::path("//") should be a
                    root-directory not a root-name
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

Our Filesystem TS implementation treats // the same as //x which is probably
wrong.

It causes experimental/filesystem/operations/absolute.cc to FAIL on Windows,
because absolute(path("//"), "z:\\tmp") returns "//\\tmp" which is a root-name.
(On the other hand, the specification for experimental::filesystem::absolute is
known to be broken for Windows, and was completely changed for C++17).

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

* [Bug libstdc++/106127] experimental::filesystem::path("//") should be a root-directory not a root-name
  2022-06-28 20:40 [Bug libstdc++/106127] New: experimental::filesystem::path("//") should be a root-directory not a root-name redi at gcc dot gnu.org
@ 2022-06-28 20:47 ` redi at gcc dot gnu.org
  2024-01-24 23:56 ` pinskia at gcc dot gnu.org
  2024-01-24 23:57 ` [Bug libstdc++/106127] experimental::filesystem::path("//") should be a root-directory not a root-name (experimental/filesystem/operations/absolute.cc) pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2022-06-28 20:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This patch:

--- a/libstdc++-v3/src/filesystem/path.cc
+++ b/libstdc++-v3/src/filesystem/path.cc
@@ -377,7 +377,7 @@ path::_M_split_cmpts()
          if (len == 2)
            {
              // entire path is just "//"
-             _M_type = _Type::_Root_name;
+             _M_type = _Type::_Root_dir;
              return;
            }

fixes the absolute.cc test on Windows and causes only one new FAIL (on all
targets):

/home/jwakely/src/gcc/gcc/libstdc++-v3/testsuite/experimental/filesystem/path/decompose/root_directory.cc:52:
void test02(): Assertion 'rootdir.string()[0] != '/'' failed.
FAIL: experimental/filesystem/path/decompose/root_directory.cc execution test

The test seems questionable anyway:

void
test02()
{
  for (const path p : __gnu_test::test_paths)
  {
    path rootdir = p.root_directory();
    // If root-directory is composed of 'slash name',
    // 'slash' is excluded from the returned string.
    if (!rootdir.empty() && rootdir.string() != "/")
      VERIFY( rootdir.string()[0] != '/' );
  }
}

This fails with the change because "//" behaves the same as "/" and so still
has a leading slash.

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

* [Bug libstdc++/106127] experimental::filesystem::path("//") should be a root-directory not a root-name
  2022-06-28 20:40 [Bug libstdc++/106127] New: experimental::filesystem::path("//") should be a root-directory not a root-name redi at gcc dot gnu.org
  2022-06-28 20:47 ` [Bug libstdc++/106127] " redi at gcc dot gnu.org
@ 2024-01-24 23:56 ` pinskia at gcc dot gnu.org
  2024-01-24 23:57 ` [Bug libstdc++/106127] experimental::filesystem::path("//") should be a root-directory not a root-name (experimental/filesystem/operations/absolute.cc) pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-24 23:56 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 113589 has been marked as a duplicate of this bug. ***

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

* [Bug libstdc++/106127] experimental::filesystem::path("//") should be a root-directory not a root-name (experimental/filesystem/operations/absolute.cc)
  2022-06-28 20:40 [Bug libstdc++/106127] New: experimental::filesystem::path("//") should be a root-directory not a root-name redi at gcc dot gnu.org
  2022-06-28 20:47 ` [Bug libstdc++/106127] " redi at gcc dot gnu.org
  2024-01-24 23:56 ` pinskia at gcc dot gnu.org
@ 2024-01-24 23:57 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-24 23:57 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|experimental::filesystem::p |experimental::filesystem::p
                   |ath("//") should be a       |ath("//") should be a
                   |root-directory not a        |root-directory not a
                   |root-name                   |root-name
                   |                            |(experimental/filesystem/op
                   |                            |erations/absolute.cc)
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2024-01-24
     Ever confirmed|0                           |1

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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-28 20:40 [Bug libstdc++/106127] New: experimental::filesystem::path("//") should be a root-directory not a root-name redi at gcc dot gnu.org
2022-06-28 20:47 ` [Bug libstdc++/106127] " redi at gcc dot gnu.org
2024-01-24 23:56 ` pinskia at gcc dot gnu.org
2024-01-24 23:57 ` [Bug libstdc++/106127] experimental::filesystem::path("//") should be a root-directory not a root-name (experimental/filesystem/operations/absolute.cc) pinskia at gcc dot gnu.org

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).