On 2 February 2010 10:08, Jeff Rose <ros...@gmail.com> wrote:
> So what would that look like?  Is it sufficient to throw every
> canonical directory path in a set and test for membership before
> traversing down any directory?

Yes, I think so, as long as you can fit all of them in memory.

The other thing you could do is make sure not to follow symlinks.

> Or is that even sufficient because you
> could arrive at the same location through different paths...  I wonder

No, they will all have the same canonical path.  That's what canonical means :)

> if you can get something more unique, like an inode ID or something
> along those lines?

The canonical path should be just as unique as the inode number in
theory.  I don't know how it deals with things like bind mounts etc.
in practice, but I don't think that should cause problems, because you
can't create loops with bind mounts (AFAIK).

Of course the above is Unix-centric.  On Windows you might not have
inode numbers (VFAT.  Not sure if ntfs has an inode number
equivalent.)  Also, I think I've heard that in Windows you can create
hard links to directories, so I don't know how they avoid loops.

> On Feb 1, 11:21 pm, ataggart <alex.tagg...@gmail.com> wrote:
>> On Feb 1, 2:14 pm, Jim Van Donsel <j...@jimandbarb.net> wrote:
>>
>> > Fair enough.
>>
>> > But I guess the moral is that a file-seq should not be used unless you
>> > have a well-controlled filesystem.
>>
>> Or more generally, all sequences may be infinite unless you know the
>> backing data has no cycles, or you have some terminating/filtering
>> conditions.

-- 
Michael Wood <esiot...@gmail.com>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to