Should find traverse symbolic links?
Dan Bernstein
brnstnd at kramden.acf.nyu.edu
Sat Mar 2 12:43:43 AEST 1991
Side issue: Traversing the entire file system makes sense, but it really
doesn't work for many applications. Any program that returns a list of
all objects satisfying property P, one at a time, had better make two
things true: 1. If an object is returned in the list, it must have had
property P sometime while the program was running. 2. There must be some
period of time so that (a) the program is not running except during that
period (and maybe less); (b) if any object has property P throughout
that period, then it is returned in the list.
find guarantees #1 but not #2. If someone moves a directory while you're
removing all core files or recording all setuid scripts or whatever, you
may miss some files.
(Note that most versions of readdir() don't guarantee #2, and some don't
even guarantee #1. This unreliability is a royal pain.)
It would be much better to have openinodes() and readinodes() calls to
traverse the set of inodes in a given filesystem, one by one. Then both
#1 and #2 would be true, and a lot of file-tree walk code could be done
away with. This could even be made available to normal users who want to
walk through all the files they own.
---Dan
More information about the Comp.unix.wizards
mailing list