stat(2) fails when calling find(1)

stat(2) fails when calling find(1)

Post by Tom Reingo » Fri, 26 Jul 1991 00:26:33



I have a problem with my files.  The find(1) program cannot stat(2) a
bunch of files and directories under my home directory.  It says

        find: stat() failed: fu: No such file or directory

I wrote a little program that calls stat(2) and that works fine on
these files.

This is bad for me, because the system backups are based on find(1) and
cpio(1).

The system is at AT&T 3b2 model 600 running System V Release 3.1.1.

Anyone know what could cause stat(2) to fail at this point?
--
        Tom Reingold

        "Warning: Do not drive with Auto-Shade in place.  Remove
        from windshield before starting ignition."

 
 
 

stat(2) fails when calling find(1)

Post by Nicole Delbecque & Paul Bijne » Sat, 27 Jul 1991 09:13:48



says:

Quote:

>I have a problem with my files.  The find(1) program cannot stat(2) a
>bunch of files and directories under my home directory.  It says

>        find: stat() failed: fu: No such file or directory

>I wrote a little program that calls stat(2) and that works fine on
>these files.

>The system is at AT&T 3b2 model 600 running System V Release 3.1.1.

>Anyone know what could cause stat(2) to fail at this point?

Have you by any chance made a link from a subdirectory to two
different parent directories? something like:

           home
          /    \
        dir1   dir2
       /   \  /    \
otherdirs  dir3     otherdirs
           /  \

The directory "dir3" now has an extra parent directory!
This SHOULD NOT HAPPEN.  But you can easily create it with /etc/link.
(/etc/link is only executable by root "who hopefully knows what he
is doing").
Suppose the ".." of "dir3" points to "dir2".  Now find descends
via "dir1" to "dir3" and after all subdirs in "dir3" goes back up
to ".." now coming in "dir2" instead of back in "dir1".  Now
where are all the files gone?  It thinks it is in "dir1".

Clean your directory structure:  find expects to search in a
strictly hierachical (sp?) filesystem (symbolic links aside).
--
Polleke   (Paul Bijnens)
Linguistics dept., K. University Leuven, Belgium