LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-29-2009, 04:32 PM   #1
merchtemeagle
Member
 
Registered: Oct 2004
Location: Belgium
Distribution: Slackware 13.37
Posts: 512

Rep: Reputation: 31
slocate's database


It seems the path to slocate's database file is hard-coded.

C code:
Code:
# define DEFAULT_DB "/var/lib/slocate/slocate.db"
# define DEFAULT_DB_DIR "/var/lib/slocate"
Is there any reason why it's not configurable?

Last edited by merchtemeagle; 10-29-2009 at 04:42 PM.
 
Old 10-29-2009, 04:39 PM   #2
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Testing"
Posts: 6,117

Rep: Reputation: 416Reputation: 416Reputation: 416Reputation: 416Reputation: 416
Quote:
# define DEFAULT_DB "/var/lib/slocate/slocate.db"
# define DEFAULT_DB_DIR "/var/lib/slocate"
Is there any reason why it's not configurable?
This really isn't of big interest to me, but those lines are "commented out" because the lines begin with the # character.

If you remove the "#", alter the default path, and restart the service, all should be well.
 
Old 10-29-2009, 04:43 PM   #3
merchtemeagle
Member
 
Registered: Oct 2004
Location: Belgium
Distribution: Slackware 13.37
Posts: 512

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by tredegar View Post
This really isn't of big interest to me, but those lines are "commented out" because the lines begin with the # character.

If you remove the "#", alter the default path, and restart the service, all should be well.
Well, not really. It's C code. I've altered my original post to include this information.
 
Old 10-29-2009, 05:57 PM   #4
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Testing"
Posts: 6,117

Rep: Reputation: 416Reputation: 416Reputation: 416Reputation: 416Reputation: 416
Quote:
Well, not really. It's C code. I've altered my original post to include this information.
OK.

It's C code.

If you don't like the suggested default you can change the
Code:
# define DEFAULT*
to whatever you like, then recompile.

Be aware that this may break some apps that assume the default(s) are used.

Quote:
It seems the path to slocate's database file is hard-coded.
This isn't the case, it is soft-coded in the source code.

If you'd like to change it then do so, but you'll have to recompile.
 
Old 10-29-2009, 06:03 PM   #5
merchtemeagle
Member
 
Registered: Oct 2004
Location: Belgium
Distribution: Slackware 13.37
Posts: 512

Original Poster
Rep: Reputation: 31
Yes, I can change and recompile it. But my question was actually why it is not configurable. In other words: does someone knows any apps that would break by changing the path.
 
Old 10-29-2009, 06:12 PM   #6
lwasserm
Member
 
Registered: Mar 2008
Location: Baltimore Md
Distribution: ubuntu
Posts: 184

Rep: Reputation: 41
Quote:
Originally Posted by merchtemeagle View Post
Yes, I can change and recompile it. But my question was actually why it is not configurable. In other words: does someone knows any apps that would break by changing the path.
Just because those #defines are present in the source code does not mean it is not configurable. They define default values but it is quite possible that somewhere else there is a check for different values read from a configuration file, environement values, or command line, etc.
 
Old 10-29-2009, 06:34 PM   #7
merchtemeagle
Member
 
Registered: Oct 2004
Location: Belgium
Distribution: Slackware 13.37
Posts: 512

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by lwasserm View Post
Just because those #defines are present in the source code does not mean it is not configurable. They define default values but it is quite possible that somewhere else there is a check for different values read from a configuration file, environement values, or command line, etc.
I should just read the man pages before searching the code.
Code:
-o <file>  -  Specifies the database to create.
Thanks!
 
Old 10-29-2009, 06:34 PM   #8
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594
Quote:
Originally Posted by merchtemeagle View Post
It seems the path to slocate's database file is hard-coded. (..) Is there any reason why it's not configurable?
Not exactly an answer but I use 'locate' with custom databases (running 'updatedb -U /search/path -o /target/database.db'), this works with both 'slocate' and 'locate' ("mlocate" package) as both allow for the --database= switch. However this requires use of a function, alias or script to switch between databases as the default indeed is hardcoded.
 
  


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
DBI Connect Failed:Access denied for user ''@'localhost' to database <database> error kaplan71 Linux - Software 3 06-05-2009 12:39 PM
How can i copt the MYSQL Database to a other server (Database) halvorls Linux - Server 3 07-27-2008 09:19 PM
(my)sql: drop database doesn't remove database kpachopoulos Programming 3 09-19-2007 01:32 PM
Database Programming (database to database transaction) johncsl82 Programming 7 02-02-2007 08:20 AM
LXer: A database solution is more than database software LXer Syndicated Linux News 0 09-25-2006 08:54 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:31 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
Open Source Consulting | Domain Registration