On 8/18/07, James G. Sack (jim) <[EMAIL PROTECTED]> wrote:
> Carl Lowenstein wrote:
> > On 8/18/07, James G. Sack (jim) <[EMAIL PROTECTED]> wrote:
> >> Carl Lowenstein wrote:
> >>> On 8/17/07, Gus Wirth <[EMAIL PROTECTED]> wrote:
> >>>> Fedora 5 has mlocate, which is different from both but tries to be
> >>>> compatible. It is written by Miloslav Trmac of Redhat. It doesn't seem
> >>>> to have any file size issues.
> >>>>
> >>> 1) I don't see why the combination "updatedb/slocate" should care
> >>> about file sizes, since it is only asked to create and search a list
> >>> of file names.
> >>>
> >>>
> >> Locate doesn't show files that do not exist any longer, or those that
> >> the user can't access because of perms.
> >
> > Well, locate shows files that existed at the last time that updatedb
> > was run.  Also (s)locate can be run as root to show files that the
> > ordinary user can't access.
>
> Oh yeah, I do recall seeing removed files.
> Maybe slocate and mlocate _may_ behave differently in that respect?

Just to restate the approximately obvious.  The various locate
programs work from a database that was built some time in the past by
their associated "updatedb" program.  So they look at the state of the
file system as of some time in the past.

> >
> >> I have confirmed (in ubu 7.04 32bit) the behavior you describe. Running
> >> an strace is informative: It shows calls to lstat64 and access.
> >
> > Are you tracing locate or updatedb?   In other words, is the problem
> > in using the database or in building it.
>
> locate.
>   sudo strace -o /tmp/s.out locate '*DVD*iso'
>
> I know the leading * is redundant, but maybe only is some locates. It
> does seem to behave different in {s,m}locate on ubu704/f7.
>
> >
> >> On a 64bit f7, there are calls to access, but not any lstat.
> >>
> >> I bet a look at the code in the vicinity of the lstat64 call might show
> >> a variable type mismatch.
> >
> > Interesting that Ubuntu does not use mlocate (a RedHat innovation).  I
> > am not quite sure what code to look at.  Namely I need the source code
> > that matches the programs that I am using.  Have to think about that
> > too.
>
> dpkg --listfiles slocate
>  shows /usr/bin/locate
> I guess the slocate source is the thing to examine. I'm betting it's a
> classic type overflow bug.
>

I went off in a different direction, and downloaded the source for GNU
findutils 4.2.31.  Built, installed in /usr/local so it didn't
interfere with anything else.

Create (as me) a private copy of the database, not reading anything
which requires root priv's.
$ /usr/local/updatedb --output=/var/tmp/locatedb 2>/dev/null

Search this database for files that I know should be found:
$ /usr/local/bin/locate -d /var/tmp/locatedb -i centos | grep '\.iso$'
finds all 8 files that it should, including the 2 oversize files that
Fedora slocate misses.

So it is fixed there.  Now I will look for slocate sources.

    carl
-- 
    carl lowenstein         marine physical lab     u.c. san diego
                                                 [EMAIL PROTECTED]


-- 
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list

Reply via email to