[Slackbuilds-users] always run `mandb -c` after installing/removing manpages?

B. Watson urchlay at slackware.uk
Mon Aug 12 09:30:48 UTC 2024



On Mon, 12 Aug 2024, Arkadiusz Drabczyk wrote:

> I ran it as root of course, it wouldn't work on /usr/man/man1 if I
> didn't since it is writable only by root.

I meant, are you sure when you timed it and got 10 seconds, that you
were actually using the -c option? I get pretty close to 10 seconds
when I time it *without* -c. If you really get "mandb -c" to run in
only 10 seconds, that's 60x as fast as it does for me, and I want to
know how (so I can make it run that fast for me, too).

> How many manpages do you have? Is this system under heavy load?

The timing test was done on an otherwise-idle system. I have a
lot of SBo packages installed: there are 47918 man pages. But, a
clean install of Slackware 15.0 has 21101 man pages (and on a clean
install with an SSD, the 9+ minutes becomes about 4 minutes; still
too long). On my laptop with a spinning-platter drive and a clean 15.0
install, the 4 minutes becomes 30.

Anyway, as you point out, "mandb -c" isn't actually needed in either
doinst.sh or douninst.sh...

>> I think the overhead of constantly regenerating the man database is
>> just too high. Users who never even use "man -k" would be forced to
>> pay the penalty for it.
>
> Well the same can be said about the info database.

When I wrote that, I was still thinking "mandb -c" would be required.
mandb without the -c is all that's needed, and that's fast enough.

>> However, it appears that leaving off the -c also prevents mandb from
>> adding the zathura man page to its database. I wonder if this is the
>> intended behaviour, or if it might be considered a bug in mandb.
>
> I was going to read the code to find out if it's a bug or a feature.

Yeah, that's a good idea. Also, you might email the man-db author
and ask. He's pretty responsive to emails, or anyway he was
a few years back.

> hmm didn't you just say a few lines above that mandb without -c
> removes the manpage?

Yeah, I did. That's what I get for writing a long email with the parts
out of order (go ahead and write next section of email, while waiting
for a 9+ minute run of "mandb -c" to finish... out-of-order execution
works better for CPUs than humans).

So it looks like: in doinst.sh, can use "mandb -f" for each
man page. And in douninst.sh, can use "mandb" without the -c
option. Neither of those takes a long time to run (seconds, not
minutes).

These could be added to the doinst.sh and douninst.sh templates, and
probably will be (though it's not solely up to me).

When/if they do get added to the templates, I'll add checks in
sbopkglint... but they won't be warnings or errors, just "notes",
because otherwise every single existing SBo build that installs man
pages would suddenly be "broken" and require tons of time/work to
"fix".


More information about the SlackBuilds-users mailing list