At 06:36 AM 4/22/2003, Ben Hutchings wrote:
...Is it desirable that links be resolved? I suppose it is if the iterator is being used to walk a whole tree - but not if it's being used to list a single directory.
Here is the rationale for resolving links: if links are resolved, then applications desiring resolution work, and by querying attributes, applications not desiring resolution also work. If links are ignored, then there is no way to for applications desiring resolution to work.
Perhaps there is a need to include explicit support for links in the API. Windows has supported them since 2000, so they aren't just a Unix thing now.
Keep in mind that there are two forms of links - the simplest kind acts like a pointer, and like a pointer, can fail if the pointed to entry is removed. The other kind of link is more like a reference counted smart pointer, where the only way to access the entry is via the link. That provides much more disciplined link management, since the actual filesystem object never goes away as long as any links are present. It wouldn't surprise me if there were also some other kinds of links out there, with still different behavior. --Beman