Subject: misc/3086: makewhatis fails if the manpage is only a link
To: None <gnats-bugs@gnats.netbsd.org>
From: None <frueauf@ira.uka.de>
List: netbsd-bugs
Date: 01/06/1997 13:44:39
>Number:         3086
>Category:       misc
>Synopsis:       makewhatis fails if the manpage is only a link
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    misc-bug-people (Misc Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Jan  6 05:05:02 1997
>Last-Modified:
>Originator:     Thorsten Frueauf
>Organization:
private
	
>Release:        <NetBSD-current source date> NetBSD current 05.01.1997
>Environment:
	
System: NetBSD cyberlap 1.2B NetBSD 1.2B (CYBERLAP) #5: Sun Jan 5 13:41:03 CET 1997 frueauf@cyberlap:/usr/src/sys/arch/i386/compile/CYBERLAP i386


>Description:
	
If one installs packages to /usr/local like the EasyInstall concept from
Hubert Feyrer, then packages look like:

/usr/local/package-version/{bin,man,lib,etc} 

and the /usr/local/package-version/install/install.sh makes the necessary links
to the /usr/local/{bin,man,lib,etc} hierarchie.

So e.g. the manpage for package foo is a link in /usr/local/man:

/usr/local/man/man1/foo.1 --> /usr/local/foo-x.y/man/man1/foo.1

If one trys to run `/usr/libexec/makewhatis /usr/local/man` one ends
up with an empty /usr/local/man/whatis.db file (or only those listed
who are real files in /usr/local/man/*).

>How-To-Repeat:
	

Try out the above scenario.

>Fix:
	

Apply the following patch to /src/libexec/makewhatis/makewhatis.sh which
uses also -type l in the find command and adds the -f flag to gzip (cause
gzip by default only uncompresses real files):


*** makewhatis.sh-orig	Fri May 12 12:58:29 1995
--- makewhatis.sh	Mon Jan  6 13:43:10 1997
***************
*** 1,6 ****
--- 1,10 ----
  #! /bin/sh
  #
  # Written by J.T. Conklin <jtc@netbsd.org>.
+ #
+ # Little addons to handle also linked man pages
+ # by Thorsten Frueauf <frueauf@ira.uka.de>.
+ #
  # Public domain.
  #
  
***************
*** 12,30 ****
  	exit 1
  fi
  
! find $MANDIR -type f -name '*.0' -print | while read file
  do
  	sed -n -f /usr/share/man/makewhatis.sed $file;
  done > /tmp/whatis$$
  
! find $MANDIR -type f -name '*.0.Z' -print | while read file
  do
  	zcat $file | sed -n -f /usr/share/man/makewhatis.sed;
  done >> /tmp/whatis$$
  
! find $MANDIR -type f -name '*.0.gz' -print | while read file
  do
! 	gzip -dc $file | sed -n -f /usr/share/man/makewhatis.sed;
  done >> /tmp/whatis$$
  
  sort -u -o /tmp/whatis$$ /tmp/whatis$$
--- 16,34 ----
  	exit 1
  fi
  
! find $MANDIR \( -type f -or -type l \) -name '*.0' -print | while read file
  do
  	sed -n -f /usr/share/man/makewhatis.sed $file;
  done > /tmp/whatis$$
  
! find $MANDIR \( -type f -or -type l \) -name '*.0.Z' -print | while read file
  do
  	zcat $file | sed -n -f /usr/share/man/makewhatis.sed;
  done >> /tmp/whatis$$
  
! find $MANDIR \( -type f -or -type l \) -name '*.0.gz' -print | while read file
  do
! 	gzip -fdc $file | sed -n -f /usr/share/man/makewhatis.sed;
  done >> /tmp/whatis$$
  
  sort -u -o /tmp/whatis$$ /tmp/whatis$$
>Audit-Trail:
>Unformatted:
makewhatis fails if the manpage is only a link