manwhich: Deriving MANPATH from PATH [PSARC/2007/688 FastTrack timeout 12/19/2007]

Mike Gerdts mgerdts at gmail.com
Thu Dec 13 08:03:21 PST 2007


On Dec 13, 2007 9:25 AM, Lawrence Lee <Lawrence.Lee at sun.com> wrote:
> John Plocher wrote:
> > 4. Technical Description:
> >     4.1. Details:
> >       The source file man.c will be enhanced to refer to PATH only in the
> >       absence of MANPATH.  Each element of PATH will be translated based
> >       into the appropriate MANPATH element based upon the following
> >       priorities:
> >
> >         - Explicit transformation rule.  For example, /usr/ucb in PATH
> >           translates to /usr/share/man,1b.
> >         - The parent directory of the PATH directory with /share/man
> >           appended.  For example, /usr/gnu/bin becomes
> >           /usr/gnu/share/man.
> >         - The parent directory of the PATH directory with /man
> >           appended.  For example, /opt/VRTSvcs/bin becomes
> >           /opt/VRTSvcs/man because /opt/VRTSvcs/share/man does not exist
> >           but /opt/VRTSvcs/man does.
> >
> >       In addition and higher precedence to the above, if man is invoked
> >       referring to particular instance of a command (e.g. "man ./ls" or
> >       "man /usr/ucb/ps") the path transformation rules are applied using
> >       the directory component of the argument.
> >
> >       In all cases where MANPATH is not defined and the path to a command
> >       is not specified /usr/share/man will be appended to MANPATH if it
> >       is not otherwise included based upon PATH transform rules.  This
> >       ensures that sections other than 1* are accessible.
> >
> >       A prototype of this behavior has been implemented and is available
> >       for review at http://cr.opensolaris.org/~mgerdts/manpath-from-path/.
> >
> Would it be an appropriate extension to also use this behavior
> if MANPATH is defined, but the requested man page is not found?

My thought is that a person wishing to have legacy behavior can set
MANPATH and avoid using name arguments with a /.  If it were extended
as you suggest those requesting, legacy behavior would not be
available.

If there is consensus that such an extension would be desirable, my
approach would likely be to implement and document as appending the
derived manpath onto any (possibly null) value from the MANPATH
environment variable.

> Will the transformation rules be hardcoded  in the man.c
> or will there be a system file which defines the transformation rules.
> IOW - if sbin or exe is not included in the default transformation rules,
> could a system administrator extend those rules?

Currently they are hard-coded because I don't expect that these rules
will need frequent updates.   However, I could see where ISV's may
want to append on things like:

/opt/VRTSvlic/bin /opt/VRTS/man

If this route is taken, where should the config file go?  Should it
have a syntax that allows future man configuration or be a simple
two-column file with comments allowed?

-- 
Mike Gerdts
http://mgerdts.blogspot.com/



More information about the opensolaris-arc mailing list