[Bug libstdc++/87846] std::filesystem::create_directories with a path with a trailing slash does not create any directory

2022-02-08 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87846

--- Comment #6 from Jonathan Wakely  ---
Actually no, it's fine, the relevant test fails because exists("foo/") fails,
due to PR 1, and *that* isn't fixed for the experimental TS.

[Bug libstdc++/87846] std::filesystem::create_directories with a path with a trailing slash does not create any directory

2022-02-08 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87846

--- Comment #5 from Jonathan Wakely  ---
N.B. the experimental::filesystem::create_directories function still has this
problem on Windows, but the TS support on Windows is minimal anyway. I'm not
going to fix it at this time.

[Bug libstdc++/87846] std::filesystem::create_directories with a path with a trailing slash does not create any directory

2019-02-08 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87846

Jonathan Wakely  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #4 from Jonathan Wakely  ---
This will be fixed in GCC 8.3

[Bug libstdc++/87846] std::filesystem::create_directories with a path with a trailing slash does not create any directory

2019-02-08 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87846

--- Comment #3 from Jonathan Wakely  ---
Author: redi
Date: Fri Feb  8 12:20:22 2019
New Revision: 268685

URL: https://gcc.gnu.org/viewcvs?rev=268685&root=gcc&view=rev
Log:
PR libstdc++/86910 fix filesystem::create_directories

Implement the proposed semantics from P1164R0, which reverts the changes
of LWG 2935. This means that failure to create a directory because a
non-directory already exists with that name will be reported as an
error.

While rewriting the function, also fix PR 87846, which is a result of
the C++17 changes to how a trailing slash on a path affects the last
component of a path.

Backport from mainline
2018-11-29  Jonathan Wakely  

PR libstdc++/86910
PR libstdc++/87846
* src/filesystem/ops.cc (experimental::create_directories): Report
an error when the path resolves to an existing non-directory (P1164).
* src/filesystem/std-ops.cc (create_directories): Likewise. Handle
empty filenames due to trailing slashes.
* testsuite/27_io/filesystem/operations/create_directories.cc: Test
when some component of the path exists and is not a directory. Test
trailing slashes.
* testsuite/experimental/filesystem/operations/create_directories.cc:
Likewise.

Modified:
branches/gcc-8-branch/libstdc++-v3/ChangeLog
branches/gcc-8-branch/libstdc++-v3/src/filesystem/ops.cc
branches/gcc-8-branch/libstdc++-v3/src/filesystem/std-ops.cc
   
branches/gcc-8-branch/libstdc++-v3/testsuite/27_io/filesystem/operations/create_directories.cc
   
branches/gcc-8-branch/libstdc++-v3/testsuite/experimental/filesystem/operations/create_directories.cc

[Bug libstdc++/87846] std::filesystem::create_directories with a path with a trailing slash does not create any directory

2018-11-28 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87846

--- Comment #2 from Jonathan Wakely  ---
Author: redi
Date: Thu Nov 29 00:39:37 2018
New Revision: 266598

URL: https://gcc.gnu.org/viewcvs?rev=266598&root=gcc&view=rev
Log:
PR libstdc++/86910 fix filesystem::create_directories

Implement the proposed semantics from P1164R0, which reverts the changes
of LWG 2935. This means that failure to create a directory because a
non-directory already exists with that name will be reported as an
error.

While rewriting the function, also fix PR 87846, which is a result of
the C++17 changes to how a trailing slash on a path affects the last
component of a path.

PR libstdc++/86910
PR libstdc++/87846
* src/filesystem/ops.cc (experimental::create_directories): Report
an error when the path resolves to an existing non-directory (P1164).
* src/filesystem/std-ops.cc (create_directories): Likewise. Handle
empty filenames due to trailing slashes.
* testsuite/27_io/filesystem/operations/create_directories.cc: Test
when some component of the path exists and is not a directory. Test
trailing slashes.
* testsuite/experimental/filesystem/operations/create_directories.cc:
Likewise.

Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/src/filesystem/ops.cc
trunk/libstdc++-v3/src/filesystem/std-ops.cc
   
trunk/libstdc++-v3/testsuite/27_io/filesystem/operations/create_directories.cc
   
trunk/libstdc++-v3/testsuite/experimental/filesystem/operations/create_directories.cc

[Bug libstdc++/87846] std::filesystem::create_directories with a path with a trailing slash does not create any directory

2018-11-28 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87846

--- Comment #1 from Jonathan Wakely  ---
The implementation of create_directories worked for the Filesystem TS but I
didn't update it to cope with the different C++17 semantics for a trailing
slash. The empty filename at the end of the path confused the function into
thinking it didn't need to create anything.

[Bug libstdc++/87846] std::filesystem::create_directories with a path with a trailing slash does not create any directory

2018-11-28 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87846

Jonathan Wakely  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2018-11-28
   Assignee|unassigned at gcc dot gnu.org  |redi at gcc dot gnu.org
   Target Milestone|--- |8.3
 Ever confirmed|0   |1