
Making it handle symbolic links properly is certainly not trivial, and cannot be done efficiently with the current version of the filesystem library (assuming no additional platform-specific code is added). As has been discussed already in relation to the implementation of the `equivalent' function which Beman is adding, the common implementation is to store the inode numbers of every directory with a link count greater than one in a hash set, and then make sure that they are traversed only once. This implementation is not perfect, however, because most platforms, including Windows and Linux, do not guarantee that inode numbers are unique for files for which there is not an open handle. Thus, the way to remedy this would be to keep an open handle to each directory whose inode number is being stored; but this creates the problem of the traversal being limited by the number of open file handles/descriptors a single process can have. -- Jeremy Maitin-Shepard