
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
`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
"Jeremy Maitin-Shepard" <jbms@attbi.com> wrote in message news:878yi09w29.fsf@jbms.ath.cx... the the
problem of the traversal being limited by the number of open file handles/descriptors a single process can have.
I understand the reluctance to add a feature which raises such thorny issues. However, I think the fact that recursive directory iteration is hard to implement properly is an excellent reason to put it in a library. I would imagine that a lot of existing code doesn't handle all these issues correctly. Limitations of the implementation can be explained in the documentation. Jonathan