LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-04-2006, 12:44 AM   #1
ayhopkins
LQ Newbie
 
Registered: Apr 2002
Distribution: Linux
Posts: 14

Rep: Reputation: Disabled
Default $MANPATH Path Order


OS: SuSE 10.1

I don't seem to be able to change the order of the default $MANPATH which is set in the /etc/profile with /usr/bin/manpath.

I tried changing the order of manpaths in /etc/manpath.config and then rebuilding the man databases using "mandb -s", but /usr/share/man always comes first, even when I set up all three sections with /usr/local/man first.

Is there a way to change this ordering?

Last edited by ayhopkins; 08-04-2006 at 12:45 AM.
 
Old 08-04-2006, 02:27 AM   #2
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 77
If you read the FHS, /usr/bin is supposed to only contain executables. If you put a directory in there i.e., you are violating its use. Most apps that are in /usr/bin have corresponding man pages in /usr/share/man. Anyway why do you need to reorder these paths? I don't think the order makes any difference because it a newer man pages exists in /usr/local/man or /usr/local/share/man, thats the one that will be used.
 
Old 08-04-2006, 02:36 AM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594
Test this on an unprivileged account. Export PATH statement (influences man searchpaths) with /usr/local first. Now execute "strace man --path nonexistantmanpage 2>&1 | grep ^open" and see if for each section it checks /usr/local first. If this works you now know what to do. Note that changing paths systemwide can lead to unwanted behaviour: different user accounts have different requirements. For instance root and system users (UID < 500) most likely don't need /usr/local first, and on systems where there's PAM helper apps in /usr/bin users with UID >= 500 (unprivileged users) need to have /usr/bin before /bin in their path. Per-user settings, in say /etc/profile.d/local.sh if you use Bash, would be a better option because it's easier managable. Contents of executable script /etc/profile.d/local.sh could be as easy as for instance:
Code:
#!/bin/sh
[ "$(id -u)" -gt "500" ] && export PATH=/usr/local/bin/usr/bin:/bin

I don't think the order makes any difference because it a newer man pages exists in /usr/local/man or /usr/local/share/man, thats the one that will be used.
I thought man used a "display first match found" approach?
 
Old 08-04-2006, 02:48 AM   #4
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 77
Quote:
I thought man used a "display first match found" approach?
Mmm, I always thought it used the latest. I'll have to check this and make sure I know what I am talking about.

EDIT: You are right unSpawn. I've done some reading and found out that if the MANPATH variable is set, the directories are searched in the order they appear and the first entry is read by man. What threw me is that on Suse, /usr/local/man and related directories are set to be searched first and not /usr/man or /usr/share/man.

Last edited by reddazz; 08-04-2006 at 10:06 AM.
 
Old 08-04-2006, 01:45 PM   #5
ayhopkins
LQ Newbie
 
Registered: Apr 2002
Distribution: Linux
Posts: 14

Original Poster
Rep: Reputation: Disabled
Thank you.

You are right, the MANPATH is set in the exact order of the PATH command. Also, I wasn't getting the latest man page first I was always getting the first in the manpath.

I was examining the MANPATH as root, and whenn I tried another user "/usr/local/man" showed up first. Basically /etc/manpath.config adds what isn't there.

Non-privileged User:
echo $PATH
/home/<user>/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/games:/opt/gnome/bin:/opt/kde3/bin:/opt/cross/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin:.:/usr/lib/qt3/bin

echo $MANPATH
/usr/local/man:/usr/local/share/man:/usr/share/man:/usr/X11R6/man:/opt/gnome/share/man:/usr/local/perl/man

Root:
echo $PATH
/sbin:/usr/local/sbin:/usr/sbin:/opt/kde3/sbin:/opt/gnome/sbin:/root/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/games:/opt/gnome/bin:/opt/kde3/bin:/opt/cross/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin:.:/usr/lib/qt3/bin

echo $MANPATH
/usr/share/man:/usr/local/man:/usr/local/share/man:/usr/X11R6/man:/opt/gnome/share/man:/usr/local/perl/man:/usr/local/openssl/man

As for your other question as to why?
I installed source versions of some applications in /usr/local/ but I could not remove the application packages from the OS because they had so many dependencies (which I know were not always necessary) that I had to leave them in place.


Thanks again.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
MANPATH weirdness johnMG Debian 2 04-04-2006 12:47 PM
Manpath praveenv Linux - Newbie 2 08-28-2004 02:21 AM
default path for OpenOffice? mcd Mandriva 1 05-29-2004 06:37 AM
Default PATH Itsu Linux - Software 5 01-30-2004 07:27 AM
Default path log Linux - Newbie 1 01-13-2003 09:13 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:21 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration