rpms/man/devel man-1.6f-dashes.patch, NONE, 1.1 man-1.6f-i18n_makewhatis.patch, NONE, 1.1 man-1.6f-pipe_makewhatis.patch, NONE, 1.1

Jiří Moskovčák (jmoskovc) fedora-extras-commits at redhat.com
Thu Mar 20 09:50:17 UTC 2008


Author: jmoskovc

Update of /cvs/extras/rpms/man/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv18573

Added Files:
	man-1.6f-dashes.patch man-1.6f-i18n_makewhatis.patch 
	man-1.6f-pipe_makewhatis.patch 
Log Message:
Uploaded patches


man-1.6f-dashes.patch:

--- NEW FILE man-1.6f-dashes.patch ---
--- man-1.6d/src/makewhatis.sh.dash	2006-10-24 08:56:44.000000000 +0200
+++ man-1.6d/src/makewhatis.sh	2006-10-24 09:52:24.000000000 +0200
@@ -353,7 +353,7 @@
 	      sub(/ $/, "", x);               # Kill trailing spaces (again)          
 	      sub(/\.$/, "", x);              # Kill trailing period
 
-	      if (!match(x, / - /))
+      if (!match(x, / --? /))
		return;
 
 	      after_dash = substr(x, RSTART);

man-1.6f-i18n_makewhatis.patch:

--- NEW FILE man-1.6f-i18n_makewhatis.patch ---
--- man-1.6e/src/makewhatis.sh.i18n	2006-07-19 06:58:08.000000000 +0200
+++ man-1.6e/src/makewhatis.sh	2006-12-11 14:50:46.000000000 +0100
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 # makewhatis: create the whatis database
 # Created: Sun Jun 14 10:49:37 1992
 # Revised: Sat Jan  8 14:12:37 1994 by faith at cs.unc.edu
@@ -61,32 +61,19 @@
 done
 DEFCATPATH=$dc
 
-# In case /usr is read-only, make /usr/foo/whatis (etc) a symlink to
-# something like /var/cache/man/foo-whatis.
-# Some distributions make a single big /var/cache/man/whatis file,
-# but that leads to problems and bugs.
+# make a single big /var/cache/man/whatis file,
+DEFWHATIS=/var/cache/man/whatis
 
-# AWK=/usr/bin/gawk
 AWK=@awk@
 
-# Find a place for our temporary files. If security is not a concern, use
-#	TMPFILE=/tmp/whatis$$; TMPFILEDIR=none
-# Of course makewhatis should only have the required permissions
-# (for reading and writing directories like /usr/man).
-# We try here to be careful (and avoid preconstructed symlinks)
-# in case makewhatis is run as root, by creating a subdirectory of /tmp.
-
-TMPFILEDIR=/tmp/whatis.tmp.dir.$$
-rm -rf $TMPFILEDIR
-if ! mkdir -m 0700 $TMPFILEDIR; then
-    echo Could not create $TMPFILEDIR
-    exit 1;
-fi
-TMPFILE=$TMPFILEDIR/w
+# Find a place for our temporary files.
+
+if TMPFILE=$(mktemp /tmp/whatis.XXXXXX)
+then
 
-# make sure TMPFILEDIR is deleted if program is killed or terminates
+# make sure TMPFILE is deleted if program is killed or terminates
 # (just delete this line if your shell doesnt know about trap)
-trap "rm -rf $TMPFILEDIR" 0
+trap "rm -rf $TMPFILE" 0 
 trap "rm -rf $TMPFILEDIR; exit 255" 1 2 3 15
 
 # default find arg: no directories, no empty files
@@ -98,15 +85,17 @@
 defcatpath=
 
 if [ -n "$MANSECT" ]; then
-	sections=$MANSECT
+        sections=$MANSECT
 else
-	sections=`$AWK '($1 == "MANSECT") { print $2 }' @man_config_file@`
-	if [ x"$sections" = x ]; then
-		sections="@sections@"
-	fi
+        sections=`$AWK '($1 == "MANSECT") { print $2 }' @man_config_file@`
+        if [ x"$sections" = x ]; then
+                sections="@sections@"
+        fi
 fi
 sections=`echo $sections | sed -e 's/:/ /g'`
 
+whatisdb=$DEFWHATIS
+
 for name in "$@"
 do
 if [ -n "$setsections" ]; then
@@ -114,6 +103,11 @@
 	sections=$name
 	continue
 fi
+if [ -n "$setwhatis" ]; then
+       setwhatis=
+       whatisdb=$name
+       continue
+fi
 case $name in
     --version|-V)
 	echo "$program from @version@"
@@ -124,6 +118,8 @@
 	continue;;
     -s) setsections=1
 	continue;;
