Slackware This Forum is for the discussion of Slackware Linux.
|
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
|
06-16-2014, 03:48 AM
|
#1
|
Member
Registered: Jun 2013
Distribution: Slackware
Posts: 44
Rep:
|
man command and silly behavior
Hello guys,
I was wondering if you have ever experienced such problem:
I have the man command that when launched from root doesn't show every man page, but from normal user it displays them without any problem.
For instance it does this silly behavior with the command useradd, showing a blank file when called from root and it show the correct man page when called from normal user..
Quote:
bash-4.2# echo $MANPATH
/usr/local/man:/usr/man
|
Quote:
bash-4.2$ echo $MANPATH
/usr/local/man:/usr/man
|
Quote:
find /usr/man/ -name useradd*
/usr/man/fr/man8/useradd.8.gz
/usr/man/zh_TW/man8/useradd.8.gz
/usr/man/id/man8/useradd.8.gz
/usr/man/ru/man8/useradd.8.gz
/usr/man/tr/man8/useradd.8.gz
/usr/man/zh_CN/man8/useradd.8.gz
/usr/man/ja/man8/useradd.8.gz
/usr/man/de/man8/useradd.8.gz
/usr/man/man8/useradd.8.gz <--directory where useradd and usermod pages are
/usr/man/it/man8/useradd.8.gz
|
Quote:
ls -l /usr/man/man8/|grep useradd*
-rw-r--r-- 1 root root 5.3K Feb 14 22:55 useradd.8.gz
bash-4.2$ ls -l /usr/man/man8/|grep usermod*
-rw-r--r-- 1 root root 3.3K Feb 14 22:55 usermod.8.gz
|
Strange thing.. "man usermod" works fine from both user and root...
What could be the reason?
|
|
|
06-16-2014, 04:06 AM
|
#2
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,747
|
you need either use ls /usr/man/man8/useradd* or ls /usr/man/man8|grep useradd, but do not add * in this grep pattern.
you can try strace -f -o /tmp/strace.log man useradd and check how man tried to look for those files.
|
|
|
06-16-2014, 05:15 AM
|
#3
|
Member
Registered: Jun 2013
Distribution: Slackware
Posts: 44
Original Poster
Rep:
|
Thanks for the help pal... in the log indeed they are accessing two different files:
From Root:
Quote:
999 9557 execve("/usr/bin/unxz", ["/usr/bin/unxz", "-c", "/usr/man/cat8/useradd.8 .xz"], [/* 39 vars */] <unfinished ...>
|
From user
Quote:
700 9530 stat64("/usr/man/man8/useradd.8.gz", {st_mode=S_IFREG|0644, st_size=5 361, ...}) = 0
701 9530 stat64("/usr/man/cat8/useradd.8.xz", 0xbfa169f0) = -1 EACCES (Permiss ion denied)
702 9530 stat64("/usr/man/cat8/useradd.8.xz", 0xbfa16ac0) = -1 EACCES (Permiss ion denied)
|
but eventually:
Quote:
1687 9537 execve("/bin/gunzip", ["/bin/gunzip", "-c", "/usr/man/man8/useradd.8. gz"], [/* 40 vars */] <unfinished ...>
|
So the problem is that they access different files... Indeed:
man /usr/man/cat8/useradd.8.xz
Quote:
fgets: No such file or directory
Error reading man page /usr/man/cat8/useradd.8.xz
No manual entry for /usr/man/cat8/useradd.8.xz
|
man /usr/man/cat8/userdel.8.xz <-- Works fine.. Maybe then some files are corrupted. I tried reinstalling these packages:
[ installed ] - shadow-4.1.5.1-i486-3_slack14.1
[ installed ] - bash-completion-2.1-noarch-1
but no luck so far...
what can it be?
also, why is adding * in the grep pattern a bad thing?
Your answer has been very helpful thanks!
|
|
|
06-16-2014, 05:41 AM
|
#4
|
Member
Registered: Jun 2013
Distribution: Slackware
Posts: 44
Original Poster
Rep:
|
My solution has been to replace the gz file with the xz and of course I changed the type of archive.. works fine so it should be fine..
|
|
|
06-16-2014, 05:42 AM
|
#5
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,747
|
the * has a special meaning and it is not what you need. Otherwise it causes no problem in your case.
I would suggest you to run that strace for both useradd and usermod (and for both root and user) and find the differences. I think there is a permission problem or an environment variable was not set properly...
|
|
|
06-16-2014, 07:29 AM
|
#6
|
Member
Registered: Jun 2013
Distribution: Slackware
Posts: 44
Original Poster
Rep:
|
I know what you mean about * but in that case works fine either way.. though your suggestion is more correct..
What is curious is why I have the user* man in both directories /usr/man/man8 and /usr/man/cat8 with a different archive extension..
|
|
|
06-16-2014, 10:54 AM
|
#7
|
LQ Veteran
Registered: May 2008
Posts: 7,011
|
Quote:
Originally Posted by johnpuppa
I know what you mean about * but in that case works fine either way.. though your suggestion is more correct..
What is curious is why I have the user* man in both directories /usr/man/man8 and /usr/man/cat8 with a different archive extension..
|
Check the date-stamps on the files. I suspect the .gz ones are older, and that the default compression was changed in man.conf at some point.
On a more general point:
Do the cached man-pages actually add any value these days? Processors are a damn sight faster than they used to be, so reformatting time is going to be unnoticeable, and the cached pages only get created/used on a 80 column wide display anyway, which I suspect doesn't match what most of us are using on a regular basis (mine is typically 159). Probably best to just set NOCACHE in man.conf and do away with the cat dirs completely.
And speaking of man.conf, what is it doing in /usr/lib64? Wouldn't /etc be far more appropriate?
|
|
1 members found this post helpful.
|
06-17-2014, 05:18 AM
|
#8
|
Member
Registered: Sep 2003
Location: The Netherlands
Distribution: Slackware
Posts: 124
Rep:
|
Quote:
Originally Posted by GazL
And speaking of man.conf, what is it doing in /usr/lib64? Wouldn't /etc be far more appropriate?
|
Yes, I agree, /usr/lib64 is an inappropriate place for a configuration file. Pat, can you please move it to /etc ?
|
|
|
06-17-2014, 07:55 AM
|
#9
|
Senior Member
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541
|
Anymore, the cat directories are empty (Slackware 14.1) -- they live in /var/man and there are symbolic links to each directory ( cat1 - cat9 and catn) in /usr/man. For a long time there were two sets of manual pages, one set with the man macros, the other, the cat pages, as formatted text. And, of course, there are multiple languages so you'll see man pages in the language specified by your locale. See man man for a description. The purpose was to cut down on the formatting time of manual pages to a simple text file and that was done automatically when the man utility was invoked (or you could force it, building all the I]cat[/I] pages in one go. Nowadays, why bother.
Manual pages are written using the man macros, embedded codes that specify how to display text. The codes are of the form at the beginning of a line followed by one or more characters. You can see what an unformatted manual page looks like with, say
Code:
zmore /usr/man/man8/useradd.8.gz
The codes are described in
Code:
man groff_man
man 7 man
Unix provides nroff and troff for formatting documents (including manual pages); Linux provides look- work-alike groff. Both, pretty much, will format and display ( nroff, groff) or "typeset" ( troff/groff documents. There are, at least on Slackware 14.1, a troff and nroff program, but you're expected to use the GNU analogs, groff.
As to the use or non use of the asterisk with the find utility: it's better to enclose arguments in single quotes when using the asterisk; e.g.,
Code:
find /usr/man -type f -name 'useradd*'
prevents problems and weirdness, that.
If you like to have hard copy of a particular manual page, you can invoke
Code:
man -t useradd | lp
and you'll get a formatted hard copy (rather nicely formatted, too).
What the -t argument does is "typeset" a document (the output is PostScript), which you pipe to your printer.
The published books written by the likes of Dennis Ritchie, Brian Kernighan and others at AT&T Bell Labs were all written using text macros for formatting (as with the manual macros). You have all of these for creating tables, equations, graphs, formatted text and so on on your Slackware system.
The rules are real simple: - Start every sentence on a new line;
- Leave a blank line for a paragraph.
Try it: write a few lines of text, leave a blank line here and there, save as a file and
See hat you get.
Hope this helps some.
|
|
1 members found this post helpful.
|
06-17-2014, 08:31 AM
|
#10
|
LQ Veteran
Registered: May 2008
Posts: 7,011
|
Quote:
Originally Posted by tronayne
Anymore, the cat directories are empty (Slackware 14.1) -- they live in /var/man and there are symbolic links to each directory (cat1 - cat9 and catn) in /usr/man.
|
They're empty initially, but will fill up as you read man-pages on an 80 column terminal. That's why I mentioned setting the NOCACHE option.
|
|
|
06-17-2014, 09:02 AM
|
#11
|
Senior Member
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541
|
Quote:
Originally Posted by GazL
They're empty initially, but will fill up as you read man-pages on an 80 column terminal. That's why I mentioned setting the NOCACHE option.
|
Hm.
Mine are all empty (and I do read man pages fairly often), seems like the cat "feature" is shut off by default and I really wouldn't want to turn it back on anyway.
Stuff changes, methinks, sometimes for the better, sometimes for the worse.
|
|
|
06-17-2014, 09:19 AM
|
#12
|
LQ Veteran
Registered: May 2008
Posts: 7,011
|
Seems that in order for them to be created, as well as having to be on a 80 column terminal, you also need to be root, (probably due to the permissions on the directories), which may go some what to explaining why the few pages that existed in my system were for things like lilo(8).
Last edited by GazL; 06-17-2014 at 09:27 AM.
|
|
|
06-17-2014, 04:04 PM
|
#13
|
Member
Registered: Jun 2013
Distribution: Slackware
Posts: 44
Original Poster
Rep:
|
thanks for the explanation tronayne. Really cool!
|
|
|
06-17-2014, 08:13 PM
|
#14
|
Senior Member
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,792
|
Quote:
Originally Posted by GazL
Seems that in order for them to be created, as well as having to be on a 80 column terminal, you also need to be root, (probably due to the permissions on the directories),...
|
In olden times, the man command was set-GID to " man" and the various "cat*" directories had group write permission to let that work. All that is left of that today is existance of a "man" group in /etc/group.
|
|
1 members found this post helpful.
|
06-17-2014, 08:47 PM
|
#15
|
Member
Registered: Apr 2011
Location: California, USA
Distribution: Slackware
Posts: 528
|
Quote:
Originally Posted by GazL
Seems that in order for them to be created, as well as having to be on a 80 column terminal, you also need to be root
|
That is the case on the Slackware64 14.0 system in front of me. Both conditions were necessary (80 columns, root) before the cat file was created.
|
|
|
All times are GMT -5. The time now is 05:05 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|