LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices



Reply
 
Search this Thread
Old 04-25-2012, 02:14 PM   #1
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,285

Rep: Reputation: 49
Does locate update its database each time I remove a file?


Hi: What's asked.

Kernel 2.6.21.5, Slackware 12.0
slocate 3.1
 
Old 04-25-2012, 02:20 PM   #2
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Linux Mint
Posts: 8,516

Rep: Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896
No, you need to run
Code:
updatedb
You can use a cronjob if needed.

Kind regards
 
Old 04-25-2012, 02:24 PM   #3
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,285

Original Poster
Rep: Reputation: 49
However, I've just made a test, running locate and then removing (rm) one of the listed files, and locate did not listed. How can that be?

Last edited by stf92; 04-25-2012 at 02:33 PM.
 
Old 04-25-2012, 02:39 PM   #4
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Linux Mint
Posts: 8,516

Rep: Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896
You are right, curious to know how this works.

Kind regards
 
Old 04-25-2012, 03:36 PM   #5
astrogeek
Senior Member
 
Registered: Oct 2008
Distribution: Slackware [64]X{.0|.1|.2|-current} ::X>=12<=14, FreeBSD_10{.0|.1}
Posts: 2,184

Rep: Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860
From the slocate manual:

Quote:
Secure Locate provides a secure way to index and quickly search for all files on your system regardless
of ownership. It uses incremental encoding just like GNU locate to compress its database to make search-
ing faster, but it will also check file permissions and ownership before displaying matched entries so
that users will not see files they do not have access to
Presumably that would imply that if the file no longer exists then the user would not have access to it and it would not be displayed.
 
Old 04-25-2012, 04:56 PM   #6
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,285

Original Poster
Rep: Reputation: 49
I would swear that locate went on displaying erased files long time after they had been erased as long as I did not run updatedb! What is curious is that I have not changed my slackware version.
 
Old 04-25-2012, 05:05 PM   #7
astrogeek
Senior Member
 
Registered: Oct 2008
Distribution: Slackware [64]X{.0|.1|.2|-current} ::X>=12<=14, FreeBSD_10{.0|.1}
Posts: 2,184

Rep: Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860
Just a guess: Perhaps if you use locate as root it determines that you have no access restrictions and bypasses the permission tests - and therefore the 'existance' test as well.

Last edited by astrogeek; 04-25-2012 at 06:17 PM.
 
Old 04-25-2012, 06:42 PM   #8
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,285

Original Poster
Rep: Reputation: 49
It happens that I always run locate as root.
 
Old 04-25-2012, 08:05 PM   #9
manu-tm
Member
 
Registered: May 2008
Location: France
Distribution: Ubuntu, Debian
Posts: 260

Rep: Reputation: 32
I'm not on Slackware. On Ubuntu, I always run updatedb as root. After that locate always give correct results.
 
Old 04-25-2012, 09:54 PM   #10
chrisretusn
Member
 
Registered: Dec 2005
Location: Philippines
Distribution: Slackware
Posts: 508

Rep: Reputation: Disabled
Quote:
Originally Posted by stf92 View Post
Hi: What's asked.

Kernel 2.6.21.5, Slackware 12.0
slocate 3.1
No If you delete a file, it remains in slocate.db until the next update. That said, if you subsequently searched for that deleted file, locate (slocate) checks for physical existence, because that file no longer exist, it's entry in slocate.db will be removed. In this case the database is updated.

FYI, with a default, normal install of Slackware, updatedb is run daily at 0440 via a cron script in /etc/cron.daily/

Last edited by chrisretusn; 04-25-2012 at 09:56 PM.
 
1 members found this post helpful.
Old 04-25-2012, 10:28 PM   #11
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,285

Original Poster
Rep: Reputation: 49
Thanks very much. As to cron.daily, I removed the entry because sometimes updatedb began to run while I was burning optical media.
 
Old 04-26-2012, 10:33 AM   #12
chrisretusn
Member
 
Registered: Dec 2005
Location: Philippines
Distribution: Slackware
Posts: 508

Rep: Reputation: Disabled
Burning disk at 4:40am? That's dedication....

That shouldn't effect burning media, especially since updatedb is started with:
Code:
ionice -c3 nice -n 19 /usr/bin/updatedb -c /etc/updatedb.conf
 
Old 04-26-2012, 12:44 PM   #13
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950
Note also that locate has two options (-e/-E) that check whether each matching file actually exists at that time, before printing the results. See the man page.
 
Old 04-26-2012, 12:55 PM   #14
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,285

Original Poster
Rep: Reputation: 49
Well, my version is 3.1, from 2006, and only has
-e <dir1, dir2, ...>
which excludes those directories from the locate database.

This -e option would be very handy for me if only I knew how to use it. What I see is that
Code:
semoi@darkstar:/hdaal/sma_/info$ locate  beethoven
/home/semoi/bee9/beethoven9.md5
/home/semoi/bee9/beethoven-9-04-concertgebouw-klemperer-1956-16048.flac
/home/semoi/bee9/beethoven-9-01-concertgebouw-klemperer-1956-16048.flac
/home/semoi/bee9/beethoven-9-02-concertgebouw-klemperer-1956-16048.flac
/home/semoi/bee9/beethoven-9-03-concertgebouw-klemperer-1956-16048.flac
/home/semoi/beethoven9_vbr.m3u
semoi@darkstar:/hdaal/sma_/info$ locate  -e /home/semoi/bee9 beethoven
/home/semoi/bee9/beethoven9.md5
/home/semoi/bee9/beethoven-9-04-concertgebouw-klemperer-1956-16048.flac
/home/semoi/bee9/beethoven-9-01-concertgebouw-klemperer-1956-16048.flac
/home/semoi/bee9/beethoven-9-02-concertgebouw-klemperer-1956-16048.flac
/home/semoi/bee9/beethoven-9-03-concertgebouw-klemperer-1956-16048.flac
/home/semoi/beethoven9_vbr.m3u
semoi@darkstar:/hdaal/sma_/info$
That is, /home/semoi/bee9 was not excluded!

Last edited by stf92; 04-26-2012 at 01:25 PM.
 
Old 04-27-2012, 07:18 AM   #15
chrisretusn
Member
 
Registered: Dec 2005
Location: Philippines
Distribution: Slackware
Posts: 508

Rep: Reputation: Disabled
The -e option is used in combination with the -u or-U options.

from locate, slocate, updatedb --help
Code:
   -e <dir1,dir2,...> - Exclude directories from the slocate database when
                        using the -u or -U options.
You best bet to exclude would be to add /home/semoi/bee9 to /etc/updatedb.conf

Code:
# /etc/updatedb.conf:  slocate configuration file

PRUNEFS="devpts NFS nfs afs proc smbfs autofs iso9660 udf tmpfs cifs"
PRUNEPATHS="/dev /proc /sys /tmp /usr/tmp /var/tmp /afs /net /media /mnt /home/semoi/bee9"
export PRUNEFS
export PRUNEPATHS
You will have to run updatedb again.

Last edited by chrisretusn; 04-27-2012 at 07:22 AM. Reason: Add sample config
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Remove time stamps from text file Ashex Linux - General 1 08-23-2011 10:16 PM
how to configure updatedb to update locate database manually septanla Linux - General 4 12-22-2010 03:05 PM
(my)sql: drop database doesn't remove database kpachopoulos Programming 3 09-19-2007 02:32 PM
Where is locate's database? armandino Linux - Software 1 03-14-2007 12:21 PM
database and locate mikeshn Linux - General 1 01-19-2004 09:39 AM


All times are GMT -5. The time now is 01:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration