manpage index incomplete, insufficient docs
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
man2html (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Binary package hint: man2html
currently man2html indexes a limited amount of manpages. The database is created as a postinst script:
# taken from man2html/
34 if [ -e /usr/local/man ]; then
35 LOCALMAN=$(find /usr/local/man -type d -name "man?")
36 fi
37
38 if [ -e /usr/local/
39 LOCALSMAN=$(find /usr/local/
40 fi
41
42
43 index++ --config-
44 /usr/share/man/man* \
45 /usr/man/man* \
46 /usr/X11R6/man/man* $LOCALMAN $LOCALSMAN 2>&1 > "$tf" &
# end from from man2html/
This is insufficient because:
1) it leaves out /opt/man/, which is by default in the manpath of ubuntu 8.04
2) does not adapt when users add manpages in nonstandard paths. The solution simply would be to echo the manpath using the manpath utility and pipe the output to awk. This should not be a problem as man2html already depends on gnu-awk and the man-db utilities. Then the database should be updated from this information
for example, this is my manpath:
$ manpath
3) includes no documentation concerning how to update the database, or how the database was original created by the postinstall script
thanks
orbisvicis
change the affected section to this:
#!/bin/bash
# by: orbisvicis
manpath=$(manpath -g)
# Set the bash delimiter
# Spaces are mandatory when creating the array so bash does not becore confused
IFS=:
pathArray=( $manpath )
unset IFS
# From the bash man-pages
echo -n "symlink: "
echo -n "duplicate,ignored: "
else
echo -n "redirected to: "
path= $(readlink -n --canonicalize $path)
pathFull= $path"/ man*/"
pathGlob= ($pathFull) +=$path" :" || echo $path": no \"man*\" subdirectories"
# Allow patterns which match no files to expand to a null string rather than themselves
shopt -s nullglob
for path in "${pathArray[@]}"
do
# fixing the symlink issue: symlinks to directories will be considered empty. Undesirable if symlink points outside manpath
# Must also check that the new link value is not already part of the manpath, dont want to give swish++ duplicate paths
# requires readlink
if [[ -h $path ]];then
# This works here due to read order, might not work in other versions/shells
if [[ $manpath = *$(readlink -n --canonicalize $path)* ]];then
fi
fi
# verify that the directory exists and contains the /man*/ subdirectories
# Note that this will return a false (no subdirectories) for symlinks as they are treated as files
# *this can make a difference if the link is not included in the manpath
(( ${#pathGlob[*]} )) && pathStringExist
# Note that now ${path[@]} holds all the elements that matches the glob
# This is useful for performing operations using ${path[@]}
#echo ${pathGlob[@]}
done
# Unset the nullglob option
shopt -u nullglob
IFS=:
pathArrayExist=( $pathStringExist )
unset IFS
echo "${pathArrayExi st[@]}"
if [[ -e /var/cache/ man2html/ ]] && [[ -x /usr/bin/index++ ]];then man2html/ man2html. swish++ .index ]];then man2html/ man2html. swish++ .index* /var/cache/ man2html/ manindexh* /var/cache/ man2html/ whatish- *
if [[ -e /var/cache/
rm /var/cache/
fi
echo "see /usr/share/man2html for configuration options" file=/usr/ share/man2html/ swish++ .conf "${pathArrayExi st[@]}"
index++ --config-
echo "Done, recommend restarting webserver"
fi