[Slackbuilds-users] always run `mandb -c` after installing/removing manpages?
Arkadiusz Drabczyk
arkadiusz at drabczyk.org
Mon Aug 12 22:50:06 UTC 2024
On Mon, Aug 12, 2024 at 05:30:48AM -0400, B. Watson wrote:
> > > 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.
I think I know what's going on here.
mandb checks if there are new files in the directory by comparing
mtime of the database and the directory
https://gitlab.com/man-db/man-db/-/blob/1e5462f3fd9bfd8cf496e32e23842018b67f9b91/src/check_mandirs.c#L529.
mtime is saved in .tar package metadata and installpkg extracts tar
and effectively changes the date of /usr/man/man1 to the past if
`mandb -c` was run after the package was built. If the mtime of man
database happens to be newer than the new mtime of /usr/man/man1 mandb
isn't able to detect new files.
The interesting question is what would happen on the system on which
cron daily rule never fired (IIUC it fires at 4:40 AM) what would mean
that the database is quite old and mandb would be called without -c,
if /usr/man/man1 in tar is newer than the database it should work. It
works when zathura package is rebuilt and installed after `mandb -c`
has been run so that date in tar is newer.
So at the end of the day it's possible that if everything was done in
the right order and crontab rule would actually fire then `man -k`
would work but I still think that it's reasonable to expect that it
would work immediately after the package is installed, not after 4:40
AM and only if your machine is up.
--
Arkadiusz Drabczyk <arkadiusz at drabczyk.org>
More information about the SlackBuilds-users
mailing list