From callumgibson@optusnet.com.au  Mon Aug 27 05:54:21 2007
Return-Path: <callumgibson@optusnet.com.au>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4607116A419
	for <FreeBSD-gnats-submit@freebsd.org>; 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 <FreeBSD-gnats-submit@freebsd.org>; 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 <FreeBSD-gnats-submit@freebsd.org>; 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 <FreeBSD-gnats-submit@freebsd.org>; 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: callumgibson@optusnet.com.au
Reply-To: callumgibson@optusnet.com.au
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: man can't handle compressed included files.
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         115850
>Category:       bin
>Synopsis:       man(1) can't handle compressed included files.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    edwin
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Aug 27 06:00:06 GMT 2007
>Closed-Date:    Fri Sep 28 02:32:14 GMT 2007
>Last-Modified:  Fri Sep 28 02:40:07 GMT 2007
>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:
Responsible-Changed-From-To: freebsd-bugs->ru 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Mon Aug 27 06:07:23 UTC 2007 
Responsible-Changed-Why:  
ru@ was the last one to touch src/gnu/usr.bin/man/man/. 

Dear Ruslan, 

Could you please see if you can apply (or approve) this patch? 

Edwin 

http://www.freebsd.org/cgi/query-pr.cgi?pr=115850 

From: Edwin Groothuis <edwin@mavetju.org>
To: FreeBSD Gnats Submit <freebsd-gnats-submit@freebsd.org>
Cc:  
Subject: Re: bin/115850: man can't handle compressed included files.
Date: Mon, 27 Aug 2007 16:13:59 +1000

 On Mon, Aug 27, 2007 at 12:22:29PM +1000, Callum Gibson wrote:
 > >Synopsis:       man can't handle compressed included files.
 
 Related PRs:
 
 bin/115850  : man(1) can't handle compressed included files.
 ports/113096: [patch] x11/xorg - X.org manpages broken
 ports/115845: x11/libX11 - XMoveWindow.3 is messed up on xorg 7.2
 
 Edwin
 -- 
 Edwin Groothuis      |            Personal website: http://www.mavetju.org
 edwin@mavetju.org    |              Weblog: http://www.mavetju.org/weblog/
Responsible-Changed-From-To: ru->freebsd-bugs 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Fri Sep 14 04:32:47 UTC 2007 
Responsible-Changed-Why:  
No answer from ru@ 

http://www.freebsd.org/cgi/query-pr.cgi?pr=115850 
State-Changed-From-To: open->analyzed 
State-Changed-By: edwin 
State-Changed-When: Fri Sep 14 04:33:35 UTC 2007 
State-Changed-Why:  
I've tested this one. 


Responsible-Changed-From-To: freebsd-bugs->edwin 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Fri Sep 14 04:33:35 UTC 2007 
Responsible-Changed-Why:  
Handle with mentor. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=115850 

From: Ruslan Ermilov <ru@FreeBSD.org>
To: edwin@FreeBSD.org
Cc:  
Subject: Re: bin/115850: man(1) can't handle compressed included files.
Date: Fri, 14 Sep 2007 10:07:52 +0400

 On Fri, Sep 14, 2007 at 04:33:22AM +0000, edwin@FreeBSD.org wrote:
 > Synopsis: man(1) can't handle compressed included files.
 > 
 > Responsible-Changed-From-To: ru->freebsd-bugs
 > Responsible-Changed-By: edwin
 > Responsible-Changed-When: Fri Sep 14 04:32:47 UTC 2007
 > Responsible-Changed-Why: 
 > No answer from ru@
 > 
 If it works, go ahead and commit it.
 
 
 Cheers,
 -- 
 Ruslan Ermilov
 ru@FreeBSD.org
 FreeBSD committer
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/115850: commit references a PR
Date: Thu, 20 Sep 2007 21:37:40 +0000 (UTC)

 edwin       2007-09-20 21:37:29 UTC
 
   FreeBSD src repository
 
   Modified files:
     gnu/usr.bin/man/man  man.c 
   Log:
   man(1) can't handle compressed included files.
   
           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.
   
   PR:             bin/115850
   Submitted by:   Callum Gibson <callumgibson@optusnet.com.au>
   Approved by:    re@ (ken smith), grog@ (mentor)
   MFC after:      1 week
   
   Revision  Changes    Path
   1.64      +15 -0     src/gnu/usr.bin/man/man/man.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: analyzed->patched 
State-Changed-By: edwin 
State-Changed-When: Thu Sep 20 21:47:10 UTC 2007 
State-Changed-Why:  
Commited to HEAD 

http://www.freebsd.org/cgi/query-pr.cgi?pr=115850 
State-Changed-From-To: patched->closed 
State-Changed-By: edwin 
State-Changed-When: Fri Sep 28 02:32:07 UTC 2007 
State-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=115850 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/115850: commit references a PR
Date: Fri, 28 Sep 2007 02:31:38 +0000 (UTC)

 edwin       2007-09-28 02:31:30 UTC
 
   FreeBSD src repository
 
   Modified files:        (Branch: RELENG_5)
     gnu/usr.bin/man/man  man.c 
   Log:
   MFC: Fix man(1) to allow .so to reference a compressed file
   
           Original PR description:
   
           man(1) can't handle compressed included files.
   
           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.
   
   PR:             bin/115850
   Submitted by:   Callum Gibson <callumgibson@optusnet.com.au>
   
   Revision  Changes    Path
   1.62.4.1  +15 -0     src/gnu/usr.bin/man/man/man.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/115850: commit references a PR
Date: Fri, 28 Sep 2007 02:32:04 +0000 (UTC)

 edwin       2007-09-28 02:31:57 UTC
 
   FreeBSD src repository
 
   Modified files:        (Branch: RELENG_6)
     gnu/usr.bin/man/man  man.c 
   Log:
   MFC: Fix man(1) to allow .so to reference a compressed file
   
           Original PR description:
   
           man(1) can't handle compressed included files.
   
           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.
   
   PR:             bin/115850
   Submitted by:   Callum Gibson <callumgibson@optusnet.com.au>
   
   Revision   Changes    Path
   1.62.10.1  +15 -0     src/gnu/usr.bin/man/man/man.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
>Unformatted:
