File disable-visibility.patch of Package plocate

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);
 		}
openSUSE Build Service is sponsored by
OSZAR »