Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 35084 - No /etc/updatedb.conf file causes error message when /etc/cron.daily/slocate runs
Summary: No /etc/updatedb.conf file causes error message when /etc/cron.daily/slocate ...
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High trivial (vote)
Assignee: SpanKY
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-12-04 13:21 UTC by Paul Varner (RETIRED)
Modified: 2003-12-11 16:24 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
/etc/cron.daily/slocate patch (slocate.patch,382 bytes, patch)
2003-12-04 13:22 UTC, Paul Varner (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Varner (RETIRED) gentoo-dev 2003-12-04 13:21:37 UTC
If there is no /etc/updatedb.conf file, the /etc/cron.daily/slocate script mails
the following error message to root
warning: updatedb: could not access /etc/updatedb.conf: open: No such file or
directory

The problem is that the updatedb command always tries to parse the file when run
and thus will always print the error message.  Looking at the script, it seems
to me that if we are going to check for the presence of the file, then if it
isn't there we should update the slocate database in a way that doesn't generate
an error message.  However, I can also see that point that we should generate
the error message since a default /etc/updatedb.conf is distributed with the
package. I am attaching a patch that will change the script so that it doesn't
generate an error message all the time, but prints an error message only if the
administrator desires.

Reproducible: Always
Steps to Reproduce:
1. mv /etc/updatedb.conf /etc/updatedb.conf.orig
2. execute /etc/cron.daily/slocate
3.

Actual Results:  
Error message: warning: updatedb: could not access /etc/updatedb.conf: open: No
such file or directory is printed

Expected Results:  
No output.

Portage 2.0.49-r15 (default-x86-1.4, gcc-3.2.3, glibc-2.3.2-r3, 2.4.20-gentoo-r9)
=================================================================
System uname: 2.4.20-gentoo-r9 i586 Pentium MMX
Gentoo Base System version 1.4.3.10p1
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-O2 -march=pentium-mmx -pipe"
CHOST="i586-pc-linux-gnu"
COMPILER="gcc3"
CONFIG_PROTECT="/etc /var/qmail/control /usr/share/config
/usr/kde/2/share/config /usr/kde/3/share/config /var/bind"
CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d"
CXXFLAGS="-O2 -march=pentium-mmx -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="sandbox ccache autoaddcvs fixpackages"
GENTOO_MIRRORS="http://gentoo.oregonstate.edu
http://distro.ibiblio.org/pub/Linux/distributions/gentoo"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 apm crypt cups foomaticdb gpm libwww ncurses nls pdflib slang spell
svga xml2 zlib gdbm berkdb readline tcpd pam ssl perl python cdr mbox ppds samba
sasl usb -oss -arts -avi -encode -gif -gtk -imlib -jpeg -kde -gnome -libg++ -mad
-mikmod -motif -mpeg -oggvorbis -opengl -png -qt -quicktime -sdl -truetype -X
-xmms -xv"
Comment 1 Paul Varner (RETIRED) gentoo-dev 2003-12-04 13:22:59 UTC
Created attachment 21708 [details, diff]
/etc/cron.daily/slocate patch
Comment 2 Mr. Bones. (RETIRED) gentoo-dev 2003-12-04 16:42:28 UTC
From the updatedb man page:

updatedb  is  simply  a  link  to slocate that implies the -u option.
 
OPTIONS
       -u     Create slocate database starting at the root directory.  This is
              the default behavior when called as updatedb.

So... how does your patch make a difference in the behavior?  That seems odd.

Also, there should be a default /etc/updatedb.conf file installed by the ebuild.
What happened to it on your system?
Comment 3 Paul Varner (RETIRED) gentoo-dev 2003-12-04 18:37:44 UTC
Actually updatedb implies "slocate -u -c", from the README file in /usr/share/doc/slocate-2.7-r2 "If you symlinked /usr/local/bin/slocate to /usr/local/bin/updatedb, then executing the updatedb command will automatically index the  root filesystem starting at '/'.  This will also cause the file '/etc/updatedb.conf' to be parsed. This file is in the same format as the original updatedb.sh configuration file."

My updatedb.conf file is still in place, A user on the gentoo-user mailing list wanted to know how to add "/home/*/.Maildir" to the paths to be pruned.  Since I had done something similar a long time ago with the findutils version of locate, I was trying to see how to do it with slocate.  In the process, I moved /etc/updatedb.conf to /etc/updatedb.conf.orig while testing behavior.  That is when I discovered that the updatedb command tries to always parse /etc/updatedb.conf

Here is the behavior when run on my machine:
garion root # ls -l /etc/updatedb.conf
ls: /etc/updatedb.conf: No such file or directory
garion root # updatedb
warning: updatedb: could not access /etc/updatedb.conf: open: No such file or directory
garion root # slocate -u
garion root # slocate -u -c
warning: slocate: could not access /etc/updatedb.conf: open: No such file or directory
garion root # mv /etc/updatedb.conf.orig /etc/updatedb.conf
garion root # ls -l /etc/updatedb.conf
-rw-r--r--    1 root     root          586 Dec  4 13:47 /etc/updatedb.conf
garion root # cat /etc/updatedb.conf
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /home/cvsroot/gentoo-x86/sys-apps/slocate/files/updatedb.conf,v 1.4 2003/04/18 02:42:14 lostlogic Exp $

# This file sets environment variables which are used by updatedb

# filesystems which are pruned from updatedb database
PRUNEFS="NFS nfs afs proc smbfs autofs auto iso9660 devfs tmpfs ncpfs"
export PRUNEFS
# paths which are pruned from updatedb database
PRUNEPATHS="/tmp /var/tmp"
export PRUNEPATHS
# netpaths which are added
NETPATHS=""
export NETPATHS
garion root # slocate -u; locate /proc/cpu
/proc/cpuinfo
garion root # slocate -u -c; locate /proc/cpu
garion root #
Comment 4 SpanKY gentoo-dev 2003-12-04 18:43:44 UTC
-u is implied only if slocate is called as 'updatedb'
if you call it as 'slocate' you need to include -u

i'll do up the patch if no one else cares
Comment 5 Mr. Bones. (RETIRED) gentoo-dev 2003-12-04 19:29:29 UTC
This looks like a bug in slocate to me.  The man page should say that it
will always look at /etc/updatedb.conf if called as updatedb because that's
what the code does.  upstream probably needs to be made aware of this little
inconsistency in the documentation and behavior.

The patch looks good to me.
Comment 6 Seemant Kulleen (RETIRED) gentoo-dev 2003-12-09 02:22:32 UTC
go for it, spanky
Comment 7 SpanKY gentoo-dev 2003-12-11 16:24:03 UTC
ok, i e-mailed the upstream author about this ... hopefully it should be fixed in future release

thanks for the catch mr bones