1 http://bugs.gentoo.org/331979
3 patch by William Throwe <wthrowe@mit.edu>
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.
13 --- man-1.6f/src/makewhatis.sh
14 +++ man-1.6f/src/makewhatis.sh
16 find $mandir/${pages}$i/. -name '*' $findarg0 $findarg -print | $AWK '
19 - if (use_zcat || use_bzcat || use_lzcat || use_xzcat) {
20 + if (use_compression) {
21 result = (pipe_cmd | getline);
23 print "Pipe error: " pipe_cmd " " ERRNO > "/dev/stderr";
27 function closeline() {
28 - if (use_zcat || use_bzcat || use_lzcat || use_xzcat) {
29 + if (use_compression) {
30 return close(pipe_cmd);
32 return close(filename);
35 print "adding " filename > "/dev/stderr"
39 use_zcat = match(filename,"\\.Z$") ||
40 match(filename,"\\.z$") || match(filename,"\\.gz$");
43 use_bzcat = match(filename,"\\.bz2");
45 - use_lzcat = match(filename,"\\.lzma");
47 - use_xzcat = match(filename,"\\.xz");
48 - if (use_zcat || use_bzcat || use_lzcat || use_xzcat) {
50 + use_lzcat = match(filename,"\\.lzma");
52 + use_xzcat = match(filename,"\\.xz");
56 + use_compression = (use_zcat || use_bzcat || use_lzcat || use_xzcat);
57 + if (use_compression) {
58 filename_no_gz = substr(filename, 0, RSTART - 1);
60 filename_no_gz = filename;
62 actual_section = section;
64 sub(/\..*/, "", progname);
65 - if (use_zcat || use_bzcat || use_lzcat || use_xzcat) {
66 + if (use_compression) {
68 pipe_cmd = "zcat \"" filename "\"";
69 } else if (use_bzcat) {