Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 905624 - man pages for alternatives: Use of .so instead of symlink creates issue when using mandoc
Summary: man pages for alternatives: Use of .so instead of symlink creates issue when ...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
: 917535 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-05-03 00:26 UTC by Alexis
Modified: 2024-01-20 17:58 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexis 2023-05-03 00:26:05 UTC
When a user requests the generic man page for which alternatives exist, Gentoo tries to provide the man page for the specific implementation in use. However, the way it does so creates an issue when using mandoc instead of man-db.

For example, awk.1 simply contains an .so request whose argument is the man page for the actual awk implementation in use:

   .so gawk.1

However, although this works when using man-db, it doesn't when one is using mandoc. Instead of gawk.1 being sourced, processed and displayed, one gets output along the lines of:

   ()                                    ()
           See the file gawk.1.


   ()

However, if the request in awk.1 is changed to:

   .so man1/gawk.1

then everything works as expected.

The example in the entry for .so in mandoc_roff(7) is what led me to
try the preceding, but there's no further indication that the
requirement for a leading section directory is consciously different
from any other roff implementation, or from groff in particular. A
comment in roff_so() in mandoc/roff.c[a] says:

   /*
   /* Handle `so'.  Be EXTREMELY careful, as we shouldn't be
    * opening anything that's not in our cwd or anything beneath
    * it.  Thus, explicitly disallow traversing up the file-system
    * or using absolute paths.
    */

i couldn't find any discussion about .so in the mandoc TODO list[b].

i raised this issue on discuss@mandoc.bsd.lv, groff@gnu.org and man-db-devel@nongnu.org:

    https://lists.gnu.org/archive/html/groff/2023-04/msg00221.html

groff maintainer G. Branden Robinson replied:

    In practice, as I understand it, `so` doesn't achieve anything for man pages that can't be done with symbolic links and (importantly) a man page indexer that is symlink-aware.

although man-db maintainer Colin Watson noted:

    It is worth noting that today there are at least some real-world cases
where it isn't being used as a mere symlink; bash-builtins(7) is one
such.

i've been waiting for any further comments (e.g. from mandoc mantainer Ingo Schwarze), but there haven't been any.

Is there any particular reason why .so requests need to be used when dealing with alternatives, instead of symlinks?

[a] https://cvsweb.bsd.lv/mandoc/roff.c?rev=1.395&content-type=text/x-cvsweb-markup

[b] https://cvsweb.bsd.lv/mandoc/TODO?rev=1.327&content-type=text/x-cvsweb-markup

Reproducible: Always
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2023-05-04 04:59:03 UTC
The problem with symlinks is that they need to be updated to match manpage compression.  `.so` works with any compression used for the manpage.
Comment 2 Alexis 2023-05-04 06:07:42 UTC
(In reply to Michał Górny from comment #1)
> The problem with symlinks is that they need to be updated to match manpage
> compression.  `.so` works with any compression used for the manpage.

Ah, yeah. i've now noted this is the discussion thread:

    https://lists.gnu.org/archive/html/groff/2023-05/msg00026.html
Comment 3 Ionen Wolkens gentoo-dev 2023-05-05 22:56:33 UTC
(In reply to Michał Górny from comment #1)
> The problem with symlinks is that they need to be updated to match manpage
> compression.  `.so` works with any compression used for the manpage.
Portage seems to auto-updates these. Some build systems will make symlinks too (e.g. openssl makes a million), and without that we'd need to convert everything to .so

$ ls -l /usr/share/man/man3/i2d_TS_TST_INFO_bio.3ossl.zst
lrwxrwxrwx 1 root root 18 Apr 26 12:20 /usr/share/man/man3/i2d_TS_TST_INFO_bio.3ossl.zst -> d2i_X509.3ossl.zst

zst is uncommon for man pages but it was handled just fine

Not that I personally have a problem with either method being used.
Comment 4 Ionen Wolkens gentoo-dev 2023-05-05 23:04:36 UTC
... then again scratch that, when the man page is from /another/ package I don't see symlinks working.
Comment 5 Ionen Wolkens gentoo-dev 2023-11-18 09:34:25 UTC
*** Bug 917535 has been marked as a duplicate of this bug. ***