The configure test for realpath() is missing a header, and the fallback version of filesystem::canonical() that gets used if realpath() fails was not setting an error.
Tested powerpc64le-linux, committed to trunk.
commit f36dd7f817590c618884e14433dd70c03334c288 Author: Jonathan Wakely <jwak...@redhat.com> Date: Wed Oct 26 12:16:18 2016 +0100 PR78111 fix fallback code for filesystem::canonical PR libstdc++/78111 * src/filesystem/ops.cc (canonical): Set error for non-existent path. diff --git a/libstdc++-v3/src/filesystem/ops.cc b/libstdc++-v3/src/filesystem/ops.cc index 32c9c5e..9abcee0 100644 --- a/libstdc++-v3/src/filesystem/ops.cc +++ b/libstdc++-v3/src/filesystem/ops.cc @@ -142,7 +142,11 @@ fs::canonical(const path& p, const path& base, error_code& ec) #endif if (!exists(pa, ec)) - return result; + { + if (!ec) + ec = make_error_code(std::errc::no_such_file_or_directory); + return result; + } // else: we know there are (currently) no unresolvable symlink loops result = pa.root_path(); commit 16b33e71b6b247d3936cddbddac982082e802894 Author: Jonathan Wakely <jwak...@redhat.com> Date: Wed Oct 26 12:14:53 2016 +0100 Add missing header in Filesystem TS configure tests 2016-10-26 Uros Bizjak <ubiz...@gmail.com> * acinclude.m4 (GLIBCXX_CHECK_FILESYSTEM_DEPS): Include <limits.h> for PATH_MAX in realpath test. * configure: Regenerate. diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index d0ee45f..1fc4de1 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -4290,6 +4290,7 @@ dnl AC_CACHE_VAL(glibcxx_cv_realpath, [dnl GCC_TRY_COMPILE_OR_LINK( [ + #include <limits.h> #include <stdlib.h> #include <unistd.h> ],