From 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 20:24:20 +0200 Subject: Adding upstream version 14.2.21. Signed-off-by: Daniel Baumann --- src/boost/libs/filesystem/test/issues/10038.cpp | 8 ++ src/boost/libs/filesystem/test/issues/10205.cpp | 17 +++ src/boost/libs/filesystem/test/issues/10485.cpp | 14 +++ src/boost/libs/filesystem/test/issues/10641.cpp | 20 ++++ .../filesystem/test/issues/11166-remove-race.cpp | 38 ++++++ ...filtered-recursive_directory_iterator-range.cpp | 25 ++++ .../libs/filesystem/test/issues/3332/test.cpp | 37 ++++++ .../libs/filesystem/test/issues/4329.-basename.cpp | 20 ++++ .../test/issues/5300-temp-dir-path-130.cpp | 0 .../test/issues/6638-global-init-fails-3.cpp | 36 ++++++ .../libs/filesystem/test/issues/70-71-copy.cpp | 20 ++++ src/boost/libs/filesystem/test/issues/8930.cpp | 7 ++ ...9054_static_const_codecvt_segfault_pre_main.cpp | 10 ++ src/boost/libs/filesystem/test/issues/9219.cpp | 40 +++++++ src/boost/libs/filesystem/test/issues/Jamfile.v2 | 38 ++++++ .../libs/filesystem/test/issues/boost-no-inspect | 0 .../copy_file-compilation-error-2015-05-04.cpp | 14 +++ .../issues/fchmodat_AT_SYMLINK_NOFOLLOW_6659.cpp | 38 ++++++ .../filesystem/test/issues/hello_filesystem.cpp | 39 ++++++ src/boost/libs/filesystem/test/issues/readme.txt | 9 ++ .../test/issues/recurse_dir_iter_5403.cpp | 132 +++++++++++++++++++++ 21 files changed, 562 insertions(+) create mode 100644 src/boost/libs/filesystem/test/issues/10038.cpp create mode 100644 src/boost/libs/filesystem/test/issues/10205.cpp create mode 100644 src/boost/libs/filesystem/test/issues/10485.cpp create mode 100644 src/boost/libs/filesystem/test/issues/10641.cpp create mode 100644 src/boost/libs/filesystem/test/issues/11166-remove-race.cpp create mode 100644 src/boost/libs/filesystem/test/issues/11228--filtered-recursive_directory_iterator-range.cpp create mode 100644 src/boost/libs/filesystem/test/issues/3332/test.cpp create mode 100644 src/boost/libs/filesystem/test/issues/4329.-basename.cpp create mode 100644 src/boost/libs/filesystem/test/issues/5300-temp-dir-path-130.cpp create mode 100644 src/boost/libs/filesystem/test/issues/6638-global-init-fails-3.cpp create mode 100644 src/boost/libs/filesystem/test/issues/70-71-copy.cpp create mode 100644 src/boost/libs/filesystem/test/issues/8930.cpp create mode 100644 src/boost/libs/filesystem/test/issues/9054_static_const_codecvt_segfault_pre_main.cpp create mode 100644 src/boost/libs/filesystem/test/issues/9219.cpp create mode 100644 src/boost/libs/filesystem/test/issues/Jamfile.v2 create mode 100644 src/boost/libs/filesystem/test/issues/boost-no-inspect create mode 100644 src/boost/libs/filesystem/test/issues/copy_file-compilation-error-2015-05-04.cpp create mode 100644 src/boost/libs/filesystem/test/issues/fchmodat_AT_SYMLINK_NOFOLLOW_6659.cpp create mode 100644 src/boost/libs/filesystem/test/issues/hello_filesystem.cpp create mode 100644 src/boost/libs/filesystem/test/issues/readme.txt create mode 100644 src/boost/libs/filesystem/test/issues/recurse_dir_iter_5403.cpp (limited to 'src/boost/libs/filesystem/test/issues') diff --git a/src/boost/libs/filesystem/test/issues/10038.cpp b/src/boost/libs/filesystem/test/issues/10038.cpp new file mode 100644 index 00000000..341e7a94 --- /dev/null +++ b/src/boost/libs/filesystem/test/issues/10038.cpp @@ -0,0 +1,8 @@ +#include + +int main(void) +{ + boost::filesystem::copy_file("a", "b"); + return 0; +} + diff --git a/src/boost/libs/filesystem/test/issues/10205.cpp b/src/boost/libs/filesystem/test/issues/10205.cpp new file mode 100644 index 00000000..4cf5e728 --- /dev/null +++ b/src/boost/libs/filesystem/test/issues/10205.cpp @@ -0,0 +1,17 @@ +// Linux test; before running: export LANG=foo + +#include +#include +#include +#include + +int main() +{ + std::string pathname = "/some/filesystem/path/%%%%"; + + boost::filesystem::path path(pathname); + + std::wcout << path.wstring() << std::endl; + + return 0; +} diff --git a/src/boost/libs/filesystem/test/issues/10485.cpp b/src/boost/libs/filesystem/test/issues/10485.cpp new file mode 100644 index 00000000..81ba2136 --- /dev/null +++ b/src/boost/libs/filesystem/test/issues/10485.cpp @@ -0,0 +1,14 @@ +// Copyright iamvfx@gmail.com 2014 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +#include +#include + +int main() +{ + boost::filesystem::path dir("/"); + for (char c : dir.filename().string()) + printf("%c\n", c); +} diff --git a/src/boost/libs/filesystem/test/issues/10641.cpp b/src/boost/libs/filesystem/test/issues/10641.cpp new file mode 100644 index 00000000..ff90784e --- /dev/null +++ b/src/boost/libs/filesystem/test/issues/10641.cpp @@ -0,0 +1,20 @@ +#include +#include +using namespace std; +namespace fs = boost::filesystem; +int main(int argc, char** argv) +{ + + try + { + fs::path my_path("test/test.txt"); + cout << "current path is " << my_path << endl; + cout << "parent path is " << my_path.parent_path() << endl; + } + catch(std::exception& e) { + cerr << endl << "Error during execution: " << e.what() << endl << endl; + return EXIT_FAILURE; + } + return EXIT_SUCCESS; +} + diff --git a/src/boost/libs/filesystem/test/issues/11166-remove-race.cpp b/src/boost/libs/filesystem/test/issues/11166-remove-race.cpp new file mode 100644 index 00000000..e5ba61a5 --- /dev/null +++ b/src/boost/libs/filesystem/test/issues/11166-remove-race.cpp @@ -0,0 +1,38 @@ +#include +#include +#include + +boost::condition_variable cond; +boost::mutex mut; + +#define FNAME ("remove-test") +void remover() +{ + while(1) + { + boost::filesystem::remove(FNAME); + } +} + +void creater() +{ + for(int i=0; i<100000; i++) std::fstream(FNAME, std::fstream::out); +} + +int main() +{ + boost::filesystem::remove(FNAME); + boost::filesystem::remove(FNAME); + + std::cout << + "If you got this far, it's OK to remove a file that doesn't exist\n" + "Now trying with one creator thread and two remover threads.\n" + "This is likely to crash after just a few seconds at most." << + std::endl; + + boost::thread c(creater), r1(remover), r2(remover); + + c.join(); + r1.interrupt(); r1.join(); + r2.interrupt(); r2.join(); +} diff --git a/src/boost/libs/filesystem/test/issues/11228--filtered-recursive_directory_iterator-range.cpp b/src/boost/libs/filesystem/test/issues/11228--filtered-recursive_directory_iterator-range.cpp new file mode 100644 index 00000000..ac44d2d6 --- /dev/null +++ b/src/boost/libs/filesystem/test/issues/11228--filtered-recursive_directory_iterator-range.cpp @@ -0,0 +1,25 @@ +#include +#include +#include +#include +#include +#include + +namespace fs = boost::filesystem; +using namespace boost::adaptors; + +int main() { + fs::recursive_directory_iterator beg("."), end; + + auto fileFilter = [](fs::path const & path) + { + return is_regular_file(path); + }; + + std::vector paths; + copy(boost::make_iterator_range(beg, end) | filtered(fileFilter), + std::back_inserter(paths)); + + for(auto& p : paths) + std::cout << p << "\n"; +} \ No newline at end of file diff --git a/src/boost/libs/filesystem/test/issues/3332/test.cpp b/src/boost/libs/filesystem/test/issues/3332/test.cpp new file mode 100644 index 00000000..9456a7a8 --- /dev/null +++ b/src/boost/libs/filesystem/test/issues/3332/test.cpp @@ -0,0 +1,37 @@ +#include +#include +#include +#include +#include + +namespace fs = boost::filesystem; + +int main(void) { + + std::locale global_loc = std::locale(); + std::locale loc(global_loc, new stdext::cvt::codecvt_cp950); + fs::path::imbue(loc); + + std::cout << + "HEADS UP! PIPE OUTPUT TO FILE AND INSPECT WITH HEX OR CP950 EDITOR.\n" + "WINDOWS COMMAND PROMPT FONTS DON'T SUPPORT CHINESE,\n" + "EVEN WITH CODEPAGE SET AND EVEN AS OF WIN 10 TECH PREVIEW." << std::endl; + + fs::recursive_directory_iterator end; + fs::recursive_directory_iterator iter + ("C:/boost/test-files/utf-8"); + + while (iter != end) + { + if (fs::is_directory(*iter)) + { + std::cout << "[directory] " << iter->path().generic_string() << std::endl; + } + else if (fs::is_regular(*iter)) + { + std::cout << " [file] " << iter->path().generic_string() << std::endl; + } + ++iter; + } + return 0; +} diff --git a/src/boost/libs/filesystem/test/issues/4329.-basename.cpp b/src/boost/libs/filesystem/test/issues/4329.-basename.cpp new file mode 100644 index 00000000..a07648b3 --- /dev/null +++ b/src/boost/libs/filesystem/test/issues/4329.-basename.cpp @@ -0,0 +1,20 @@ +#include +#include +using boost::filesystem::path; + +int main() +{ + std::cout << path("a").stem() << std::endl; + std::cout << path("a/").stem() << std::endl; + std::cout << path("a/b").stem() << std::endl; + std::cout << path("a/b/").stem() << std::endl; + std::cout << path("a/b/c").stem() << std::endl; + std::cout << path("a/b/c/").stem() << std::endl; + std::cout << path("a/b/c/d").stem() << std::endl; + std::cout << path("a/b/c/d/").stem() << std::endl; + std::cout << path("a/b/c/d/e").stem() << std::endl; + std::cout << path("a/b/c/d/e/").stem() << std::endl; + return 0; +} + + diff --git a/src/boost/libs/filesystem/test/issues/5300-temp-dir-path-130.cpp b/src/boost/libs/filesystem/test/issues/5300-temp-dir-path-130.cpp new file mode 100644 index 00000000..e69de29b diff --git a/src/boost/libs/filesystem/test/issues/6638-global-init-fails-3.cpp b/src/boost/libs/filesystem/test/issues/6638-global-init-fails-3.cpp new file mode 100644 index 00000000..b0a62ede --- /dev/null +++ b/src/boost/libs/filesystem/test/issues/6638-global-init-fails-3.cpp @@ -0,0 +1,36 @@ +#include +#include +#include + +using namespace boost::filesystem; + +// The original bug report was that this broke: +// path p(L"C:\\TEMP\\"); +// path r(p / "narrow"); +// That code now works, but ... + +// Nils Gladitz has provided this example ... + +class Test +{ +public: + ~Test() + { + path p(L"C:\\TEMP\\"); + path r(p / "narrow"); + } +}; + +// path p("narrow"); + +// fails if static linked and Test object is global variable, but does not fail if +// path p("narrow") line above is not commented out, and also does not fail if the +// Test test2 line below is commented out. + +Test test1; +Test test2; + +int cpp_main(int, char* []) +{ + return 0; +} diff --git a/src/boost/libs/filesystem/test/issues/70-71-copy.cpp b/src/boost/libs/filesystem/test/issues/70-71-copy.cpp new file mode 100644 index 00000000..ed67f170 --- /dev/null +++ b/src/boost/libs/filesystem/test/issues/70-71-copy.cpp @@ -0,0 +1,20 @@ + +// Copyright 2018 Peter Dimov. +// +// Distributed under the Boost Software License, Version 1.0. +// +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt + +// See library home page at http://www.boost.org/libs/filesystem + +#include +#include + +namespace fs = boost::filesystem; + +int main() +{ + BOOST_TEST_THROWS( fs::copy( "/tmp/non-existent-a", "/tmp/non-existent-b" ), std::exception ); + return boost::report_errors(); +} diff --git a/src/boost/libs/filesystem/test/issues/8930.cpp b/src/boost/libs/filesystem/test/issues/8930.cpp new file mode 100644 index 00000000..280e5ed6 --- /dev/null +++ b/src/boost/libs/filesystem/test/issues/8930.cpp @@ -0,0 +1,7 @@ +// Before running this test: export LANG=foo + +#include +int main() { + boost::filesystem::path("/abc").root_directory(); +} + diff --git a/src/boost/libs/filesystem/test/issues/9054_static_const_codecvt_segfault_pre_main.cpp b/src/boost/libs/filesystem/test/issues/9054_static_const_codecvt_segfault_pre_main.cpp new file mode 100644 index 00000000..e30617e0 --- /dev/null +++ b/src/boost/libs/filesystem/test/issues/9054_static_const_codecvt_segfault_pre_main.cpp @@ -0,0 +1,10 @@ +#include "boost/filesystem.hpp" + +static const boost::filesystem::path::codecvt_type &dummy = + boost::filesystem::path::codecvt(); + +int main() +{ + return 0; +} + diff --git a/src/boost/libs/filesystem/test/issues/9219.cpp b/src/boost/libs/filesystem/test/issues/9219.cpp new file mode 100644 index 00000000..85d4b5c7 --- /dev/null +++ b/src/boost/libs/filesystem/test/issues/9219.cpp @@ -0,0 +1,40 @@ +// Boost 9219.cpp --------------------------------------------------------------------// + +// Copyright Beman Dawes 2014 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// Library home page: http://www.boost.org/libs/filesystem + +//--------------------------------------------------------------------------------------// +// // +// In researching filesystem issues it is convenient to have a program that can be // +// quickly modified to test reported problems. That's the purpose of this file and // +// its associated Visual Studio and Boost.Build infrastructure. // +// // +//--------------------------------------------------------------------------------------// + +#include + +#include + +#include +#include +#include + +using std::cout; +using std::endl; +namespace fs = boost::filesystem; + +//------------------------------------ cpp_main --------------------------------------// + +int cpp_main(int argc, char* argv[]) +{ + cout << "Hello, 9219" << endl; + cout << "This is a test for non-Windows systems" << endl; + + BOOST_TEST(fs::exists(const_cast("."))); + + return ::boost::report_errors(); +} // cpp_main diff --git a/src/boost/libs/filesystem/test/issues/Jamfile.v2 b/src/boost/libs/filesystem/test/issues/Jamfile.v2 new file mode 100644 index 00000000..47fce407 --- /dev/null +++ b/src/boost/libs/filesystem/test/issues/Jamfile.v2 @@ -0,0 +1,38 @@ +# Boost Filesystem test/issues Jamfile + +# Copyright Beman Dawes 2014 + +# Distributed under the Boost Software License, Version 1.0. +# See www.boost.org/LICENSE_1_0.txt + +# Library home page: http://www.boost.org/libs/filesystem + +project + : requirements + /boost/filesystem//boost_filesystem + static + ; + + test-suite "filesystem-issues" : +# [ run 9054_static_const_codecvt_segfault_pre_main.cpp +# : : : shared : 9054_shared ] +# [ run 9054_static_const_codecvt_segfault_pre_main.cpp +# : : : static : 9054_static ] +# [ run hello_filesystem.cpp +# : : : shared : hello_shared ] +# [ run hello_filesystem.cpp +# : : : static : hello_static ] +# [ run 9219.cpp +# : : : shared : 9219_shared ] +# [ run 9219.cpp +# : : : static : 9219_static ] +# [ run 10485.cpp +# : : : shared always_show_run_output ] +# [ run copy_file-compilation-error-2015-05-04.cpp ] + [ run 6638-convert_aux-fails-init-global.cpp + : : : shared : 6638_shared ] + [ run 6638-convert_aux-fails-init-global.cpp + : : : static : 6638_static ] + + ; + diff --git a/src/boost/libs/filesystem/test/issues/boost-no-inspect b/src/boost/libs/filesystem/test/issues/boost-no-inspect new file mode 100644 index 00000000..e69de29b diff --git a/src/boost/libs/filesystem/test/issues/copy_file-compilation-error-2015-05-04.cpp b/src/boost/libs/filesystem/test/issues/copy_file-compilation-error-2015-05-04.cpp new file mode 100644 index 00000000..c9034d6f --- /dev/null +++ b/src/boost/libs/filesystem/test/issues/copy_file-compilation-error-2015-05-04.cpp @@ -0,0 +1,14 @@ +// Rob Conde reports this fails +// to compile for Boost 1.58 with g++ 4.4.7 but is OK with FC++ 2013 + +#include "boost/filesystem/operations.hpp" + +void myFunc() +{ + using namespace boost::filesystem; + + copy_option opt(copy_option::overwrite_if_exists); + + copy_file(path("p1"),path("p2"),copy_option::overwrite_if_exists); +// copy_file(path("p1"),path("p2"),opt); +} \ No newline at end of file diff --git a/src/boost/libs/filesystem/test/issues/fchmodat_AT_SYMLINK_NOFOLLOW_6659.cpp b/src/boost/libs/filesystem/test/issues/fchmodat_AT_SYMLINK_NOFOLLOW_6659.cpp new file mode 100644 index 00000000..e69f9ba2 --- /dev/null +++ b/src/boost/libs/filesystem/test/issues/fchmodat_AT_SYMLINK_NOFOLLOW_6659.cpp @@ -0,0 +1,38 @@ +// Test program to demonstrate that Linux does not support AT_SYMLINK_NOFOLLOW + +// Copyright Duncan Exon Smith 2012 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// Test this by running: +// +// rm -rf data && mkdir data && g++ -otest-fchmodat fchmodat_AT_SYMLINK_NOFOLLOW_6659.cpp && (cd data && ../test-fchmodat) +// +// If no assertions go off, then it looks like fchmodat is supported, +// but AT_SYMLINK_NOFOLLOW is not supported. + +#include +#include +#include +#include +#include + +#ifdef NDEBUG +# error This program depends on assert() so makes no sense if NDEBUG is defined +#endif + +int main(int argc, char *argv[]) +{ + { std::ofstream file("out"); file << "contents"; } + + assert(!::symlink("out", "sym")); + + assert(!::fchmodat(AT_FDCWD, "out", S_IRUSR | S_IWUSR | S_IXUSR, 0)); + assert(!::fchmodat(AT_FDCWD, "sym", S_IRUSR | S_IWUSR | S_IXUSR, 0)); + + assert(::fchmodat(AT_FDCWD, "sym", S_IRUSR | S_IWUSR | S_IXUSR, AT_SYMLINK_NOFOLLOW) == -1); + assert(errno == ENOTSUP); + + return 0; +} diff --git a/src/boost/libs/filesystem/test/issues/hello_filesystem.cpp b/src/boost/libs/filesystem/test/issues/hello_filesystem.cpp new file mode 100644 index 00000000..f98b2f71 --- /dev/null +++ b/src/boost/libs/filesystem/test/issues/hello_filesystem.cpp @@ -0,0 +1,39 @@ +// Boost hello_filesystem.cpp --------------------------------------------------------// + +// Copyright Beman Dawes 2014 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// Library home page: http://www.boost.org/libs/filesystem + +//--------------------------------------------------------------------------------------// +// // +// In researching filesystem issues it is convenient to have a program that can be // +// quickly modified to test reported problems. That's the purpose of this file and // +// its associated Visual Studio and Boost.Build infrastructure. // +// // +//--------------------------------------------------------------------------------------// + +#include + +#include + +#include +#include +#include + +using std::cout; +using std::endl; +namespace fs = boost::filesystem; + +//------------------------------------ cpp_main --------------------------------------// + +int cpp_main(int argc, char* argv[]) +{ + cout << "Hello, filesystem world" << endl; + + BOOST_TEST(fs::exists(".")); + + return ::boost::report_errors(); +} // cpp_main diff --git a/src/boost/libs/filesystem/test/issues/readme.txt b/src/boost/libs/filesystem/test/issues/readme.txt new file mode 100644 index 00000000..cf8198e5 --- /dev/null +++ b/src/boost/libs/filesystem/test/issues/readme.txt @@ -0,0 +1,9 @@ +This directory contains tests related to specific issues. + +The names are intended to indicate both the function or condition being tested +and the issue number. + +----- +Copyright Beman Dawes 2012 +Distributed under the Boost Software License, Version 1.0. +See http://www.boost.org/LICENSE_1_0.txt diff --git a/src/boost/libs/filesystem/test/issues/recurse_dir_iter_5403.cpp b/src/boost/libs/filesystem/test/issues/recurse_dir_iter_5403.cpp new file mode 100644 index 00000000..7e7ab6c4 --- /dev/null +++ b/src/boost/libs/filesystem/test/issues/recurse_dir_iter_5403.cpp @@ -0,0 +1,132 @@ +// Boost Filesystem recurse_dir_iter_test.cpp ----------------------------------------// + +// Copyright Beman Dawes 2014. + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// Library home page: http://www.boost.org/libs/filesystem + +#include + +// See deprecated_test for tests of deprecated features +#ifndef BOOST_FILESYSTEM_NO_DEPRECATED +# define BOOST_FILESYSTEM_NO_DEPRECATED +#endif +#ifndef BOOST_SYSTEM_NO_DEPRECATED +# define BOOST_SYSTEM_NO_DEPRECATED +#endif + +#include + +#include +# if defined( BOOST_NO_STD_WSTRING ) +# error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support +# endif + +#include +#include +#include + +namespace fs = boost::filesystem; +using boost::system::error_code; +using boost::system::system_category; +using boost::system::system_error; + +#include + +using std::cout; +using std::endl; + +#ifdef BOOST_WINDOWS_API +# include +#endif +namespace +{ + typedef int errno_t; + std::string platform(BOOST_PLATFORM); + bool report_throws = false; + bool cleanup = true; + bool skip_long_windows_tests = false; + unsigned short language_id; // 0 except for Windows + +} // unnamed namespace + +//------------------------------------------------------------------------------------// +// // +// main // +// // +//------------------------------------------------------------------------------------// + +int cpp_main(int argc, char* argv[]) +{ + // document state of critical macros +#ifdef BOOST_POSIX_API + cout << "BOOST_POSIX_API is defined\n"; +#endif +#ifdef BOOST_WINDOWS_API + cout << "BOOST_WINDOWS_API is defined\n"; +#endif + + for (; argc > 1; --argc, ++argv) + { + //if (*argv[1]=='-' && *(argv[1]+1)=='t') + // report_throws = true; + //else if (*argv[1]=='-' && *(argv[1]+1)=='x') + // cleanup = false; + //else if (*argv[1]=='-' && *(argv[1]+1)=='w') + // skip_long_windows_tests = true; + } + + // The choice of platform to test is made at runtime rather than compile-time + // so that compile errors for all platforms will be detected even though + // only the current platform is runtime tested. +# if defined(BOOST_POSIX_API) + platform = "POSIX"; +# elif defined(BOOST_WINDOWS_API) + platform = "Windows"; +# if !defined(__MINGW32__) && !defined(__CYGWIN__) + language_id = ::GetUserDefaultUILanguage(); +# else + language_id = 0x0409; // Assume US English +# endif +# else +# error neither BOOST_POSIX_API nor BOOST_WINDOWS_API is defined. See boost/system/api_config.hpp +# endif + cout << "API is " << platform << endl; + cout << "initial_path() is " << fs::initial_path() << endl; + fs::path ip = fs::initial_path(); + + for (fs::path::const_iterator it = ip.begin(); it != ip.end(); ++it) + { + if (it != ip.begin()) + cout << ", "; + cout << *it; + } + cout << endl; + + // From the root, walk the directory tree looking for a permissions error + + fs::recursive_directory_iterator it("/"); + fs::recursive_directory_iterator end_it; + + // The increment function has an invarient that it always makes progress, + // so even if an error occurs this loop will eventually terminate. + + while (it != end_it) + { + error_code ec; + fs::path init_path = it->path(); + it.increment(ec); + if (ec) + { + cout << "initial path: " << init_path << endl; + cout << "error_code: " << ec.value() << " with msg: " << ec.message() << endl; + if (it != end_it) + cout << "post-increment path: " << it->path() << endl; + } + } + + cout << "returning from main()" << endl; + return ::boost::report_errors(); +} // main -- cgit v1.2.3