bin/52213: catman compresses with wrong program if source files are uncompressed

Krister Joas krister at gazonk.net
Wed May 14 03:50:20 PDT 2003


>Number:         52213
>Category:       bin
>Synopsis:       catman compresses with wrong program if source files are uncompressed
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed May 14 03:50:16 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Krister Joas
>Release:        FreeBSD 5.1-BETA i386
>Organization:
Gazonk
>Environment:
System: FreeBSD yuri.local.gazonk.net 5.1-BETA FreeBSD 5.1-BETA #1: Sun May 11 23:38:06 JST 2003 root at yuri.local.gazonk.net:/usr/obj/usr/src/sys/YURI5 i386


>Description:

If the system is installed with NOMANCOMPRESS=true in /etc/make.conf
so that man pages are installed uncompressed, running catman results
in unusable preformated files in the corresponding cat? directories.
The files are compressed with bzip2 but with the extension .gz.
When running 'man' the files fail to uncompress.

>How-To-Repeat:

Run catman on a directory with uncompressed man-pages.  The files
in the cat? directories are bzip2'ed with extension .gz:

	$ file cat1/write.1.gz
	cat1/write.1.gz: bzip2 compressed data, block size = 900k
	$ man write
	zcat: /home/krister/man/cat1/write.1.gz: not in gzip format

>Fix:

The following patch fixes catman so that if the source file is
compressed the preformatted files are compressed with the same
program as the source and if the source files are uncompressed the
preformatted files are also uncompressed.

Index: catman.c
===================================================================
RCS file: /usr/cvs/freebsd/src/usr.bin/catman/catman.c,v
retrieving revision 1.5
diff -u -r1.5 catman.c
--- catman.c	29 Oct 2002 09:20:22 -0000	1.5
+++ catman.c	14 May 2003 10:06:09 -0000
@@ -461,9 +461,11 @@
 	}
 	snprintf(tmp_file, sizeof tmp_file, "%s.tmp", cat);
 	snprintf(cmd, sizeof cmd,
-	    "%scat %s | tbl | nroff -T%s -man | col | %s -c > %s.tmp",
+	    "%scat %s | tbl | nroff -T%s -man | col | %s > %s.tmp",
 	    zipped == BZIP ? BZ2CAT_CMD : zipped == GZIP ? GZCAT_CMD : "",
-	    src, nroff_device, zipped == GZIP ? GZ_CMD : BZ2_CMD, cat);
+	    src, nroff_device,
+	    zipped == BZIP ? BZ2_CMD : zipped == GZIP ? GZ_CMD : "cat",
+	    cat);
 	if (system(cmd) != 0)
 		err(1, "formatting pipeline");
 	if (rename(tmp_file, cat) < 0)
@@ -541,8 +543,8 @@
 						"warning, %s is uncompressed\n",
 						page_path);
 				}
-				snprintf(cat_path, sizeof cat_path, "%s/%s%s",
-				    cat_section, page_name, GZ_EXT);
+				snprintf(cat_path, sizeof cat_path, "%s/%s",
+				    cat_section, page_name);
 				if (expected != NULL) {
 					asprintf(&expected[nexpected++],
 					    "%s%s", page_name, GZ_EXT);
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list