[committed] libstdc++: Fix create_directories to resolve symlinks [PR101510]

Jonathan Wakely jwakely@redhat.com
Tue Jul 20 19:36:49 GMT 2021


On 20/07/21 12:59 +0100, Jonathan Wakely wrote:
>Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
>
>libstdc++-v3/ChangeLog:
>
>	PR libstdc++/101510
>	* src/c++17/fs_ops.cc (create_dir): Adjust whitespace.
>	* testsuite/27_io/filesystem/operations/create_directory.cc:
>	Test creating directory with name of existing symlink to
>	directory.
>	* testsuite/experimental/filesystem/operations/create_directory.cc:
>	Likewise.
>

It turned out this bug report wasn't actually about create_directory,
but create_directories, which does have a bug.

     When filesystem__create_directories checks to see if the path already
     exists and resovles to a directory, it uses filesystem::symlink_status,
     which means it reports an error if the path is a symlink. It should use
     filesystem::status, so that the target directory is detected, and no
     error is reported.
     
     Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
     
     libstdc++-v3/ChangeLog:
     
             PR libstdc++/101510
             * src/c++17/fs_ops.cc (fs::create_directories): Use status
             instead of symlink_status.
             * src/filesystem/ops.cc (fs::create_directories): Likewise.
             * testsuite/27_io/filesystem/operations/create_directories.cc:
             * testsuite/27_io/filesystem/operations/create_directory.cc: Do
             not test with symlinks on Windows.
             * testsuite/experimental/filesystem/operations/create_directories.cc:
             * testsuite/experimental/filesystem/operations/create_directory.cc:
             Do not test with symlinks on Windows.


Tested powerpc64le-linux. Committed to trunk.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 5962 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20210720/95005f65/attachment.bin>


More information about the Libstdc++ mailing list