[comp.unix.i386] find: stat

src@scuzzy.mbx.sub.org (Heiko Blume) (08/10/90)

well, i have this *really* *very* *weird* problem with ISC 2.2:
when i do a 'find /usr -name bla' as *root* i get

find: stat() failed: /usr/admin/cops/user.chk: No such file or directory
find: stat() failed: /usr/admin/dead.letter: No such file or directory
find: stat() failed: /usr/mail: No such file or directory
[.......]
find: stat() failed: /usr/guest: No such file or directory
find: stat() failed: /usr/chris: No such file or directory

for all directories in /usr, but *not* for all *files* below /usr.
in fact the first two *files* (as opposed to directories) are the
only files find doesn't like.
of course all these do exist and can be cd'd to, read, whatever.
my system work just perfectly, without any trouble whatsoever.
the *real* fun is: this only occurs when i'm logged in as root!
when i'm any other user i *DON'T* get these messages !!!!
btw: i didn't change /etc/profile and it happens in sh as well as in csh.
it also happens when is su(1) from any user to do the find.
i should note that /usr is a mount point. i tried the find on other
mount points without problems. 
anyone ever seen this ???

-- 
Heiko Blume c/o Diakite   blume@scuzzy.mbx.sub.org    FAX   (+49 30) 882 50 65
Kottbusser Damm 28        blume@netmbx.UUCP           VOICE (+49 30) 691 88 93
D-1000 Berlin 61          blume@netmbx.de             TELEX 184174 intro d
scuzzy Any ACU,e 19200 6919520 ogin:--ogin: nuucp ssword: nuucp

eric@femto.mks.com (Eric Gisin) (08/20/90)

In article <1990Aug09.232824.10717@scuzzy.mbx.sub.org> src@scuzzy.mbx.sub.org (Heiko Blume) writes:

   well, i have this *really* *very* *weird* problem with ISC 2.2:
   when i do a 'find /usr -name bla' as *root* i get

   find: stat() failed: /usr/admin/cops/user.chk: No such file or directory
   find: stat() failed: /usr/admin/dead.letter: No such file or directory
   find: stat() failed: /usr/mail: No such file or directory
   [.......]
   find: stat() failed: /usr/guest: No such file or directory
   find: stat() failed: /usr/chris: No such file or directory

   for all directories in /usr, but *not* for all *files* below /usr.
   in fact the first two *files* (as opposed to directories) are the
   only files find doesn't like.

This is due to a bug in find combined with a corrupt directory.
/usr/admin/cops or some subdirectory has an incorrect .. link.
Unfortunatly fsck does not fix this or even give a warning (another bug).
The way to find such problems is to cd to the suspect directories
(/usr/admin and /usr/admin/cops) and do an "ls -id . */..".
All the i-numbers should be the same.  When you find a bad directory,
use /etc/unlink to remove ".." and "/etc/link .. <path-of-parent-dir>"
to recreate "..".

The bug in find is that it uses chdir(dir) and chdir("..")
to move up and down the directory tree. If the .. link is incorrect,
find gets confused.
This also causes problems over NFS file systems that support sym links.
Most likely /usr/admin/cops is only readable by root,
so this only happens as root.