I believe the implementation of find -xdev is incorrect
(in BB V1.19.4 tested on a MIPS), in that it is doing the
device crossing exclusion incorrectly.

The short description is that some files can get processed
more than once.  We are using find to make a file tree map,
for debugging purposes, and we don't want it to process
some devices.  (Especially /proc and /sys virtual FS's.)
Simplified, our system has a read-only root filesystem,
with /tmp mounted as a ramdisk.  We run:

        find / /tmp -xdev >/tmp/ftw.txt

The purpose of this is to see all 'normal' space-consuming
files in the system, so that extraneous files may be detected.
(This is a forensic tool, part of a much larger state capture
system.  Our find invocation is actually quite a bit more
elaborate than this, as is the filesystem map, but this
simplified version illustrates the point.)

Using upstream gnu findutils find, this works perfectly.
Using BB find, we get the files in /tmp _twice_!

The reason is the way BB find implements xdev.  Upstream xdev,
IIRC, does what one would expect: if it finds a directory with
a _different_ st_dev field than its parent, and -xdev is on,
it does not recurse down it.  BB find, instead, makes a list
of the st_devs of the start-points given it, and any st_dev
on that list is A-OK with it whenever it finds it, else it
skips the directory.

That fails, because it's not unusual for multiple starting
points in -xdev world to be mounted on each other in some
fashion.  If so, they'll get processed twice: once because
it was told to start there, and once when it finds that
mount point elsewhere.

-- Jim

_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to