locate.updatedb breaks on inaccessible smbfs mounts

YONETANI Tomokazu qhwt+dfly at les.ath.cx
Sat Mar 12 20:13:43 PST 2005


On Sat, Mar 12, 2005 at 07:54:36PM +0000, Rumko wrote:
> On 2005-03-12, YONETANI Tomokazu <qhwt+dfly at xxxxxxxxxx> wrote:
> > Hi.
> > On Sat, Mar 12, 2005 at 03:02:29PM +0000, Rumko wrote:
> >> On 2005-03-06, Rumko <rumcic at xxxxxxxxx> wrote:
> >> > On 2005-03-06, Rumko <rumcic at xxxxxxxxx> wrote:
> >> >> when a smbfs share is unavailable (the machine is turned off or the samba 
> >> > ...
> >> >> because of this the locate database only contains entries in / up to /mnt/router
> >> >> and doesnt for example have /usr in it.
> >> 
> >> so anybody checked this yet?
> >
> > Isn't it what PRUNEPATHS (in /etc/locate.rc) for? You can add /mnt/router
> > in the PRUNEPATHS, if you don't care about files under /mnt/router to be
> > in locate DB.
> but, why should I set that PRUNEPATHS if the default for FILESYSTEMS is ufs?
> it shouldnt check /mnt/router, cause it isnt ufs!

Because you wouldn't scratch a part of your body when you know it might be
wounded :) Probably a patch like this against find(1) solves your problem
(not tested, because I don't have smbfs share at hand)? This patch changes
the behavior of -fstype to report false whenever statfs() on a mountpoint
fails, instead of terminating the process. I can't think of a bad side-effect
with this patch, other than, hmm,

# find /tmp \! -fstype ufs -exec 'shutdown -p now' \;

Index: usr.bin/find/function.c
===================================================================
RCS file: /home/source/dragonfly/cvs/src/usr.bin/find/function.c,v
retrieving revision 1.6
diff -u -r1.6 function.c
--- usr.bin/find/function.c	14 Feb 2005 00:39:04 -0000	1.6
+++ usr.bin/find/function.c	13 Mar 2005 03:50:49 -0000
@@ -789,9 +789,10 @@
 		} else
 			p = NULL;
 
-		if (statfs(entry->fts_accpath, &sb))
-			err(1, "%s", entry->fts_accpath);
-
+		if (statfs(entry->fts_accpath, &sb)) {
+			warn("%s", entry->fts_accpath);
+			return 0;
+		}
 		if (p) {
 			p[0] = save[0];
 			p[1] = save[1];





More information about the Bugs mailing list