Boost logo

Boost :

From: Walter Landry (wlandry_at_[hidden])
Date: 2003-10-31 23:14:43


Walter Landry <wlandry_at_[hidden]> wrote:
> Beman Dawes <bdawes_at_[hidden]> wrote:
> > At 06:16 AM 9/18/2003, Walter Landry wrote:
> >
> > >I have attached patches for a few assorted improvements to the
> > >filesystem library. These patches are only to the posix side of
> > >things. I wouldn't know the first thing of what to do on Windows.
> >
> > It may be a few days before I get a chance to look at these, but I will get
> > back to you on them.
>
> I haven't heard anything, but here is another patch. If you are
> checking for whether a path exists, you should use lstat instead of
> stat. Otherwise, with the library as written, you can never delete a
> symlink that points to nowhere.

I still haven't heard anything, but I found another problem with
symlinks. Consider the directory structure

  foo
  foo/bar
  foo/bar/baz
  foo/bar/baz/bat
  foo/frob --> bar/baz/

where the last directory is a symlink. If I am sitting in foo and type

  $ ls frob/../baz

I get

  bat/

However, the filesystem library wants to shorten this into just "baz".
This, of course, is incorrect. So it seems like you should never
attempt to shorten a path by removing any instances of "../". Rather,
boost::filesystem can provide methods to get the fully canonical name
of a path. I don't know about Windows, but this seems to map more
closely with Unix semantics. Agree? Disagree?

Looking for feedback.

Walter Landry
wlandry_at_[hidden]


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