Subject: misc/3087: makewhatis fails if the manpage is only a link - obsoletes misc/3086
To: None <gnats-bugs@gnats.netbsd.org>
From: None <frueauf@ira.uka.de>
List: netbsd-bugs
Date: 01/06/1997 15:08:36
>Number:         3087
>Category:       misc
>Synopsis:       makewhatis fails if the manpage is only a link - obsoletes misc/3086
>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 06:20:01 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:
	
Sorry for pr misc/3086 - did a diff to the false file. This one is the
correct one.

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) and makes also a find over
non formated man pages:

*** makewhatis.sh-orig	Fri May 12 12:58:29 1995
--- makewhatis.sh	Mon Jan  6 14:53:40 1997
***************
*** 1,6 ****
--- 1,10 ----
  #! /bin/sh
  #
  # Written by J.T. Conklin <jtc@netbsd.org>.
+ #
+ # Little addons to handle also linked and unformated 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,44 ----
  	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 '*.[1-9]' -print | while read file
! do
! 	nroff -man $file | sed -n -f /usr/share/man/makewhatis.sed;
! done >> /tmp/whatis$$
! 
! find $MANDIR \( -type f -or -type l \) -name '*.[1-9]?' -print | while read file
! do
! 	nroff -man $file | sed -n -f /usr/share/man/makewhatis.sed;
! 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 - obsoletes misc/3086