bin/115850: man can't handle compressed included files.
Callum Gibson
callum at omma.gibson.athome
Sun Aug 26 23:00:06 PDT 2007
>Number: 115850
>Category: bin
>Synopsis: man can't handle compressed included files.
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Mon Aug 27 06:00:06 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator: Callum Gibson
>Release: FreeBSD 6.2-STABLE i386
>Organization:
>Environment:
System: FreeBSD omma 6.2-STABLE FreeBSD 6.2-STABLE #4: Wed Aug 22 14:52:20 EST 2007 root at omma:/usr/obj/usr/src/sys/OMMA i386
>Description:
Some ports will install with compressed manpages. man handles this by
looking for the .gz version of a man source file. It is also common to
include other files with the .so directive where commands or functions
share a man page. Traditionally ports have had to handle this by either
not compressing the manpages, or using the _MLINKS macro in the port
makefile to create symlinks to the actual source file, rather than using
.so versions. Notably, the current version of Xorg port breaks. See
ports/113096 and ports/115845.
>How-To-Repeat:
In any current FreeBSD system with Xorg 7.2, try to call up a manpage which
includes another. eg. man XMoveWindow (which includes
>Fix:
The attached patch extends the existing functionality of man's compressed
file handling by allowing the processing of both .so directives which
include a compressed file and testing for the compressed version of a file
included with a .so directive so that it may be processed.
The patch should be applied to /usr/src/gnu/usr.bin/man/man/man.c
--- man.c.orig 2003-10-26 17:40:37.000000000 +1100
+++ man.c 2007-08-27 12:01:30.000000000 +1000
@@ -866,11 +866,26 @@
next:
+#if HAVE_LIBZ > 0
+ if ((fp = gzopen (ult, "r")) == NULL)
+ {
+ /* check for the compressed version too */
+ strlcat(ult, ".gz", FILENAME_MAX);
+ if ((fp = gzopen (ult, "r")) == NULL)
+ return ult; /* we munged it, but it doesn't exist anyway */
+ }
+#else
if ((fp = fopen (ult, "r")) == NULL)
return ult;
+#endif
+#if HAVE_LIBZ > 0
+ gzgets (fp, buf, BUFSIZ);
+ gzclose(fp);
+#else
end = fgets (buf, BUFSIZ, fp);
fclose(fp);
+#endif
if (!end || strlen (buf) < 5)
return ult;
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list