Boost C++ Libraries: Ticket #412: remove_all problems on dangling symlinks https://svn.boost.org/trac10/ticket/412 <pre class="wiki">remove_all() fails on dangling symlinks, and throws exception when they are in subdirs. &lt;pre&gt; #include &lt;boost/filesystem/operations.hpp&gt; #include &lt;boost/filesystem/exception.hpp&gt; #include &lt;iostream&gt; // for std::cout using namespace std; namespace fs = boost::filesystem; int main(){ system("rm -rf foo1 foo2 foo3"); system("ln -s nowhere foo1"); system("mkdir foo2; touch foo2/blank; echo apple &gt; foo2/apple"); system("mkdir foo3; ln -s nowhere foo3/dangle"); try { fs::remove_all("foo1"); //fine, but no deletion fs::remove_all("foo2"); //fine fs::remove_all("foo3"); //error } catch (fs::filesystem_error const&amp; exc){ cerr &lt;&lt;"ERROR:" &lt;&lt;exc.what() &lt;&lt;endl; } cerr &lt;&lt; fs::exists("foo1") &lt;&lt; "," &lt;&lt; fs::symbolic_link_exists("foo1") &lt;&lt;endl; cerr &lt;&lt; fs::exists("foo2") &lt;&lt; "," &lt;&lt; fs::symbolic_link_exists("foo3") &lt;&lt;endl; cerr &lt;&lt; fs::exists("foo3") &lt;&lt; "," &lt;&lt; fs::symbolic_link_exists("foo2") &lt;&lt;endl; return 0; } &lt;/pre&gt; Result: &lt;pre&gt; ERROR:boost::filesystem::remove: "foo3": Directory not empty 0,1 0,0 1,0 &lt;/pre&gt; Also note that the post-condition is violated for foo1. </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/412 Trac 1.4.3 beman_dawes Thu, 16 Jun 2005 18:56:30 GMT <link>https://svn.boost.org/trac10/ticket/412#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/412#comment:1</guid> <description> <pre class="wiki">Logged In: YES user_id=51042 What version of Boost? What compiler and operating system? What version of each? </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>cxdunn</dc:creator> <pubDate>Thu, 16 Jun 2005 19:45:40 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/412#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/412#comment:2</guid> <description> <pre class="wiki">Logged In: YES user_id=1267419 1.31.0 gcc (g++3.3) Red Hat Linux 7.3 Pentium 4 </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>beman_dawes</dc:creator> <pubDate>Sun, 19 Jun 2005 00:47:13 GMT</pubDate> <title>status changed https://svn.boost.org/trac10/ticket/412#comment:3 https://svn.boost.org/trac10/ticket/412#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> </ul> <pre class="wiki">Logged In: YES user_id=51042 That was a known bug in Boost 1.31. You need to upgrade to 1.32 or later. 1.33 is very close to release, and fixes a number of additional Boost.Filesystem problems, do you might to get that when it it is released. As a result of your bug report, I did upgrade the operations_test regression test to probe symlink remove() failures. Cheers, --Beman </pre> Ticket cxdunn Mon, 20 Jun 2005 15:27:28 GMT <link>https://svn.boost.org/trac10/ticket/412#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/412#comment:4</guid> <description> <pre class="wiki">Logged In: YES user_id=1267419 Yes, this is fixed in boost-1.32. Verified. </pre> </description> <category>Ticket</category> </item> </channel> </rss>