[blfs-dev] About MANPATH

Pierre Labastie pierre.labastie at neuf.fr
Sun Jan 25 03:30:21 PST 2015


I do not know whether this happened to you, but I've been hit several times:
After installing some package in /opt, some "profile" file (for example
"extrapaths.sh") is modified to include:
pathappend /opt/some/thing/man MANPATH

Then, man does not work anymore!

The reason is:
- From "man man", we read (under the "-M" option):
By default, man uses manpath derived code to determine the path to search.
- From "man manpath", we read:
The colon-delimited path is determined using information gained from the
man-db configuration file - (/etc/manpath.config) and the user's environment.
If $MANPATH is set, manpath displays its value rather than determining  it on
the fly. If $MANPATH is prefixed by a colon, then the value of the variable is
appended to the list determined from the content of the configuration files.
If the colon comes at the end of the value in the variable, then the
determined list is appended to the content of the variable. If the value of
the variable contains a double colon (::), then the determined list is
inserted in the middle of the value, between the two colons.
This means that, if the MANPATH variable does not contain a colon at the
beginning or at the end, or a double colon at some place, the standard "man"
directories are not searched.

So the correct way to set MANPATH in "profile" files is either:
pathappend /opt/some/thing/man: MANPATH
pathprepend :/opt/some/thing/man MANPATH

There are four places where MANPATH is referenced in the book:
Chapter 2. Important information -> Going beyond BLFS
Chapter 13. Programming -> OpenJDK-<version>
Chapter 27. Introduction -> KDE Pre-installation Configuration
Chapter 48; Typesetting -> Setting the PATH for TeX Live

Of those, only OpenJDK has a not satisfactory attempt to fix the above
problem: it is defeated as soon as antoher pathappend is done.

For the "Going beyond BLFS" page, I am unsure whether a further explanation is
needed. But, may I change all the other occurrences with "pathprepend :/path
MANPATH"? I know somebody complained once that pathappend :/path would result
in an unpleasant looking MANPATH...


More information about the blfs-dev mailing list