This all started because I wanted man pages on C++ types/functions. I found a repository called Cppman that was designed to scrape these pages from either cplusplus or cppreference. At this point man std::cout would display the expected manpage, but man -k cout would say 'nothing appropriate'.

Since then I've removed all but the cplusplus.com folder, renamed it 'man3', and run mandb (as root for good measure, then as myself) which produced an empty 'cat3' folder and an 'index.db'. Now I'm setting MANPATH as follows:

old_manpath=$(manpath 2>/dev/null)
export MANPATH=$HOME/.local/share/man:$old_manpath

The result:

> man -k std::cout
std::cout (3)        - Standard output stream
> man -k std::result_of
std::result_of (3)   - Result of call
std::result_of (3cxx) - (unknown subject)
> man 3 std::result_of # the page I expect
> man 3cxx std::result_of # scrawny and malformed manpage

If I could just hide these '3cxx' pages from man [-k], I would be satisfied. However, I'd rather delete the files and avoid generating them in the first place. I do not appear to have '*.3cxx.gz' files.

Where did I go wrong? How and where should I be setting my MANPATH, if that is indeed the problem?

Edit 1 - I stripped a lot of details from this question, but the contents of the 3cxx man pages might be telling. For one, man 3cxx std::result_of has the title std::result_of< _Signature >(3cxx) (<_Signature> is missing from the normal manpage); the SYNOPSIS is empty, followed by "Detailed Description" instead of DESCRIPTION. I've tried to replicate what it looks like below (underscores represent indentation.)

Detailed Description

____template<typename _Signature>

________class std::result_of< _Signature >" result_of

________Definition at line 2097 of file type_traits.

That stray " is as written, and appears just after the main type in a few other pages I checked. The pages that deviated still had some unmatched quotation marks after types further down the page, or at the end of lines not even involving templates.

Edit 2 - I can't figure out how to find the file associated with the displayed manpage, or I could inspect/delete the whole batch. Using lsof I don't see anything like a manpage open, not that I expected it to keep the file open. My best guess is that these stubby manpages are baked into index.db, a "dbm/ndbm" database file; I have the python3-gdbm package, so I poked at it and found it has type 'dbm.gnu' and its "first" entry is b'std::list::cend\x00' => b'-\t3\t3\t1509183341\t749359924\tA\t-\t-\tgz\tReturn const_iterator to end\x00'. This would suggest to me that index.db only stores name/description pairs, and maybe some of those numbers at the head would correspond to a file, but even then, how is more than I can hope to figure out without seeing it in action. I think this is as far as I can manage alone.

Edit 3 - I decoded the entries:

>>> from dbm.gnu import *
>>> o=open('/home/john/.local/share/man/index.db', 'c')
>>> def nextn(i,n):
...     sum=""
...     for j in range(0,n):
...             sum += i.decode("utf-8") + "\n" + o[i].decode("utf-8")
...             i=o.nextkey(i)
...     return sum
>>> all=nextn(o.firstkey(), len(o.keys()))
>>> all.find('cxx')

# Example entry for reference:
-       3       3       1509183341      749359924       A       -       -       gz      Return const_iterator to end

The entries are in hash (quasi-random) order, so a good sample of these should show about as many type '3cxx' entries as type '3'. Instead, they're literally all type '3'. Index.db is off the hook, but I'm officially out of ideas.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.