Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2008-05-30 08:11:04


dizzy wrote:
> Hello
>
> If one creates a symlink like this "ln -s sym sym" (to itself symlink),
> bfs::exists("sym") will throw because the documentation defines it to do so
> (and I have nothing against it doing so, although in my programs because of
> this I am forced to just use "lstat()" and I can't replace using "lstat()" to
> check if something exists with bfs::exists).

Interesting! That's a case I never considered.

>
> However, I do think that bfs::remove("sym") throwing for the same reason
> (because it calls upon bfs::exists()) is the wrong thing to do. The source
> around bfs::remove() implementation even try to solve the issue of "dangling
> symlinks" as they call it by having an exception in case bfs::exists returns
> false and the target path points to a dangling symlink and still tries to
> remove it. Unfortunetly, exists will throw in my example of a symlink (not
> even dangling technically speaking :) ) even tho a remove on that kind of
> symlink should work just fine (it does work in shell or just doing
> std::remove()).
>
> Is this a bug?

Probably.

> If so, I should put it in the tracker?

Yes, please do.

Please mention what operating system you are using. I assume it is
Linux, but it always helps to know for sure with filesystem issues.

Thanks,

--Beman


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk