From owner-svn-src-all@FreeBSD.ORG Sun Oct 31 11:54:01 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C623B106566B; Sun, 31 Oct 2010 11:54:01 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) by mx1.freebsd.org (Postfix) with ESMTP id 8C58B8FC08; Sun, 31 Oct 2010 11:54:01 +0000 (UTC) Received: from turtle.stack.nl (turtle.stack.nl [IPv6:2001:610:1108:5010::132]) by mx1.stack.nl (Postfix) with ESMTP id F211E359A04; Sun, 31 Oct 2010 12:54:00 +0100 (CET) Received: by turtle.stack.nl (Postfix, from userid 1677) id E7A48174A9; Sun, 31 Oct 2010 12:54:00 +0100 (CET) Date: Sun, 31 Oct 2010 12:54:00 +0100 From: Jilles Tjoelker To: Garrett Wollman Message-ID: <20101031115400.GA72674@stack.nl> References: <201010310236.o9V2a5hO039726@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201010310236.o9V2a5hO039726@svn.freebsd.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214583 - head/usr.bin/locate/locate X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Oct 2010 11:54:01 -0000 On Sun, Oct 31, 2010 at 02:36:05AM +0000, Garrett Wollman wrote: > Author: wollman > Date: Sun Oct 31 02:36:05 2010 > New Revision: 214583 > URL: http://svn.freebsd.org/changeset/base/214583 > Log: > Make it possible to exclude directories by name no matter where they > are in the filesystem from the locate database. By default, exclude > ".zfs" directories, as users who who have set snapdir=visible and are > taking frequent snapshots most likely do not want the snapshots > included in the locate database. > Modified: head/usr.bin/locate/locate/updatedb.sh > ============================================================================== > --- head/usr.bin/locate/locate/updatedb.sh Sun Oct 31 02:15:23 2010 (r214582) > +++ head/usr.bin/locate/locate/updatedb.sh Sun Oct 31 02:36:05 2010 (r214583) > @@ -52,6 +52,7 @@ PATH=$LIBEXECDIR:/bin:/usr/bin:$PATH; ex > : ${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 > +: ${PRUNEDIRS:=".zfs"} # unwanted directories, in any parent This makes it impossible to use empty PRUNEDIRS as it will be changed to ".zfs". I suppose it should be changed to : ${PRUNEDIRS=".zfs"} There are also checks for empty SEARCHPATHS and FILESYSTEMS below which will never trigger for the same reason. > : ${FILESYSTEMS:="$(lsvfs | tail -n +3 | \ > egrep -vw "loopback|network|synthetic|read-only|0" | \ > cut -d " " -f1)"} # allowed filesystems > @@ -79,6 +80,14 @@ case X"$PRUNEPATHS" in > done;; > esac > > +case X"$PRUNEDIRS" in > + X) ;; > + *) for dir in $PRUNEDIRS > + do > + excludes="$excludes -or -name $dir -type d -prune" > + done;; > +esac > + > tmp=$TMPDIR/_updatedb$$ > trap 'rm -f $tmp; rmdir $TMPDIR' 0 1 2 3 5 10 15 The X stuff seems to be here for consistency with the rest of the script, but is unnecessary. Even in old shells, things like case $PRUNEDIRS in '') ;; esac work fine. On the other hand, for optimal portability one should indeed still write [ "X$FOO" = "X$BAR" ] since [ "$FOO" = "$BAR" ] will not work properly for some values of $FOO and $BAR on some only slightly old shells (e.g. FreeBSD 6.4, 7.0 sh treat [ \( = \) ] incorrectly). -- Jilles Tjoelker