I try to test GNU version of locate
command. First, I have to create the database like this :
sudo gupdatedb --prunepaths=/Volumes --output=$HOME/locatedb_gupdatedb
Unfortunately, 1 minute after launching the command, I still get the following error :
gfind: failed to read file names from file system at or below '/': No such file or directory
I don't understand where this error could come from ?
UPDATE 1: I replaced gfind
by find
commad and correct path of find
which is /usr/bin/
. Unfortunately, I get embarassing error messages like this when I launch the gupdatedb
command like this :
sudo gupdatedb --prunepaths='/private/tmp /private/var/folders /private/var/tmp */Backups.backupdb /Volumes /System' --output=$HOME/locatedb_gupdatedb
Here the error messages :
find: /System/Volumes/Data/.Spotlight-V100: No such file or directory
find: /System/Volumes/Data/.PKInstallSandboxManager: No such file or directory
find: /System/Volumes/Data/.PKInstallSandboxManager-SystemSoftware: No such file or directory
find: /System/Volumes/Data/.cleverfiles: No such file or directory
find: /System/Volumes/Data/mnt: No such file or directory
find: /System/Volumes/Data/.DocumentRevisions-V100: No such file or directory
etc ...
I tried to modify into /usr/local/Cellar/findutils/4.7.0/libexec/bin/gupdatedb
file, the option :
: ${FINDOPTIONS="2 > /dev/null"}
But the issue is this option is set in front of the command find
, not at the end, so it is not correct in the following of the file.
Given the fact there a lot of find
commands after in the script, I can't add manually each time the 2 > /dev/null
terminal option.
Anyone could see how to suppress all these error messages from find
command when I launch a gupdatedb
command ?
UPDATE 2: I finally managed to create a database with gupdatedb (GNU version of MacOS updatedb
command) by doing :
sudo gupdatedb --prunepaths='/private/tmp /private/var/folders /private/var/tmp */Backups.backupdb /System /Volumes' --output=$HOME/locatedb_gupdatedb
The issue now is, when I do a research on a substring of a file or directory, the informations seems to be duplicated in results (sub_string
is simply the part of a file or directory name) :
For example, if I do a : glocate -d ~/locatedb_gupdatedb sub_string
Then, I have duplicates results like :
/System/Volumes/Data/Users/fab/sub_string.dat
/Users/fab/sub_string.dat
I don't know how to exclude '/System/Volumes/Data/
' from these results : however, I have well specified in --prunepaths
option the directory System
, why isn't it taken into account in database created by gupdatedb
?
Or maybe I should perform a :
sudo gupdatedb --prunepaths='/private/tmp /private/var/folders /private/var/tmp */Backups.backupdb /System/Volumes/Data /Volumes' --output=$HOME/locatedb_gupdatedb
??
Any help is welcome to exclude this directory
/System/Volumes/Data
from indexing database.
UPDATE 3: Here is an example of quickly generating a database with updatedb on Debian 10 Buster
. Few modifications of normal using have been done between the timestamps of the 2 commands updatedb
.
So I conclude there is a really a difference betweeen GNU/MacOS and GNU/Linux implementation.
Any explanation is welcome.