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

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Thu Jan 17 15:31:59 2019
New Revision: 268034

URL: https://gcc.gnu.org/viewcvs?rev=268034&root=gcc&view=rev
Log:
PR libstdc++/88881 adjust filesystem::status and tests for mingw semantics

On Windows stat("foo/bar/../.") will resolve to "foo" even if that is a
non-directory and "foo/bar" does not exist. This is the expected
behaviour and consistent with boost::filesystem, so don't try to correct
it. The only unwanted behaviour is that stat("baz/") fails due to a
mingw bug (fixed in mingw-w64 v6.0.0) so add a workaround.

        PR libstdc++/88881
        * src/c++17/fs_ops.cc (canonical(const path&, error_code&))
        [_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Normalize path, to match behaviour
        of filesystem::exists.
        (create_directories(const path&, error_code&)): Add assertions.
        (status(const path&, error_code&)) [_GLIBCXX_FILESYSTEM_IS_WINDOWS]:
        Add workaround for bug in _wstat for paths with trailing slash.
        * testsuite/27_io/filesystem/operations/create_directories.cc: Adjust
        for expected behaviour on mingw.
        * testsuite/experimental/filesystem/operations/create_directories.cc:
        Likewise.
        * testsuite/27_io/filesystem/operations/temp_directory_path.cc: Use
        "TMP" instead of "TMPDIR" and clean environment before each test. Do
        not test permissions on mingw targets.

Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/src/c++17/fs_ops.cc
   
trunk/libstdc++-v3/testsuite/27_io/filesystem/operations/create_directories.cc
   
trunk/libstdc++-v3/testsuite/27_io/filesystem/operations/temp_directory_path.cc
   
trunk/libstdc++-v3/testsuite/experimental/filesystem/operations/create_directories.cc

Reply via email to