From owner-freebsd-hackers@FreeBSD.ORG Tue Nov 13 14:27:55 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A4A48F65 for ; Tue, 13 Nov 2012 14:27:55 +0000 (UTC) (envelope-from lgusenet@be-well.ilk.org) Received: from asbnvacz-mailrelay01.megapath.net (asbnvacz-mailrelay01.megapath.net [207.145.128.243]) by mx1.freebsd.org (Postfix) with ESMTP id 602B28FC08 for ; Tue, 13 Nov 2012 14:27:55 +0000 (UTC) Received: from mail8.sea5.speakeasy.net (mail8.sea5.speakeasy.net [69.17.117.53]) by asbnvacz-mailrelay01.megapath.net (Postfix) with ESMTP id 7A610A72EE9 for ; Tue, 13 Nov 2012 09:05:53 -0500 (EST) Received: (qmail 29114 invoked from network); 13 Nov 2012 14:05:53 -0000 Received: by simscan 1.4.0 ppid: 24614, pid: 4456, t: 0.1763s scanners: clamav: 0.88.2/m:52/d:13495 Received: from unknown (HELO be-well.ilk.org) ([66.92.78.145]) (envelope-sender ) by mail8.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 13 Nov 2012 14:05:52 -0000 Received: from lowell-desk.lan (lowell-desk.lan [172.30.250.8]) by be-well.ilk.org (Postfix) with ESMTP id 45BFF33C23; Tue, 13 Nov 2012 09:05:47 -0500 (EST) Received: by lowell-desk.lan (Postfix, from userid 1147) id E8A5439843; Tue, 13 Nov 2012 09:05:46 -0500 (EST) From: Lowell Gilbert To: Eitan Adler , freebsd-hackers@freebsd.org Subject: Re: Give users a hint when their locate database is too small. References: Date: Tue, 13 Nov 2012 09:05:46 -0500 In-Reply-To: (Eitan Adler's message of "Mon, 12 Nov 2012 22:07:16 -0500") Message-ID: <44wqxpegxx.fsf@lowell-desk.lan> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain X-Mailman-Approved-At: Tue, 13 Nov 2012 17:20:29 +0000 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Nov 2012 14:27:55 -0000 Eitan Adler writes: > What do people think of this? Maybe /usr/libexec/locate.updatedb is a > better pointer? Yes, I would think locate.updatedb(8) would be the appropriate reference, because it's possible to build locate databases in ways and for reasons other than the weekly script. I assume that the precise cutoff value is chosen not because the number of bigrams is important but because the size of the bigram buffer is, and that it's only notated as (2*NBG) because BGBUFSIZE isn't defined in a header... > commit fb03b777daf2c69bb9612902e38fdb25b256be72 > Author: Eitan Adler > Date: Mon Nov 12 22:05:55 2012 -0500 > > Give users a hint when their locate database is too small. > > Reviwed by: ??? > Approved by: ??? > MFC after: 3 weeks > > diff --git a/usr.bin/locate/locate/locate.c b/usr.bin/locate/locate/locate.c > index b0faefb..f0c8c37 100644 > --- a/usr.bin/locate/locate/locate.c > +++ b/usr.bin/locate/locate/locate.c > @@ -292,7 +292,7 @@ search_mmap(db, s) > err(1, "`%s'", db); > len = sb.st_size; > if (len < (2*NBG)) > - errx(1, "database too small: %s", db); > + errx(1, "database too small: %s\nTry running > /etc/periodic/weekly/310.locate", db); > > if ((p = mmap((caddr_t)0, (size_t)len, > PROT_READ, MAP_SHARED,