LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 10-17-2014, 08:27 PM   #1
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 20,023
Blog Entries: 28

Rep: Reputation: 6388Reputation: 6388Reputation: 6388Reputation: 6388Reputation: 6388Reputation: 6388Reputation: 6388Reputation: 6388Reputation: 6388Reputation: 6388Reputation: 6388
Strange man file behavior


This is not a complaint nor a question, just an observation. It might be a bug report.

I decided I wanted to learn a little more about suspend from the command line, so I went looking for a man page.

Here's what I turned up.

Code:
$ apropos power
(snip)
pm []                (8)  - powersave - Put your computer into low power mode
(snip)
$ man pm
No manual entry for pm
$ ls /usr/share/man/man8/pm*
/usr/share/man/man8/pm-action.8.gz     /usr/share/man/man8/pm-suspend-hybrid.8.gz
/usr/share/man/man8/pm-hibernate.8.gz  /usr/share/man/man8/pm-suspend.8.gz
/usr/share/man/man8/pm-pmu.8.gz        /usr/share/man/man8/pmap_dump.8.gz
/usr/share/man/man8/pm-powersave.8.gz  /usr/share/man/man8/pmap_set.8.gz
$ man 8 pm 
No entry for pm in section 8 of the manual
The command

Code:
$ man pm-suspend
displays the appropriate man page.

I got the same behavior on both Slackware --Current machines.

If there is a question, it's this: Why does apropos power report a man page that does not exist, while not reporting pages that do exist?
 
Old 10-17-2014, 09:45 PM   #2
55020
Senior Member
 
Registered: Sep 2009
Location: Yorks. W.R. 167397
Distribution: Slackware
Posts: 1,307
Blog Entries: 4

Rep: Reputation: Disabled
man makewhatis

