mandoc and perl/posix man pages
Presently, Alpine install Perl and POSIX man pages to
/usr/share/man/man3
and /usr/share/man/man1
. In order to distinguish
them from Linux man pages with the same name, these pages have a custom
file extension. For example:
/usr/share/man/man3/open.3pm.gz
/usr/share/man/man3/open.3p.gz
Where open.3pm.gz
is the Perl man page and open.3p.gz
is the POSIX
man page. Unfortunately, this causes problems with
mandoc. For example, it presently seems to be
impossible to open the open(3p)
man page (i.e. the POSIX man page for
open
) if perl-doc
is installed:
$ man 3p open
Will always open the Perl man page which is not what one would
expect as the invocation explicitly states that the open
man page in
the 3p
section (i.e. Alpine's POSIX man page section) should be
opened.
Looking at the mandoc source code, it seems that mandoc expects
subdirectories to exist in MANDIR
(i.e. /usr/share/man
) for each man
page section. From the fs_lookup
function in main.c
:
mandoc_asprintf(&file, "%s/man%s/%s.[01-9]*",
paths->paths[ipath], sec, name);
globres = glob(file, 0, NULL, &globinfo);
if (globres != 0 && globres != GLOB_NOMATCH)
warn("%s: glob", file);
As such, man 3p open
would expect to find the open(3p)
man page in
/usr/share/man/man3p
on Alpine. However, as illustrated above it is
presently installed as /usr/share/man/man3/open.3p.gz
and thus not
found by mandoc.
I would propose moving all POSIX man pages to /usr/share/man/man3p
,
/usr/share/man/man1p
, … and moving the Perl man pages to
/usr/share/man/man3pm
. The latter will likely require rebuilding all
Perl packages which ship a doc
subpackage.
On a side note, OpenBSD itself seems to use the 3p
section for Perl
man pages. For this reason the 0p
, 1p
, as well as the proposed 3pm
section are not searched by default if no section is given
[1].
However, this could be fixed with a trivial mandoc patch.