AIX Open Source

AIX Open Source

Share your experiences and connect with fellow developers to discover how to build and manage open source software for the AIX operating system

 View Only
  • 1.  how to add toolbox to MANPATH in a sane way...

    Posted Sat April 16, 2022 12:41 AM
    Hi,

    I have an AIX 7.3 system (but I think this applies equally to AIX 7.2) on which we're running DNF with the toolbox and all is well with that.  On this machine, I would like /opt/freeware/share/man and /opt/freeware/man to be found by the man pages so if I were to say 

    $ man wget

    ... I would get some useful output.  On the other hand, if I say 

    $ man ls

    ... on this particular machine (and several others like it) I would still like the AIX-native man page for the AIX-native ls command to appear.  To be clear, I don't always want it this way as we have some users that don't even know they're on AIX.  Their shell is bash and /opt/freeware/bin is ahead of /usr/bin in $PATH so for those folks

    $ man ls

    ... should give the pages for GNU ls.

    I've been playing with MANPATH a bit attempting to change it in ~/.profile and discovered that it does not behave like I would expect.  For instance, it doesn't even exist as an environment variable natively and if you leave it that way you just get the AIX native things.  

    While I'm at it, I have something special in /usr/local/bin with pages in /usr/local/share/man that I'd also like to throw on the end to be found.  How do I get control of this thing.  it seems like there's something embedded someplace.  Can it be changed?  To be really clear, if I put this in ~/.profile

    export MANPATH=/usr/local/share/man:/usr/share/man:/usr/opt/man:/usr/lpp/X11/man:/opt/freeware/man:/opt/freeware/share/man

    ... and then I say

    $ man ls

    ... I get the GNU ls MAN pages and not the AIX MAN pages which if you look at what I have there is somewhat counterintuitive.  The logic of MANPATH traversal or whatever it's called does not work the way I would expect.  I freely admit that I don't know what I'm doing with this and need help.

    Can I add thing I want and/or put things in the order I want?  How?  Please advise.  

    Thanks,
    Mike

    ------------------------------
    Michael Metts
    ------------------------------


  • 2.  RE: how to add toolbox to MANPATH in a sane way...

    Posted Mon April 18, 2022 01:34 PM
    I think AIX man design is if you provide MANPATH or -M then it gives preference to that for searching man pages. If it does not find in that path then it gives from default AIX man page. 
    You can specify -a with man command then it will provide you all the man paths first those are in MANPATH and then default AIX. 
    If you want to keep AIX default but sometime want to look at specific man page from specific dir then you can use -M option.

    ------------------------------
    SANKET RATHI
    ------------------------------



  • 3.  RE: how to add toolbox to MANPATH in a sane way...

    Posted Thu July 14, 2022 08:54 AM

    I do not know if you have resolved this for yourself but on a new AIX 7.2 system (current TL/ML/SP/FP) all I needed to do was add the following to /etc/environment

    MANPATH=/opt/freeware/man:/opt/freeware/share/man

    man ls gave me AIX man pages and man bash game be the man pages coming out of freeware for bash.

    Hope it is that simple for your use. I'd just tack /usr/local/share/man onto the end of the environment MANPATH and hopefully that will take care of it for you.



    ------------------------------
    Demian Phillips
    ------------------------------



  • 4.  RE: how to add toolbox to MANPATH in a sane way...

    Posted Fri July 15, 2022 10:56 AM

    Yes, there's some built-in inconveniences...

    If you "man ls", it will search each directory in the path for variations of "/dir/{man|cat}[CLFnlpo1-8]/ls{.[CLFnlpo1-8]{.z}?}?" plus some extra patterns for sections 3 and 8 .

    Only if it doesn't match *any* file, will it go into /usr/share/man/info/EN_US where it will again try several options:
    /usr/share/man/info/EN_US/a_doc_lib/cmds

    /usr/share/man/info/EN_US/a_doc_lib/cmds/[a-z]_commands/ls.htm{l}? before finally finding /usr/share/man/info/EN_US/a_doc_lib/cmds/l_commands/ls.html

    I'm 95% certain that at some point in time, it used to do the right thing (i.e. find the "info" pages in the man directories instead of searching in the end)

    Also, if you use a specific (known-not to match) path, MANPATH=/opt/ibm/sysmgt/dsm/man truss man ls > z 2>&1

    The man command follows the patterns I've mentioned before, for the following directories:

    /usr/share/man  <=== Oi ?  That wasn't in the MANPATH !!!

    /usr/dt/man <=== Same here

    /opt/ibm/sysmgt/dsm/man <== The one in the MANPATH

    /usr/share/man/info/EN_US <== Not in the MANPATH either.

    The real MANPATH seems to be /usr/share/man:/usr/dt/man:$MANPATH:/usr/share/man/info/EN_US where the last one is searched for the html version.

    All of this is in "man man" (except /usr/dt/man), but no-one ever reads the manual pages (including myself)

    I think you should open a PMR (not following the MANPATH is a bug) as this makes it impossible to set PATH and MANPATH and still get "man somecommand" to make any sense. 



    ------------------------------
    José Pina Coelho
    IT Specialist at Kyndryl
    ------------------------------