(Once upon a time wasn't there a cron job for that in most Unixen? Did it go out of fashion, like smallpox?)
 
1 members found this post helpful.
Old 10-18-2014, 01:16 AM   #3
mancha
Member
 
Registered: Aug 2012
Posts: 484

Rep: Reputation: Disabled
This one was fun...

When I saw your apropos output I thought: fugly! What are those empty brackets and why'd it split up the hyphenated command like that.

Also, why the $%#@ does makewhatis take longer than compiling Firefox?

Turns out both problems (brackets and hyphenation) are due to the same core issue. So, I prepared a patch that fixes Slackware's man-1.6g
package: man-1.6g_awk_like_a_boss.diff (add it to the slackbuild and re-build)

If you don't want to rebuild the package, apply the patch's change directly to your live system (i.e. to /usr/sbin/makewhatis).

After that, rebuild your db with:

Code:
# /usr/sbin/makewhatis
--mancha

======================
Pre-patch:

Code:
$ apropos power | grep "^pm"
pm []                (8)  - powersave - Put your computer into low power mode

$ apropos Abekas
ppmtoyuv []          (1)  - convert a portable pixmap into an Abekas YUV file
yuvtoppm []          (1)  - convert Abekas YUV bytes into a portable pixmap
Post-patch:

Code:
$ apropos power | grep "^pm"
pm-powersave         (8)  - Put your computer into low power mode

$ apropos Abekas
ppmtoyuv             (1)  - convert a portable pixmap into an Abekas YUV file
yuvtoppm             (1)  - convert Abekas YUV bytes into a portable pixmap

Last edited by mancha; 10-18-2014 at 01:19 AM.
 
8 members found this post helpful.
Old 10-18-2014, 10:28 PM   #4
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 20,023

Original Poster
Blog Entries: 28

Rep: Reputation: 6388Reputation: 6388Reputation: 6388Reputation: 6388Reputation: 6388Reputation: 6388Reputation: 6388Reputation: 6388Reputation: 6388Reputation: 6388Reputation: 6388
Output after running makewhatis as root:

Code:
$ apropos power
(snip)
on_ac_power []       (1)  - test whether the computer is running on line power
pm []                (8)  - powersave - Put your computer into low power mode
pow []               (3)  - power functions
(snip)
$ ls /usr/share/man/man8/pm*
/usr/share/man/man8/pm-action.8.gz     /usr/share/man/man8/pm-suspend-hybrid.8.gz
/usr/share/man/man8/pm-hibernate.8.gz  /usr/share/man/man8/pm-suspend.8.gz
/usr/share/man/man8/pm-pmu.8.gz        /usr/share/man/man8/pmap_dump.8.gz
/usr/share/man/man8/pm-powersave.8.gz  /usr/share/man/man8/pmap_set.8.gz
$ man pm
No manual entry for pm
man pm-suspend displays the man page, but the list of manpages starting with "pm-" still does not display in the output of apropos.

Realize, this isn't a big issue for me. I consider it more a quirk.

Also, I doubt it would be much of an issue for newbies; I know, when I was a newbie, I did not place much reliance on man pages, even after I learned about them. Man pages usually lack something newbies need: examples. It is the rare man page that has examples.

I was a fairly experienced self-taught Linux user when I learned about apropos. Knowing that command led me to use man pages much more often.

I do find it curious that the pages shown by ls /usr/share/man/man8/pm* are not listed in the output of apropos when they do appear in response to ls command. When I run a straight ls /usr/share/man/man8/ in a terminal, there does not appear to be any difference in how they are displayed amongst the other items in the output (in other words, they aren't displayed in different colors or anything like that there).

Thanks to everyone who has looked at this.

Last edited by frankbell; 10-18-2014 at 10:29 PM.
 
Old 10-18-2014, 11:02 PM   #5
MadMaverick9
Member
 
Registered: Aug 2010
Posts: 353
Blog Entries: 4

Rep: Reputation: Disabled
@frankbell
Quote:
Originally Posted by frankbell View Post
Code:
$ apropos power
(snip)
on_ac_power []       (1)  - test whether the computer is running on line power
pm []                (8)  - powersave - Put your computer into low power mode
pow []               (3)  - power functions
(snip)
Did you apply the patch provided by Mancha? Obviously not - since the "[]" still show in your listing.

@Mancha - Thank you for that patch.
 
1 members found this post helpful.
Old 10-18-2014, 11:33 PM   #6
MadMaverick9
Member
 
Registered: Aug 2010
Posts: 353
Blog Entries: 4

Rep: Reputation: Disabled
@frankbell
Quote:
Originally Posted by frankbell View Post
man pm-suspend displays the man page, but the list of manpages starting with "pm-" still does not display in the output of apropos.
Code:
bash $ man -k pm-
gpm-root             (1)  - a default handler for gpm, used to draw menus on the root window
pm-action            (8)  - Suspend or Hibernate your computer
pm-is-supported      (1)  - Test whether suspend or hibernate is supported
pm-pmu               (8)  - suspend the computer on machines using a Macintosh-style PMU
pm-powersave         (8)  - Put your computer into low power mode
Code:
bash $ man -k computer
(snip)
on_ac_power          (1)  - test whether the computer is running on line power
pm-action            (8)  - Suspend or Hibernate your computer
pm-pmu               (8)  - suspend the computer on machines using a Macintosh-style PMU
pm-powersave         (8)  - Put your computer into low power mode
tangram              (6)  - watch the computer solve tangram puzzles
xmatrix              (6)  - simulates the computer displays from the movie
(snip)
Of course with Mancha's patch applied and I simply ran "/opt/sbin/makewhatis -w" after that. I didn't want to update the original "/usr/sbin/makewhatis".
 
Old 10-18-2014, 11:50 PM   #7
MadMaverick9
Member
 
Registered: Aug 2010
Posts: 353
Blog Entries: 4

Rep: Reputation: Disabled
@Mancha:

Interestingly "pm-suspend" does not show up in the "man -k pm-" listing. It's because of:
Code:
# default find arg: no directories, no empty files
findarg0="-type f -size +0"
Code:
/usr/man/man8/pm-suspend.8.gz -> pm-action.8.gz
Could "-o \( -type l -xtype f \)" safely be added here or would that cause other problems?

Last edited by MadMaverick9; 10-19-2014 at 12:35 AM. Reason: added xtype.
 
Old 10-21-2014, 03:43 AM   #8
mancha
Member
 
Registered: Aug 2012
Posts: 484

Rep: Reputation: Disabled
Quote:
Originally Posted by MadMaverick9 View Post
@Mancha - Thank you for that patch.
You're very welcome.

Quote:
Originally Posted by MadMaverick9 View Post
@Mancha: Interestingly "pm-suspend" does not show up in the "man -k pm-" listing...Could "-o \( -type l -xtype f \)" safely be added here or would that cause other problems?
Good find. Unfortunately, crawling symlinks with Slackware's makewhatis might cause more heartache than it solves. Unless you overhaul its
awk logic, you'll end up with a much larger whatis db and redundant apropos/whatis output.

For example, if /usr/man/man1/B.1.gz points to /usr/man/man1/A.1.gz and A's manpage has:
Code:
NAME
	A, B - the winner takes it all
you'll end up with the following in your whatis database (sorted differently):
Code:
A	1  - the winner takes it all
B [A]	1  - the winner takes it all
B	1  - the winner takes it all
A [B]	1  - the winner takes it all
Normally you'd only have the first two. Big problem when projects combine many commands into one manpage and symlink (e.g. OpenSSL).

I continued squashing bugs in makewhatis' awk parser until it became clear I was re-arranging deck chairs on the Titanic. Full stop.

At some point Slackware might switch to a more robust alternative but, until then, I've put together build materials for a package I'm
calling man-db-lite (based on man-db). It provides apropos-ng and whatis-ng (that gracefully co-exist with Slackware's man utils) and
makewhatis-ng (small script that produces a whatis db usable by Slackware's apropos, whatis, etc.).

Install the package and create a new Slackware whatis database:
Code:
# makewhatis-ng
Afterwards, Slackware's apropos and whatis work as usual though you'll notice a slightly different format. I personally find the format
cleaner and easier to read.

The issues identified so far seem to all be dealt with well by man-db, e.g.
Code:
$ apropos pm-suspend
pm-suspend (8)       - Suspend or Hibernate your computer
pm-suspend-hybrid (8) - Suspend or Hibernate your computer
You can use the -ng versions of apropos and whatis to take advantage of richer features (see their manpages for more details).

--mancha

Last edited by mancha; 10-21-2014 at 04:32 AM.
 
3 members found this post helpful.
  


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
Strange behavior / User missing from group file funnyman Linux - Newbie 1 05-31-2012 01:10 PM
Strange file permissions and ownership behavior xiztrn Linux - Newbie 6 12-22-2011 04:14 AM
[SOLVED] Strange Mount Behavior After Unexpected Shutdown Mid File Transfer bdjnk Linux - Desktop 2 08-06-2010 04:05 PM
strange (to me) behavior of file permissions when copying file warrob Linux - General 10 10-25-2009 05:13 AM
Strange file behavior nc3b Linux - General 2 08-23-2006 01:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:54 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