Bug 33897 - apropos (man -k) and whatis (man -f) don't look in manpath for whatis databases
apropos (man -k) and whatis (man -f) don't look in manpath for whatis databases
Status: CLOSED CURRENTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: man (Show other bugs)
7.1
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Bernhard Rosenkraenzer
Aaron Brown
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-03-29 11:38 EST by David D. Johnson
Modified: 2007-04-18 12:32 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-03-08 09:06:56 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description David D. Johnson 2001-03-29 11:38:32 EST
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 12:09:58 EST
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 05:16:52 EDT
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 08:20:09 EDT
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 10:37:40 EDT
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 15:22:06 EST
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 09:06:56 EST
Looks fixed in man-1.5k-12.

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