Hi Pascal,

Pascal Stumpf wrote on Sun, Nov 20, 2011 at 01:18:27AM +0100:
> On Sat, 19 Nov 2011 18:05:42 +0100, Ingo Schwarze wrote:
>> Marc Espie wrote on Sat, Nov 19, 2011 at 05:40:38PM +0100:
>>> On Sat, Nov 19, 2011 at 04:31:57PM +0100, Ingo Schwarze wrote:
>>>> Thomas de Grivel wrote on Sat, Nov 19, 2011 at 03:32:03PM +0100:

>>>>> From weekly output :
>>>>>> Rebuilding whatis databases:
>>>>>> /usr/libexec/makewhatis: Can't create /usr/share/man/whatis.db:
>>>>>> Read-only file system
>>>>> Should not whatis.db be in /var/... ?

>>>> I think you have a point.  Specifically, /var/db/man/.
>>>> Having cron(8) scripts write to /usr is ugly.
>>>> I don't see why mounting /usr readonly should require
>>>> disabling makewhatis(8).

>>> I disagree: manpage directories are self-contained.  
>>> 
>>> If I add or remove a directory to my man configuration, it shouldn't
>>> require a rebuild of the database for other directories.
>>> Hence having a whatis.db per-man directory root.
>>> 
>>> If you want to move those to /var/db/man or something, you'd better be
>>> prepared to have database file names that depend on the root directory
>>> being used.

>> I fully agree with all that, and having per-hierarchy databases
>> in /var/db/man - one for /usr/share/man, one for /usr/X11R6/man,
>> one for /usr/local/man, one for each additional directory the
>> user configures in man.conf(5) - is indeed what i hope to do.

> I think what Marc meant is that whatis.db/mandoc.db should be in the
> same directory as their corresponding manpages.  And I agree on that
> point, especially in the case of NFS-mounted /usr: One shouldn't have to
> run mandocdb to be able to run apropos(1) for the pages on the remote
> machine.  And even worse, what happens if the remote machine is updated
> or packages are added?  The client in such a setup will have an outdated
> database without being aware of it.
> 
> mandoc.db should be in the same directory as the manpages it was
> generated from, and need not be writable by machines that don't have
> write access to the pages themselves.

Hmm, probably you are right:  The mandoc database only needs to be
changed when manual pages are added to or removed from the tree,
so /FOO/man/mandoc.db is _not_ more volatile than /FOO/man/man*/*
and /FOO/bin/* themselves.

> With respect to the weekly makewhatis, I think that's a bug in the
> weekly(8) script: It should not blindly assume that every database
> listed in man.conf(5) is on a writable filesystem.

Since weekly(8) just calls makewhatis(8) without any arguments,
it can't do much about the fact that some directories might be
locally mounted and writeable, while others may be on NFS and
read-only.  Besides, calling /usr/libexec/makewhatis by hand
has to deal with those issues as well.

Thus, the right solution probably is to have makewhatis(8) - or in the
future, mandocdb(8) -, when running without arguments, test whether each
database is writeable, before scanning the associated directory, and in
case it is not, just skip the directory.

On the other hand, when a directory is explicitly specified on the
command line, the current behaviour is probably optimal:  Build the
database, if it did not change, be happy, otherwise, try to move
the new one into its place, and if that fails, complain.

Yours,
  Ingo

Reply via email to