+    -o) setwhatis=1
+        continue;;
     -u) findarg="-ctime 0"
 	update=1
 	continue;;
@@ -132,12 +128,13 @@
     -w) manpath=`man --path`
 	catpath=$manpath
 	continue;;
-    -*) echo "Usage: makewhatis [-s sections] [-u] [-v] [-w] [manpath] [-c [catpath]]"
+    -*) echo "Usage: makewhatis [-s sections] [-u] [-v] [-w] [manpath] [-c [catpath]] [-o whatisdb]"
 	echo "       This will build the whatis database for the man pages"
 	echo "       found in manpath and the cat pages found in catpath."
         echo "       -s: sections (default: $sections)"
 	echo "       -u: update database with new pages"
 	echo "       -v: verbose"
+        echo "       -o: location of whatis database (default: $DEFWHATIS)"
 	echo "       -w: use manpath obtained from \`man --path\`"
 	echo "       [manpath]: man directories (default: $DEFMANPATH)"
 	echo "       [catpath]: cat directories (default: the first existing"
@@ -165,14 +162,7 @@
 # first truncate all the whatis files that will be created new,
 # then only update - we might visit the same directory twice
 if [ x$update = x ]; then
-   for pages in man cat
-   do
-      eval path="\$$pages"path
-      for mandir in $path
-      do
-	 cp /dev/null $mandir/whatis
-      done
-   done
+   cp /dev/null $whatisdb
 fi
 
 for pages in man cat
@@ -184,11 +174,6 @@
	fi
     fi

-     if [ -s ${mandir}/whatis -a $pages = man -a x$update = x ]; then
-	if [ x$verbose != x ]; then
-	   echo skipping $mandir - we did it already > /dev/stderr
-	fi
-     else      
        here=`pwd`
        cd $mandir
        for i in $sections--- man-1.6f/src/makewhatis.sh	2008-03-14 14:23:27.000000000 +0100
@@ -212,7 +212,23 @@
 	    section=$i
 	    curdir=$mandir/${pages}$i
 	    export section verbose curdir
-	    find $mandir/${pages}$i/. -name '*' $findarg0 $findarg -print | $AWK '
+
+	   utf8=
+            for x in $(find $mandir/${pages}$i -name '*' $findarg0 $findarg)
+            do
+               if [ ${x%.gz} != ${x} ]
+               then
+                  cat=zcat
+               elif [ ${x%.bz2} != ${x} ]
+               then
+                  cat=bzcat
+               else
+                  cat=cat
+               fi
+   
+               if ${cat} ${x} | iconv -f utf-8 -t utf-8 -o /dev/null 2>/dev/null
+               then
+                  echo ${x} | $AWK '
 
 	    function readline() {
               if (use_zcat || use_bzcat || use_lzcat) {
@@ -424,18 +440,19 @@
 
        cd "$here"
 
-       if [ -f ${mandir1}/whatis ]
+       if [ -f ${whatisdb} ]
        then
-	 cat ${mandir1}/whatis >> $TMPFILE
+         cat ${whatisdb} >> $TMPFILE
        fi
-       tr -s '\n' < $TMPFILE | sort -u > ${mandir1}/whatis
+       tr -s '\n' < $TMPFILE | sort -u > ${whatisdb}
 
-       chmod 644 ${mandir1}/whatis
-       rm $TMPFILE
-     fi
+       chmod 644 ${whatisdb}
    done
 done
 
 # remove tempdir
-rm -rf $TMPFILEDIR
+rm -rf $TMPFILE
 
+else            # we're here if TMPFILE creation failed
+    exit 1
+fi

man-1.6f-pipe_makewhatis.patch:

--- NEW FILE man-1.6f-pipe_makewhatis.patch ---
--- man-1.6f/src/makewhatis.sh	2007-09-17 20:35:14.000000000 +0200
+++ man-1.6f/src/makewhatis.sh_pipe	2008-03-12 17:53:34.000000000 +0100
@@ -281,11 +281,11 @@
 	      sub(/\..*/, "", progname);
               if (use_zcat || use_bzcat || use_lzcat) {
 		if (use_zcat) {
-		  pipe_cmd = "zcat \"" filename "\"";
+		  pipe_cmd = "zcat \"" filename "\" 2>/dev/null";
                 } else if (use_bzcat) {
-		  pipe_cmd = "bzcat \"" filename "\"";
+		  pipe_cmd = "bzcat \"" filename "\" 2>/dev/null";
                 } else {
-                  pipe_cmd = "lzcat \"" filename "\"";
+                  pipe_cmd = "lzcat \"" filename "\" 2>/dev/null";
                 }
 		# try to avoid suspicious stuff
 		if (filename ~ /[;&|`$(]/) {




More information about the fedora-extras-commits mailing list