Strange 'find' results, noleaf option for cdroms

Extracted from debian-user
Tip provided by Marcus Brinkmann
> > > Can somebody explain this to me?
> > >
> > > $ find /cdrom -iname wx*
> > > $ find /cdrom -iname wxx*
> > > /cdrom/debian/hamm/hamm/binary-i386/libs/wxxt1_1.66d-2.deb
> > >
> > > Why does the first 'find' query give no results?
> >
> > Are you quoting the argument to avoid shell expansion?
> >
> > $ find /cdrom -iname 'wx*'
>
> No.  I just did it as it was printed above.
>
> Today is another day.  I did the same thing and here is the result:
> (I was in my home directory as I was yesterday)
>
> jhspies@Johann(8)$ find /cdrom -iname wx*
> find: paths must precede expression
> Usage: find [path...] [expression]
> jhspies@Johann(9)$ cd /
> jhspies@Johann(10)$ find /cdrom -iname wx*
> /cdrom/debian/hamm/hamm/binary-i386/doc/wxhelp_1.66d-2.deb
> /cdrom/debian/hamm/hamm/binary-i386/libs/wxxt1_1.66d-2.deb
>
> Anyhow, it is not a problem for me.  I was just curious on why the strange
> result.  Now I am wondering why I did not get the same result today?
 
 Eh, note that find does special optimization which does not work on CD
 ROM's. It assumes that two directories are "." and "..". From the info
 page:
 
  - Option: -noleaf
      Do not optimize by assuming that directories contain 2 fewer
      subdirectories than their hard link count.  This option is needed
      when searching filesystems that do not follow the Unix
      directory-link convention, such as CD-ROM or MS-DOS filesystems or
      AFS volume mount points.  Each directory on a normal Unix
      filesystem has at least 2 hard links: its name and its `.'  entry.
      Additionally, its subdirectories (if any) each have a `..'  entry
      linked to that directory.  When `find' is examining a directory,
      after it has statted 2 fewer subdirectories than the directory's
      link count, it knows that the rest of the entries in the directory
      are non-directories ("leaf" files in the directory tree).  If only
      the files' names need to be examined, there is no need to stat
      them; this gives a significant increase in search speed.

Follow-up :
| Previous | Next | Index of category | Main Index | Submit |


Appears in section(s) : disk FMTYWTK
Tip recorded : 16-05-1999 23:10:18
HTML page last changed : 27-07-1999 20:11:08