Bug 33897 - apropos (man -k) and whatis (man -f) don't look in manpath for whatis databases
Summary: apropos (man -k) and whatis (man -f) don't look in manpath for whatis databases
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: man
Version: 7.1
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Bernhard Rosenkraenzer
QA Contact: Aaron Brown
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-03-29 16:38 UTC by David D. Johnson
Modified: 2007-04-18 16:32 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-03-08 14:06:56 UTC
Embargoed:


Attachments (Terms of Use)

Description David D. Johnson 2001-03-29 16:38:32 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.76 [en] (X11; U; Linux 2.4.2 i686)


Apropos and whatis were both changed to look in /var/cache/man for whatis
databases.  Unfortunately, the "$manpath" part of the original command was
deleted during the change.  /usr/lib/whatis is obsolete, but it is still
searched.  

Reproducible: Always
Steps to Reproduce:
1.man -k rpm
2.apropos rpm
3.whatis rpm
	

Actual Results:  rpm: nothing appropriate

Expected Results:  mookie:~# apropos rpm
Rpmfind [rpmfind]    (1)  - find rpms on the internet
autorpm              (8)  - RPM FTP Mirror and/or Auto-Update utility
autorpm.conf [autorpm] (5)  - Config file for AutoRPM
rpm                  (8)  - Red Hat Package Manager
rpm2cpio             (8)  - Extract cpio archive from RPM Package Manager
(RPM) package
mookie:~# whatis rpm
rpm                  (8)  - Red Hat Package Manager

Change these two lines in /usr/bin/apropos and /usr/bin/whatis:
71c71
<     for d in /var/cache/man /usr/lib
---
>     for d in /var/cache/man $manpath /usr/lib
105c105
<     for d in /var/cache/man /usr/lib
---
>     for d in /var/cache/man $manpath /usr/lib

Comment 1 David D. Johnson 2001-03-29 17:09:58 UTC
The /usr/sbin/makewhatis script was also broken in this release.
The value /var/cache/man was substituted everywhere a manual path element had
been used previously, even in loops.  For example the /var/cache/man/whatis file
is clobbered once for each directory in the manpath.  The result of these
misbegotten changes is that the whatis files in the manpath are not updated, and
the whatis file in /var/cache/man only contains information from manual pages
that have "cat" versions living under /var/cache/man.  Manual pages that have
not been read before on the system will never show up in whatis.  What good is
that?

Comment 2 Bernhard Rosenkraenzer 2001-04-25 09:16:52 UTC
Part #1 is fixed in 1.5i-1 to support legacy systems.
Part #2 was never a problem, because /var/cache/man/whatis contains info about 
non-preformatted man pages. We aren't supposed to write anything to /usr (can 
be mounted read-only), so we're redirecting the whatis database for anything 
to /var/cache/man.



Comment 3 David D. Johnson 2001-04-25 12:20:09 UTC
I noticed that the whatis database did include the unformatted pages after
one of the cron jobs had run, however when I ran the usual (documented only
in the makewhatis script) the manual pages for the package that I had just
installed did not show up.  Could you please check that the makewhatis script
can properly deal with freshly installed man pages, even though the dates on
the man page sources reflect the time the package was created and not when
they were installed?  Thank you.

	-- ddj

Comment 4 Need Real Name 2001-08-22 14:37:40 UTC
I think I've fixed the problem with makewhatis not including all pages in the
database. It seems that makewhatis was skipping all "man" directories after the
first one. I believe the logic should skip all "cat" directories instead. I made
the following fix (/usr/sbin/makewhatis, line 150):

OLD:
if ... $pages = man ...

NEW:
if ... $pages = cat ...

and it seems to have fixed the problem. Of course, I could have created other
problems.

Comment 5 Robert Basch 2002-11-14 20:22:06 UTC
The problem in the original bug report -- that the apropos and whatis commands
do not look for whatis databases in $manpath -- still exists, at least in
Red Hat 7.3, and apparently 8.0 as well.  These commands make two grep passes
over the whatis files -- one to see if the string is found, and another to
display the match -- but now only include $manpath whatis files in the second
pass.  So they will fail to find anything in a $manpath whatis, unless the
thing you're looking for happens to be in /var/cache/man/whatis or
/usr/lib/whatis.  This problem is noticeable in our environment, as our
users mount various network filesystems containing whatis files only on an
as-needed basis; thus we cannot address this via makewhatis.

The following patch to whatis is needed to get the correct behavior
(apropos needs the same change):

--- /usr/bin/whatis     Mon Mar 25 09:17:18 2002
+++ ./whatis    Thu Nov 14 15:13:22 2002
@@ -70,7 +70,7 @@
 found=0
 while [ $found = 0 -a -n "$1" ]
 do
-    for d in /var/cache/man /usr/lib
+    for d in /var/cache/man $manpath /usr/lib
     do
         if [ -f $d/whatis ]
         then

Comment 6 Miloslav Trmac 2004-03-08 14:06:56 UTC
Looks fixed in man-1.5k-12.


Note You need to log in before you can comment on or make changes to this bug.