LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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, 01:14 PM   #1
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Rep: Reputation: 76
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, 01:20 PM   #2
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

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

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

Original Poster
Rep: Reputation: 76
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 01:33 PM.
 
Old 04-25-2012, 01:39 PM   #4
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

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

Kind regards
 
Old 04-25-2012, 02:36 PM   #5
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
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, 03:56 PM   #6
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
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, 04:05 PM   #7
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
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 05:17 PM.
 
Old 04-25-2012, 05:42 PM   #8
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

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

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

Rep: Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548
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 08:56 PM.
 
1 members found this post helpful.
Old 04-25-2012, 09:28 PM   #11
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
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, 09:33 AM   #12
chrisretusn
Senior Member
 
Registered: Dec 2005
Location: Philippines
Distribution: Slackware64-current
Posts: 2,969

Rep: Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548
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, 11:44 AM   #13
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
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, 11:55 AM   #14
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
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 12:25 PM.
 
Old 04-27-2012, 06:18 AM   #15
chrisretusn
Senior Member
 
Registered: Dec 2005
Location: Philippines
Distribution: Slackware64-current
Posts: 2,969

Rep: Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548
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 06:22 AM. Reason: Add sample config
 
  


Reply



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 09:16 PM
how to configure updatedb to update locate database manually septanla Linux - General 4 12-22-2010 02:05 PM
(my)sql: drop database doesn't remove database kpachopoulos Programming 3 09-19-2007 01:32 PM
Where is locate's database? armandino Linux - Software 1 03-14-2007 11:21 AM
database and locate mikeshn Linux - General 1 01-19-2004 08:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 06:21 AM.

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
Open Source Consulting | Domain Registration