Boost C++ Libraries: Ticket #5653: recursive_directory_iterator(error_code) can still throw filesystem_error https://svn.boost.org/trac10/ticket/5653 <p> internally recursive_directory_iterator uses other filesystem facilities (such as is_directory and is_symlink) without passing the system::error_code argument. If they fail, they will throw filesystem_error. </p> <p> Example on Linux (see ticket <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5652" title="#5652: Bugs: recursive_directory_iterator fails on cyclic symbolic links (closed: fixed)">#5652</a>): </p> <p> int main() { </p> <blockquote> <p> try { </p> <blockquote> <p> error_code ec; for (recursive_directory_iterator i(".", ec); i != recursive_directory_iterator(); ++i) ; </p> </blockquote> <p> } catch (const std::exception&amp; e) { </p> <blockquote> <p> std::cout &lt;&lt; "&gt;&gt; " &lt;&lt; e.what() &lt;&lt; std::endl; </p> </blockquote> <p> } </p> </blockquote> <p> } </p> <p> $ ln -s mybadlink mybadlink $ ./test </p> <blockquote class="citation"> <blockquote class="citation"> <p> boost::filesystem::status: Too many levels of symbolic links: "./mybadlink" </p> </blockquote> </blockquote> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5653 Trac 1.4.3 Beman Dawes Tue, 24 Jan 2012 19:43:14 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/5653#comment:1 https://svn.boost.org/trac10/ticket/5653#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/76667" title="Fix #5653, recursive_directory_iterator(error_code) can still throw ...">[76667]</a>) Fix <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5653" title="#5653: Bugs: recursive_directory_iterator(error_code) can still throw filesystem_error (closed: fixed)">#5653</a>, recursive_directory_iterator(error_code) can still throw filesystem_error. Fix a second bug, discovered while testing 5653; recursive_directory_iterator::increment with error_code argument was not reporting the end iterator. </p> Ticket