Files
plocate/disable-visibility.patch
Dirk Stoecker eeb80baf09 Accepting request 1108124 from home:manfred999
plocate is vastly superior (speed and database size) to mlocate while still being compatible. Mlocate is not developed since years, most major distributions switched to plocate a long time ago.

This SR adjusts plocate to be compatible to the SUSE version
of mlocate: no setgid, run as nobody, visibility check disabled.
The intention is to have a drop-in replacement for mlocate.

I tested both the RUN_UPDATEDB_AS=nobody and
RUN_UPDATEDB_AS=root variants, works for me (TM). After some
simmering in server:search a submit to Factory is intended.

Second submission, changes see changelog.

OBS-URL: https://build.opensuse.org/request/show/1108124
OBS-URL: https://build.opensuse.org/package/show/server:search/plocate?expand=0&rev=1
2023-09-21 07:04:56 +00:00

45 lines
1.6 KiB
Diff

Do not check for visibilty by default as we go with nobody.
Change umask so database file is world readable, as users are not member
of the nobody group.
--- plocate-1.1.19/conf.cpp.orig 2023-06-09 09:24:29.000000000 +0200
+++ plocate-1.1.19/conf.cpp 2023-08-26 14:56:39.176957282 +0200
@@ -39,7 +39,7 @@ using namespace std;
/* true if locate(1) should check whether files are visible before reporting
them */
-bool conf_check_visibility = true;
+bool conf_check_visibility = false;
/* Filesystems to skip, converted to uppercase and sorted by name */
vector<string> conf_prunefs;
--- plocate-1.1.19/database-builder.cpp.orig 2023-06-09 09:24:29.000000000 +0200
+++ plocate-1.1.19/database-builder.cpp 2023-08-30 09:37:52.710293807 +0200
@@ -480,7 +480,7 @@ unique_ptr<Trigram[]> create_hashtable(E
DatabaseBuilder::DatabaseBuilder(const char *outfile, gid_t owner, int block_size, string dictionary, bool check_visibility)
: outfile(outfile), block_size(block_size)
{
- umask(0027);
+ umask(0022);
string path = outfile;
path.resize(path.find_last_of('/') + 1);
@@ -489,7 +489,7 @@ DatabaseBuilder::DatabaseBuilder(const c
}
int fd = -1;
#ifdef O_TMPFILE
- fd = open(path.c_str(), O_WRONLY | O_TMPFILE, 0640);
+ fd = open(path.c_str(), O_WRONLY | O_TMPFILE, 0644);
if (fd == -1 && errno != EOPNOTSUPP && errno != EISDIR) {
perror(path.c_str());
exit(1);
@@ -502,7 +502,7 @@ DatabaseBuilder::DatabaseBuilder(const c
perror(temp_filename.c_str());
exit(1);
}
- if (fchmod(fd, 0640) == -1) {
+ if (fchmod(fd, 0644) == -1) {
perror("fchmod");
exit(1);
}