[Haskell] Reading a directory tree
Duncan Coutts
duncan.coutts at worcester.oxford.ac.uk
Tue Jun 22 16:12:27 EDT 2004
On Tue, 2004-06-22 at 21:02, Keith Wansbrough wrote:
> > BTW, one other caveat (which applies to all of the examples so far):
> > doesDirectoryExist doesn't distinguish between directories and
> > symlinks to directories. Consequently, any directory-traversal
> > algorithm which uses doesDirectoryExist to identify directories will
> > behave incorrectly in the presence of symlinks. In the worst case, you
> > can get into an infinite loop.
>
> symlinks aren't necessary to give an infinite loop: you can have
> upwards hard links as well (at least on *nix). You have to keep a
> list of inodes you've already visited (per filesystem, of course).
I believe hard linked directories are banned to avoid this problem. This
is true on Linux at least, I don't know what POSIX specifies.
Duncan
More information about the Haskell
mailing list