From owner-freebsd-bugs@FreeBSD.ORG Mon Aug 27 06:00:06 2007 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3FB216A420 for ; Mon, 27 Aug 2007 06:00:06 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id AD25913C468 for ; Mon, 27 Aug 2007 06:00:06 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.1/8.14.1) with ESMTP id l7R606Ge001925 for ; Mon, 27 Aug 2007 06:00:06 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.1/8.14.1/Submit) id l7R60648001924; Mon, 27 Aug 2007 06:00:06 GMT (envelope-from gnats) Resent-Date: Mon, 27 Aug 2007 06:00:06 GMT Resent-Message-Id: <200708270600.l7R60648001924@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Callum Gibson Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4607116A419 for ; Mon, 27 Aug 2007 05:54:21 +0000 (UTC) (envelope-from callumgibson@optusnet.com.au) Received: from fallbackmx03.syd.optusnet.com.au (fallbackmx03.syd.optusnet.com.au [211.29.133.136]) by mx1.freebsd.org (Postfix) with ESMTP id A9DCD13C474 for ; Mon, 27 Aug 2007 05:54:20 +0000 (UTC) (envelope-from callumgibson@optusnet.com.au) Received: from mail03.syd.optusnet.com.au (mail03.syd.optusnet.com.au [211.29.132.184]) by fallbackmx03.syd.optusnet.com.au (8.12.11.20060308/8.12.11) with ESMTP id l7R2MkJe017560 for ; Mon, 27 Aug 2007 12:22:46 +1000 Received: from omma.gibson.athome (c220-239-41-70.rivrw7.nsw.optusnet.com.au [220.239.41.70]) by mail03.syd.optusnet.com.au (8.13.1/8.13.1) with SMTP id l7R2MT9i001780 for ; Mon, 27 Aug 2007 12:22:44 +1000 Received: (qmail 44420 invoked by uid 107); 27 Aug 2007 12:22:29 +1000 Message-Id: <20070827022229.44419.qmail@omma.gibson.athome> Date: 27 Aug 2007 12:22:29 +1000 From: Callum Gibson To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: bin/115850: man can't handle compressed included files. X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Callum Gibson List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Aug 2007 06:00:06 -0000 >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@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: