From 98b29a72e5f9af8ea211b9de2d9fe8f283917b08 Mon Sep 17 00:00:00 2001 From: Beman Date: Wed, 23 Jul 2014 09:39:26 -0400 Subject: [PATCH] Fix-up of prior merge conflict resolution from develop. --- include/boost/filesystem/operations.hpp | 28 ++++++++++++++----------- test/issues/recurse_dir_iter_5403.cpp | 4 ++-- test/operations_test.cpp | 19 +++++++++++------ 3 files changed, 31 insertions(+), 20 deletions(-) diff --git a/include/boost/filesystem/operations.hpp b/include/boost/filesystem/operations.hpp index 2b77803..bd19678 100644 --- a/include/boost/filesystem/operations.hpp +++ b/include/boost/filesystem/operations.hpp @@ -58,11 +58,11 @@ namespace boost namespace filesystem { - //--------------------------------------------------------------------------------------// - // // - // class filesystem_error // - // // - //--------------------------------------------------------------------------------------// + //----------------------------------------------------------------------------------// + // // + // class filesystem_error // + // // + //----------------------------------------------------------------------------------// class BOOST_SYMBOL_VISIBLE filesystem_error : public system::system_error { @@ -236,7 +236,7 @@ namespace boost others_exe = 01, // S_IXOTH, Execute/search permission, others others_all = 07, // S_IRWXO, Read, write, execute/search by others - all_all = owner_all|group_all|others_all, // 0777 + all_all = 0777, // owner_all|group_all|others_all // other POSIX bits @@ -249,7 +249,7 @@ namespace boost // (SVID-v4.2) On directories: restricted deletion flag // Also see http://en.wikipedia.org/wiki/Sticky_bit - perms_mask = all_all|set_uid_on_exe|set_gid_on_exe|sticky_bit, // 07777 + perms_mask = 07777, // all_all|set_uid_on_exe|set_gid_on_exe|sticky_bit perms_not_known = 0xFFFF, // present when directory_entry cache not loaded @@ -412,6 +412,7 @@ namespace boost BOOST_FILESYSTEM_DECL void copy(const path& from, const path& to, BOOST_SCOPED_ENUM(copy_options) options, system::error_code* ec=0); + // TODO //BOOST_FILESYSTEM_DECL //void copy_directory(const path& from, const path& to, system::error_code* ec=0); BOOST_FILESYSTEM_DECL @@ -1124,8 +1125,9 @@ namespace filesystem // Discover if the iterator is for a directory that needs to be recursed into, // taking symlinks and options into account. - if ((m_options & symlink_option::_detail_no_push) == symlink_option::_detail_no_push) - m_options &= ~symlink_option::_detail_no_push; + if ((m_options & directory_options::_detail_no_push) + == directory_options::_detail_no_push) + m_options &= ~directory_options::_detail_no_push; else { @@ -1140,14 +1142,16 @@ namespace filesystem file_status symlink_stat; - if ((m_options & symlink_option::recurse) != symlink_option::recurse) + if ((m_options & directory_options::follow_directory_symlink) + != directory_options::follow_directory_symlink) { symlink_stat = m_stack.top()->symlink_status(ec); if (ec) return false; } - if ((m_options & symlink_option::recurse) == symlink_option::recurse + if ((m_options & directory_options::follow_directory_symlink) + == directory_options::follow_directory_symlink || !is_symlink(symlink_stat)) { file_status stat = m_stack.top()->status(ec); @@ -1158,7 +1162,7 @@ namespace filesystem if (!ec && next != directory_iterator()) { m_stack.push(next); - ++m_level; + ++m_depth; return true; } } diff --git a/test/issues/recurse_dir_iter_5403.cpp b/test/issues/recurse_dir_iter_5403.cpp index af746c5..8363b34 100644 --- a/test/issues/recurse_dir_iter_5403.cpp +++ b/test/issues/recurse_dir_iter_5403.cpp @@ -100,8 +100,8 @@ int cpp_main(int argc, char* argv[]) # 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(); + cout << "initial path is " << fs::current_path() << endl; + fs::path ip = fs::current_path(); for (fs::path::const_iterator it = ip.begin(); it != ip.end(); ++it) { diff --git a/test/operations_test.cpp b/test/operations_test.cpp index 33a30a4..731f357 100644 --- a/test/operations_test.cpp +++ b/test/operations_test.cpp @@ -1457,7 +1457,7 @@ namespace BOOST_TEST_EQ(fs::canonical(relative_dir / "d1/../f0"), dir / "f0"); // treat parent of root as itself on both POSIX and Windows - fs::path init(fs::initial_path()); + fs::path init(initial_path); fs::path root(init.root_path()); fs::path::const_iterator it(init.begin()); fs::path first; // relative first non-root directory @@ -2092,8 +2092,8 @@ int cpp_main(int argc, char* argv[]) # 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(); + cout << "initial_path is " << initial_path << endl; + fs::path ip = initial_path; for (fs::path::const_iterator it = ip.begin(); it != ip.end(); ++it) { @@ -2185,15 +2185,22 @@ int cpp_main(int argc, char* argv[]) cout << "post-test removal of " << dir << endl; boost::uintmax_t removed = fs::remove_all(dir); cout << " removed " << removed << " files, including directories" << endl; - BOOST_TEST(removed != 0); - // above was added just to simplify testing, but it ended up detecting + // The following was added just to simplify testing, but it ended up detecting // a bug (failure to close an internal search handle). + BOOST_TEST(removed != 0); // The following is failing itermittently with a permissions error. The error // goes away if recursive_directory_iterator_tests() is not run, but directory // search handles seem to be closed properly. Very perplexing. 8/8/2012. + // + // BOOST_TEST(fs::remove_all(dir) == 0); // removal eliminates problems + // + // The problem appears to be that the TortiseGit plug-in for Windows Explorer + // is the underlying cause; it seems to temporarily delay deletes. Some unrelated + // tests involving deletes also fail if TortiseGit (or TortoiseSvn) Windows + // explorer plug-ins are active. Failures disappear if Windows Explorer is closed. + BOOST_TEST(!fs::exists(dir)); - BOOST_TEST(fs::remove_all(dir) == 0); cout << "post-test removal complete" << endl; }