Boost logo

Boost :

From: (noreply_at_[hidden])
Date: 2005-06-15 14:27:02

Bugs item #1221465, was opened at 2005-06-15 14:27
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: filesystem
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Christopher Dunn (cxdunn)
Assigned to: Beman Dawes (beman_dawes)
Summary: remove_all problems on dangling symlinks

Initial Comment:
remove_all() fails on dangling symlinks, and throws
exception when they are in subdirs.
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/exception.hpp>

#include <iostream> // 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 >
  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& exc){
    cerr <<"ERROR:" <<exc.what() <<endl;
  cerr << fs::exists("foo1") << "," <<
fs::symbolic_link_exists("foo1") <<endl;
  cerr << fs::exists("foo2") << "," <<
fs::symbolic_link_exists("foo3") <<endl;
  cerr << fs::exists("foo3") << "," <<
fs::symbolic_link_exists("foo2") <<endl;
  return 0;
ERROR:boost::filesystem::remove: "foo3": Directory not

Also note that the post-condition is violated for foo1.


You can respond by visiting:

SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast.
Boost-bugs mailing list

Boost list run by bdawes at, gregod at, cpdaniel at, john at