Bug in slocate/updatedb



This is a bug report, for want of a better place to put it.

There's a random bug in "updatedb" which causes it to stop immediately
without an error message and creating an 1-byte long database.

However, if you run "slocate -u", it works fine.

"updatedb" is supposed to be the same as "slocate -u", but if you read
the source code, you'll find that they are a little different in
operation.

I didn't have time to track down the bug, but no doubt it is due to
the poor coding of the programmers who wrote it. There's lots of
malloc's around all over the palce, and pointers pointing to who knows
where.

The workaround is to remove /usr/bin/updatedb (which is a link to
slocate), and replace it with this shell script:

#!/bin/bash

# slocate -u works, updatedb doesn't sometimes.
# I've debugged the program and just found that it is buggy.
# This is an easy workaround.
slocate -u "$@"

.



Relevant Pages

  • Re: updatedb
    ... updatedb is simply a link to slocate with -u option. ... Krish ... > Trinity University ...
    (Fedora)
  • Re: Slocate - what is happening?
    ... > Still fantastic but I have a weird problem with slocate that was not ther ... When I go to create the database with updatedb the system ... I suspect that the answer is simpler than reinstalling and wonder ...
    (alt.os.linux.redhat)
  • Re: using find command to search in current directory only
    ... look at how GNU locate (not slocate) works. ... >> updatedb as, same for the solution given above. ... permissions to the database, or regular users couldn't access it. ... My code in this post is copyright 2004, Chris F.A. Johnson and may be copied under the terms of the GNU General Public License ...
    (comp.unix.shell)
  • Re: Missing files in locatedb
    ... /etc/updatedb.conf; updatedb ... I use package 'slocate' instead of 'locate': ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
    (Debian-User)
  • Re: slocate doesnt
    ... I would expect that "slocate -u" and "updatedb" to be one and the same, but give the "updatedb" command a try and see if that solves it. ... veritatis simplex oratio est ...
    (RedHat)