Subject: Re: when to run makewhatis
To: None <tech-userlevel@netbsd.org>
From: Valeriy E. Ushakov <uwe@ptc.spbu.ru>
List: tech-userlevel
Date: 01/21/2007 02:27:02
Jeremy C. Reed <reed@reedmedia.net> wrote:

> On Sat, 20 Jan 2007, Blair Sadewitz wrote:
> 
>> I have often wondered why this is not run periodically myself.
>> 
>> Perhaps this is best handled by an option in rc.conf?
> 
> I'll use weekly.conf.
> 
> If nobody objects, I'll commit this in a couple days:
> 
> Index: weekly
> ===================================================================
> RCS file: /cvsroot/src/etc/weekly,v
> retrieving revision 1.21
> diff -u -r1.21 weekly
> --- weekly      12 Nov 2006 01:22:57 -0000      1.21
> +++ weekly      20 Jan 2007 16:39:23 -0000
> @@ -79,6 +79,16 @@
>        fi
> fi
> 
> +if checkyesno rebuild_whatisdb; then
> +       echo ""
> +       if `whatis whatis 2>/dev/null >/dev/null` ; then
> +               echo "Rebuilding whatis databases:"
> +               nice -n 5 /usr/libexec/makewhatis -f
> +       else
> +               echo "Not rebuilding whatis databases"
> +       fi
> +fi
> +
> if [ -f /etc/weekly.local ]; then
>        . /etc/weekly.local > $TMP 2>&1
>        if [ -s $TMP ] ; then
> Index: defaults/weekly.conf
> ===================================================================
> RCS file: /cvsroot/src/etc/defaults/weekly.conf,v
> retrieving revision 1.2
> diff -u -r1.2 weekly.conf
> --- defaults/weekly.conf        8 Nov 2000 23:17:50 -0000       1.2
> +++ defaults/weekly.conf        20 Jan 2007 16:39:23 -0000
> @@ -11,3 +11,4 @@
> 
> clean_uucp=YES
> rebuild_locatedb=YES
> +rebuild_whatisdb=YES

I have my doubts about it.

As I've already said, /usr/share and /usr/X11R6 are not supposed to be
touched, so they just don't need whatis update ever, they will get it
when new sets are installed.

Even if we are clever and exclude the constant "system" dirs, what
happens in an envronment where /usr/pkg is shared across multiple
machines?  You end up wasting cycles on each machine, though,
admittedly, even my old 50MHz sparc only takes 6 minutes to do
makewhatis on /usr/pkg/man with a few dozens of packages.

Also, judging from a quick glance, there's a bug in makewhatis - you
can hit unlink+fopen race in makewhatis() and get two machines doing
dumpwhatis() into the same file.

<offtopic>

An interesting question is if there's a nice way to integrate
catman/makewhatis into pkgsrc.  I tend to run catman on /usr/pkg/man
on my slower machines regularly b/c it just takes too long to format
man pages on demand each time.  If a package is deleted the orphaned
cat pages are left, as they are not in PLIST.

In general our catman and makewhatis could use some improvements but I
don't want to go into this rant now, as I haven't really thought about
all the ramifications.

SY, Uwe
-- 
uwe@ptc.spbu.ru                         |       Zu Grunde kommen
http://snark.ptc.spbu.ru/~uwe/          |       Ist zu Grunde gehen