find: stat() failed: /usr/adm - no such file or directory

Eric Gisin eric at femto.mks.com
Mon Aug 20 21:28:24 AEST 1990


In article <1990Aug09.232824.10717 at scuzzy.mbx.sub.org> src at 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.



More information about the Comp.unix.i386 mailing list