Path: utzoo!attcan!uunet!zephyr.ens.tek.com!uw-beaver!milton!dali.cs.montana.edu!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!rpi!uupsi!cmcl2!kramden.acf.nyu.edu!brnstnd From: brnstnd@kramden.acf.nyu.edu (Dan Bernstein) Newsgroups: comp.unix.wizards Subject: Re: Should find traverse symbolic links? Message-ID: <6528:Mar201:43:4391@kramden.acf.nyu.edu> Date: 2 Mar 91 01:43:43 GMT References: <15319@smoke.brl.mil> <124226@uunet.UU.NET> <1888@mitisft.Convergent.COM> Organization: IR Lines: 23 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