From 3cc917d96eca7bff317a4854042bab69c2fe3c11 Mon Sep 17 00:00:00 2001 From: se Date: Wed, 17 Oct 2007 07:27:51 +0000 Subject: The previous version included too many file system types in the scan, since "local" includes also synthetic file systems (e.g. /dev, /proc) and loopback mounts. This version uses lsvfs to identify file system types that are local and additionally not synthetik, loopback mounts, or read-only. This has been suggested by Craig Rodrigues half a year ago. The patch that has been committed is based on his suggestion, but slightly modified. The comments in locate.rc have been updated to reflect the change and o include zfs and xfs in the example file system parameter that can be used to override the default outlined above. PR: 114101 Submitted by: rodrigc at crodrigues dot org (Craig Rodrigues) MFC: 2 weeks --- usr.bin/locate/locate/locate.rc | 8 ++++++-- usr.bin/locate/locate/updatedb.sh | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'usr.bin/locate') diff --git a/usr.bin/locate/locate/locate.rc b/usr.bin/locate/locate/locate.rc index 2d0f033..54cc6d8 100644 --- a/usr.bin/locate/locate/locate.rc +++ b/usr.bin/locate/locate/locate.rc @@ -22,5 +22,9 @@ # and if the SEARCHPATHS starts in such a filesystem locate will build # an empty database. # -# be careful if you add 'nfs' -#FILESYSTEMS="ufs ext2fs" +# the default list contains all local file systems that are not synthetic, +# loopback mounts, or read-only, according to lsvfs. +# +# be careful if you add 'nfs' or other network file system types or file +# systems that generally reside on slow or removable devices like cd9660 +#FILESYSTEMS="ufs ext2fs zfs xfs" diff --git a/usr.bin/locate/locate/updatedb.sh b/usr.bin/locate/locate/updatedb.sh index ea9122f..d828438 100644 --- a/usr.bin/locate/locate/updatedb.sh +++ b/usr.bin/locate/locate/updatedb.sh @@ -52,7 +52,9 @@ PATH=$LIBEXECDIR:/bin:/usr/bin:$PATH; export PATH : ${FCODES:=/var/db/locate.database} # the database : ${SEARCHPATHS:="/"} # directories to be put in the database : ${PRUNEPATHS:="/tmp /usr/tmp /var/tmp /var/db/portsnap"} # unwanted directories -: ${FILESYSTEMS:="local"} # allowed filesystems +: ${FILESYSTEMS:="$(lsvfs | tail -n +3 | \ + egrep -vw "loopback|network|synthetic|read-only|0" | \ + cut -d " " -f1)"} # allowed filesystems : ${find:=find} case X"$SEARCHPATHS" in -- cgit v1.1