id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 13028,"boost::filesystem::canonical(const path& p, system::error_code& ec) throws exception",Zach Wasserman ,Beman Dawes,"Per [http://www.boost.org/doc/libs/1_64_0/libs/filesystem/doc/reference.html#Error-reporting the docs], this function should report filesystem errors through the error_code. In the case of permission issues, this contract is violated. This is best explained with the test case: {{{ #include #include namespace fs = boost::filesystem; int test_main(int, char*[]) { // Ensure that we do not have read permissions on pwd fs::path tmp_path = fs::temp_directory_path(); fs::path unique_path = fs::unique_path(); fs::path dir_path = tmp_path / unique_path; fs::create_directory(dir_path); fs::current_path(dir_path); fs::permissions(dir_path, fs::no_perms); // Try to get a canonical path with the error_code API. This should return an // error through the error_code, but instead throws an exception (because // canonical(const path& p, system::error_code& ec) calls current_path() // without error_code) boost::system::error_code e; fs::canonical(""foo"", e); BOOST_TEST(e.value() != 0); return ::boost::report_errors(); } }}} Test output: {{{ bin/bug Clang version 8.0.0 (clang-800.0.38), __GXX_EXPERIMENTAL_CXX0X__ not defined libc++ version 3700 Mac OS Boost version 1.65.0 Command line: bin/bug ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ****************************** std::exception ***************************** boost::filesystem::current_path: Permission denied *************************************************************************** }}} This unexpected exception causes a crash in osquery. See [https://github.com/facebook/osquery/issues/3279]",Bugs,new,To Be Determined,filesystem,Boost 1.65.0,Problem,,,