]> git.draconx.ca Git - gentoo-fixes.git/blob - sys-apps/man/files/man-1.6f-makewhatis-compression-cleanup.patch
sys-apps/man: Fix borken Gentoo man-1.6g-echo-escape.patch
[gentoo-fixes.git] / sys-apps / man / files / man-1.6f-makewhatis-compression-cleanup.patch
1 http://bugs.gentoo.org/331979
2
3 patch by William Throwe <wthrowe@mit.edu>
4
5 The problem is that a failed match() resets the RSTART variable used to
6 extract filename_no_gz (visible in the trailing context of the patch),
7 so it is important that no more match() commands are attempted after the
8 successful one.  Without the scoping, if (for example) the test for .bz2
9 succeeds, it prevents testing for .lzma, but doesn't prevent testing for
10 .xz.  The failing .xz test causes RSTART to be set to zero so
11 filename_no_gz becomes the empty string.
12
13 --- man-1.6f/src/makewhatis.sh
14 +++ man-1.6f/src/makewhatis.sh
15 @@ -234,7 +234,7 @@
16             find $mandir/${pages}$i/. -name '*' $findarg0 $findarg -print | $AWK '
17  
18             function readline() {
19 -              if (use_zcat || use_bzcat || use_lzcat || use_xzcat) {
20 +             if (use_compression) {
21                 result = (pipe_cmd | getline);
22                 if (result < 0) {
23                   print "Pipe error: " pipe_cmd " " ERRNO > "/dev/stderr";
24 @@ -249,7 +249,7 @@
25             }
26             
27             function closeline() {
28 -              if (use_zcat || use_bzcat || use_lzcat || use_xzcat) {
29 +             if (use_compression) {
30                 return close(pipe_cmd);
31               } else {
32                 return close(filename);
33 @@ -263,16 +263,20 @@
34               if (verbose) {
35                 print "adding " filename > "/dev/stderr"
36               }
37 -             
38 +
39               use_zcat = match(filename,"\\.Z$") ||
40                          match(filename,"\\.z$") || match(filename,"\\.gz$");
41 -             if (!use_zcat)
42 +             if (!use_zcat) {
43                 use_bzcat = match(filename,"\\.bz2");
44 -              if(!use_bzcat)
45 -                use_lzcat = match(filename,"\\.lzma");
46 -              if(!use_lzcat)
47 -                use_xzcat = match(filename,"\\.xz");
48 -              if (use_zcat || use_bzcat || use_lzcat || use_xzcat) {
49 +               if (!use_bzcat) {
50 +                 use_lzcat = match(filename,"\\.lzma");
51 +                 if (!use_lzcat) {
52 +                   use_xzcat = match(filename,"\\.xz");
53 +                 }
54 +               }
55 +             }
56 +             use_compression = (use_zcat || use_bzcat || use_lzcat || use_xzcat);
57 +             if (use_compression) {
58                 filename_no_gz = substr(filename, 0, RSTART - 1);
59               } else {
60                 filename_no_gz = filename;
61 @@ -285,7 +289,7 @@
62                 actual_section = section;
63               }
64               sub(/\..*/, "", progname);
65 -              if (use_zcat || use_bzcat || use_lzcat || use_xzcat) {
66 +             if (use_compression) {
67                 if (use_zcat) {
68                   pipe_cmd = "zcat \"" filename "\"";
69                  } else if (use_bzcat) {