Bug 135952
Summary: | updatedb doesn't use /etc/updatedb.conf | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | Red Hat Enterprise Linux 3 | Reporter: | Andrey Yushkov <ayushkov> | ||||||||
Component: | slocate | Assignee: | Miloslav Trmač <mitr> | ||||||||
Status: | CLOSED NEXTRELEASE | QA Contact: | |||||||||
Severity: | low | Docs Contact: | |||||||||
Priority: | medium | ||||||||||
Version: | 3.0 | CC: | bl_fedora, gdr | ||||||||
Target Milestone: | --- | ||||||||||
Target Release: | --- | ||||||||||
Hardware: | All | ||||||||||
OS: | Linux | ||||||||||
Whiteboard: | |||||||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||||||
Doc Text: | Story Points: | --- | |||||||||
Clone Of: | |||||||||||
: | 483794 (view as bug list) | Environment: | |||||||||
Last Closed: | 2005-06-11 12:22:02 UTC | Type: | --- | ||||||||
Regression: | --- | Mount Type: | --- | ||||||||
Documentation: | --- | CRM: | |||||||||
Verified Versions: | Category: | --- | |||||||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||||
Cloudforms Team: | --- | Target Upstream Version: | |||||||||
Embargoed: | |||||||||||
Bug Depends On: | |||||||||||
Bug Blocks: | 483794 | ||||||||||
Attachments: |
|
Description
Andrey Yushkov
2004-10-15 20:51:23 UTC
I can verify that running updatedb through /etc/cron.daily/slocate.cron does seem to ignore PRUNEPATHS environment variable set in /etc/updatedb.conf. To work around this problem, I have had to modify the PRUNEPATHS variable set in /etc/updatedb.conf to use comma-delimited paths, then add -e ${PRUNEPATHS} as arguments to the slocate.cron script. Forgot one step to fix, I also had to tell the slocate.cron script to execute /etc/updatedb.conf, like FC3 does. This bug also affects FC3 (and at least FC2 as well). Created attachment 110848 [details]
workaround
A workaround that covers at least the PRUNEPATHS case. I don't know
if PRUNEFS is also a problem.
The problem appears to be that when invoked as updatedb (or with the option -c), it reads the /etc/updatedb.conf, but it cannot parse it well. The /etc/cron.daily/slocate.cron implies that it executes /etc/updatedb.conf as a script, when in fact updatedb ignores everything executed in it. I'd like to illustrate that with examples. I will attach two examples of /etc/updatedb.conf, and you can try them by doing the following: - backup your current /etc/updatedb.conf where you can restore it later. - note the size of the /var/lib/slocate/slocate.db file. This is the size when the filesystems and paths that should be pruned are indeed pruned. - For each of the following two examples of updatedb.conf, copy them to /etc/updatedb.conf, run /etc/cron.daily/slocate.cron, and note the size of the resulting /var/lib/slocate/slocate.db - when you are done, restore your old updatedb.conf, and rerun the slocate.cron script to restore everything back the way it should. Created attachment 111344 [details]
test case 1 - not intended as permanent updatedb.conf
Created attachment 111345 [details]
test case 2: not intended as a permanent updatedb.conf
Bjorn, thanks a lot for the test cases! I knew that sourcing updatedb.conf in slocate.cron had no effect, but updatedb.conf was working perfectly for me. Both the problem and its cause is obvious with your examples. I see two solutions: - Either document in /etc/updatedb.conf exactly how the updatedb program parses it, and delete the ". /etc/updatedb.conf" line in the /etc/cron.daily/slocate.cron file, so people are not confused OR (preferably, in my opinion) - Leave the /etc/updatedb.conf as a script that exports the PRUNEFS and PRUNEPATHS variables, and then in /etc/cron.daily/slocate.cron execute the following: /usr/bin/slocate -u -e $PRUNEPATHS -f $PRUNEFS instead of the current call to /usr/bin/updatedb. Note that the -e and -f parameters are to comma-delimited, so either it needs to be that way in /etc/updatedb.conf, or you can execute the 'sed' command that Devin Reade proposed: sed -e 's/ */,/g;'` I prefer actually fixing the updatedb parser :) slocate-2.7-17, to appear in rawhide soon, ignores comments in /etc/updatedb.conf. If there are multiple definitions of the same PRUNE* variable, the first one is used; I think it is more important to preserve compatibility with previous slocate versions than compatibility with GNU locate (which we stopped using sometime around RHL 6.0). The new slocate does indeed ignore comments. You mention two clauses: 1. ignores comments in /etc/updatedb.conf 2. If there are multiple definitions of the same PRUNE* variable, the first one is used. But even if these two clauses are met, you can still have problems. (These two clauses take care of the two earlier examples, but they were just examples, not an exhaustive listing.) The following three examples meet the above two conditions, and a user might expect the following to work, as they do for shell variables: 1. PRUNEPATHS = \ "/tmp /usr/tmp /var/tmp /afs /net /sfs /selinux /udev /mnt/floppy" 2. PRUNEPATHS = '/tmp /usr/tmp /var/tmp /afs /net /sfs' 3. PRUNEPATHS = "/tmp /udev /disk*" (for 3., assume that the system has /disk1, /disk2, etc.) So I think that it is still worth documenting updatedb.conf someplace. Currently, neither the updatedb.conf, nor the man pages of slocate and updatedb mention updatedb.conf, so a user has no obvious way to even know that the updatedb program uses that file. My concern about documenting the format is that the format is very close to that of setting variables in a shell, but not the same. For example, it is possible to use multi-line statements. But not like in example 1 above. Instead, the following works: PRUNEPATHS="/tmp /usr/tmp /var/tmp /afs /net /sfs /selinux /udev /mnt/floppy" OK, that is a good reason to add updatedb.conf(5), added in rawhide slocate-2.7-19. (Note that multi-line statements working this way are probably working only because the parser is very permissive, not by design - and it is possible they will stop working in a new upstream slocate version.) Excellent! That's what we needed. This will be fixed in RHEL 5. |