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

Mike Gerdts mgerdts at gmail.com
Wed Dec 19 06:16:43 PST 2007


On Dec 19, 2007 12:29 AM, Darren Reed <Darren.Reed at sun.com> wrote:
>
> Edward Pilatowicz wrote:
> > On Tue, Dec 18, 2007 at 11:15:41PM -0600, Shawn Walker wrote:
> >
> >> On Dec 18, 2007 7:27 PM, Edward Pilatowicz <edward.pilatowicz at sun.com> wrote:
> >>
> >>> On Mon, Dec 17, 2007 at 09:17:55PM -0600, Mike Gerdts wrote:
> >>>
> >>>> On Dec 17, 2007 6:22 PM, Edward Pilatowicz <edward.pilatowicz at sun.com> wrote:
> >>>>
> >>>>> i really like the suggested manpatch search mechanism.
> >>>>> it should make the management of manpath much easier.
> >>>>>
> >>>>> that said, currently i have some MANPATH entries (ie,
> >>>>> entries in my MANPATH environment variable) which aren't
> >>>>> associated with any PATH entries.  so to switch to this
> >>>>> new mechanism i'd have to drop these entries.  so what
> >>>>> i was wondering is would it be possible to have some
> >>>>> new man(1) cli option that would display the current
> >>>>> dynamic man search path in the format of a MANPATH variable?
> >>>>> this would allow me to do something like the following
> >>>>> in my profile:
> >>>>>
> >>>>>         PATH="<my_desired_path>
> >>>>>         unset MANPATH
> >>>>>         MANPATH=`man --found-dynamic-manpath-search-directories`
> >>>>>         MANPATH=$MANPATH:<my extra junk>
> >>>>>         export MANPATH
> >>>>>
> >>>>> thoughts?
> >>>>> ed
> >>>>>
> >>>> Interesting idea.  As others have stated, this would also be useful
> >>>> for debugging or understanding path to manpath translations.  How does
> >>>> this usage look?
> >>>>
> >>>> $ PATH=/usr/gnu/bin:/usr/xpg4/bin:/usr/ucb man -p
> >>>> /usr/gnu/share/man:/usr/share/man,1:/usr/share/man,1b:/usr/share/man,<lots
> >>>> of sections>
> >>>>
> >>>>
> >>> so is there any reason to have the ",<section>" entries?
> >>> couldn't we just set MANPATH without these?  (that's how i currently
> >>> setup my manpath.
> >>>
> >> I believe these are to accommodate things like /usr/ucb, etc.
> >>
> >>
> >
> > ah.  i get it.  if /usr/ucb comes earlier in the path then you need
> > ",1b" before ",1".  right?  if so, then ok.  leave them in.
> > thanks for the enlightenment.
> >
>
> What is the intended behaviour when if I have MANSECTS set in man.cf,
> but MANPATH unset, possibly in conflict with the ordering of paths in PATH?
>
> e.g. $PATH has /usr/ucb:/usr/bin, but MANSECTS in man.cf has 1,1b.
> Will this case result in /usr/share/man/man1,1b or /usr/share/man/man1b,1?

If there is a translation rule for the PATH element and that
translation specifies a section (e.g. /usr/ucb -> /usr/share/man,1b)
man.cf is ignored when searching this element.

For sake of easy discussion we could say that PATH=/usr/ucb:/usr/bin
translates to "/usr/share/man,1b,1:/usr/share/man".  That is, search
1b, then 1, then the rest.  "The rest" is so that you can find things
in sections other than 1* and so that if /usr/share/man doesn't
otherwise come into MANPATH you can still find other information that
is likely important.

For the sake of accuracy, it would translate to:

/usr/share/man,1b:/usr/share/man,1,1m,1s,1t,1c,1f:/usr/share/man,<the
other MANSECTS from man.cf not previously listed>

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



More information about the opensolaris-arc mailing list