manpage index incomplete, insufficient docs

Bug #246816 reported by orbisvicis
Affects Status Importance Assigned to Milestone
man2html (Ubuntu)
Fix Released

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/man2html-1.6e/debian/postinst
 34 if [ -e /usr/local/man ]; then
 35 LOCALMAN=$(find /usr/local/man -type d -name "man?")
 36 fi
 38 if [ -e /usr/local/share/man ]; then
 39 LOCALSMAN=$(find /usr/local/share/man -type d -name "man?")
 40 fi
 43 index++ --config-file=/usr/share/man2html/swish++.conf \
 44 /usr/share/man/man* \
 45 /usr/man/man* \
 46 /usr/X11R6/man/man* $LOCALMAN $LOCALSMAN 2>&1 > "$tf" &
# end from from man2html/man2html-1.6e/debian/postinst

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


Revision history for this message
orbisvicis (orbisvicis) wrote : Re: fix

change the affected section to this:
# by: orbisvicis

manpath=$(manpath -g)

# Set the bash delimiter
# Spaces are mandatory when creating the array so bash does not becore confused
pathArray=( $manpath )
unset IFS

# From the bash man-pages
# Allow patterns which match no files to expand to a null string rather than themselves
shopt -s nullglob
for path in "${pathArray[@]}"
        # 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
                echo -n "symlink: "
                # This works here due to read order, might not work in other versions/shells
                if [[ $manpath = *$(readlink -n --canonicalize $path)* ]];then
                        echo -n "duplicate,ignored: "
                        echo -n "redirected to: "
                        path=$(readlink -n --canonicalize $path)
        # 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+=$path":" || echo $path": no \"man*\" subdirectories"
        # Note that now ${path[@]} holds all the elements that matches the glob
        # This is useful for performing operations using ${path[@]}
        #echo ${pathGlob[@]}
# Unset the nullglob option
shopt -u nullglob

pathArrayExist=( $pathStringExist )
unset IFS

echo "${pathArrayExist[@]}"

if [[ -e /var/cache/man2html/ ]] && [[ -x /usr/bin/index++ ]];then
        if [[ -e /var/cache/man2html/man2html.swish++.index ]];then
                rm /var/cache/man2html/man2html.swish++.index* /var/cache/man2html/manindexh* /var/cache/man2html/whatish-*

        echo "see /usr/share/man2html for configuration options"
        index++ --config-file=/usr/share/man2html/swish++.conf "${pathArrayExist[@]}"
        echo "Done, recommend restarting webserver"

Revision history for this message
orbisvicis (orbisvicis) wrote :

also, in debian/sources/man2html.cgi.c, why dont you change line 441 to:
&& strncmp("MANDB_MAP", line, 9) == 0

that way, all global manpaths are searched instead of only the mandatory ones. Makes it easier to add new paths.

Lastly, line 69 is missing a backlash. Maybe if you add it you get a microseconds speed improvement

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package man2html - 1.6g-5

man2html (1.6g-5) unstable; urgency=low

  * man2html.postinst: Convert the /u/s/d/man2html directory into a symlink
    pointing to man2html-base (closes: #616594).
  * man2html.doc-base: Register html files from man2html-base, not man2html.
  * man2html.cgi.c: Check result of pipe() call.

man2html (1.6g-4) unstable; urgency=low

  * Depends/Suggests lynx-cur instead of lynx transitional package
    (closes: #613129).
  * Add a debian/NEWS file for the recent package split. Include a dummy
    entry there to work-around apt-listchanges bug #590541.

man2html (1.6g-3) unstable; urgency=low

  * Upload to unstable.
  * debian/rules:
    + use dpkg-buildflags for setting CFLAGS;
    + add build-arch and build-indep targets.

man2html (1.6g-2) experimental; urgency=low

  * Split the binary package into two (closes: #285403, LP: #584825):
    + man2html-base with a command-line man to HTML converter only;
    + man2html containing the CGI interface.
  * Remove any dependencies on web-server stuff from the man2html-base
    package, and make man2html package to depend on httpd instead of
    recommending it (closes: #504486).

man2html (1.6g-1) experimental; urgency=low

  * New upstream release.
  * Get the searched/indexed man directories from system manpath file
    (LP: #246816):
    + cron.weekly: use `manpath -g' to find out the system man directories;
    + man2html.cgi.c: take MANDB_MAP entries into account while parsing
    + postinst: call the weekly job to perform initial indexing of man pages;
    + avoid duplicated/symlinked directories in both the weekly script and
      the cgi program.
  * manwhatis.c: add the `-g' option to manpath call.
  * 010-aux-debian.patch (updated): correct paths in example.
  * 033-gcc-warnings.patch (new): fix some gcc warnings.
  * Reformat Debian-specific sources with the `astyle -A1 -SKs4' command.
  * Standards-Version: 3.9.1 (no changes).
  * Bump debhelper compat mode to 8.
 -- Ubuntu Archive Auto-Sync <email address hidden> Sat, 30 Apr 2011 13:16:28 +0000

Changed in man2html (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.