From archie@whistle.com Mon Dec  6 16:04:50 1999
Return-Path: <archie@whistle.com>
Received: from bubba.whistle.com (bubba.whistle.com [207.76.205.7])
	by hub.freebsd.org (Postfix) with ESMTP id 2575F14BCA
	for <FreeBSD-gnats-submit@freebsd.org>; Mon,  6 Dec 1999 16:04:49 -0800 (PST)
	(envelope-from archie@whistle.com)
Received: (from archie@localhost)
	by bubba.whistle.com (8.9.2/8.9.2) id QAA95307;
	Mon, 6 Dec 1999 16:04:49 -0800 (PST)
Message-Id: <199912070004.QAA95307@bubba.whistle.com>
Date: Mon, 6 Dec 1999 16:04:49 -0800 (PST)
From: Archie Cobbs <archie@whistle.com>
Reply-To: archie@whistle.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: nroff -man bombs out with more than eight authors *total*
X-Send-Pr-Version: 3.2

>Number:         15325
>Category:       bin
>Synopsis:       nroff -man bombs out with more than eight authors *total*
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    mpp
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Dec  6 16:10:01 PST 1999
>Closed-Date:    Thu Mar 23 16:37:10 PST 2000
>Last-Modified:  Thu Mar 23 16:38:43 PST 2000
>Originator:     Archie Cobbs
>Release:        FreeBSD 3.1-STABLE i386
>Organization:
Whistle Communications, Inc.
>Environment:

	Happens in both -current and -stable as of Mon Dec  6 16:01:39 PST 1999

>Description:

	To have a reference to an article, RFC, etc. in a man page
	you're supposed to do this (right?):

	.Rs
	.%A S. Hanks
	.%A T. Li
	.%A D. Farinacci
	.%A P. Traina
	.%T "Generic Routing Encapsulation over IPv4 networks"
	.%O RFC 1702
	.Re

	The bug is that if you 'nroff -man' this and you have more
	than 8 authors total IN ALL REFERENCES then nroff bombs out
	into some kind of infinite loop, even if no single reference
	has 8 authors.

>How-To-Repeat:

	Store this sample man page in a file called 'xx' and
	then run 'nroff -man xx':

	.Dd November 29, 1999
	.Dt NG_PPTPGRE 8
	.Os FreeBSD
	.Sh NAME
	.Nm ng_pptpgre
	.Nd PPP protocol netgraph node type
	.Sh SYNOPSIS
	.Fd #include <netgraph/ng_pptpgre.h>
	.Sh DESCRIPTION
	The
	.Nm pptpgre
	node type performs Generic Routing Encapsulation (GRE) over IP
	for the PPTP protocol as specified by RFC 2637.  This involves packet
	encapsulation, sequencing, acknowlegement, and an adaptive timeout
	sliding window mechanism.  This node type does not handle any of
	the TCP control protocol or call negotiation defined by PPTP.
	.Sh SEE ALSO
	.Xr netgraph 4 ,
	.Xr ng_ksocket 8 ,
	.Xr ng_ppp 8 ,
	.Xr ngctl 8 .
	.Rs
	.%A K. Hamzeh
	.%A G. Pall
	.%A W. Verthein
	.%A J. Taarud
	.%A W. Little
	.%A G. Zorn
	.%T "Point-to-Point Tunneling Protocol (PPTP)"
	.%O RFC 2637
	.Re
	.Rs
	.%A S. Hanks
	.%A T. Li
	.%A D. Farinacci
	.%A P. Traina
	.%T "Generic Routing Encapsulation over IPv4 networks"
	.%O RFC 1702
	.Re
	.Sh AUTHOR
	Archie Cobbs <archie@whistle.com>

>Fix:
	
	Unknown.


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->mpp 
Responsible-Changed-By: sheldonh 
Responsible-Changed-When: Tue Dec 7 07:23:35 PST 1999 
Responsible-Changed-Why:  
Since Mike has all the time on the world in his hands and nothing 
better to do with it than help out with the mdoc package, I'm sure 
he'd love to take a look at this. *duck* :-) 

Mike, is this the same problem we've chatted about with the more 
general argument limit in mdoc? 

By the way, it doesn't "bomb out in some kind of infinite loop": 
if you stick around, it _does_ display the page. :-) 

From: Archie Cobbs <archie@whistle.com>
To: mpp@mppsystems.com (Mike Pritchard)
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/15325: nroff -man bombs out with more than eight authors *total*
Date: Tue, 7 Dec 1999 08:17:48 -0800 (PST)

 Mike Pritchard writes:
 > On Mon, Dec 06, 1999 at 04:04:49PM -0800, Archie Cobbs wrote:
 > > >Synopsis:       nroff -man bombs out with more than eight authors *total*
 > > 
 > > 	Happens in both -current and -stable as of Mon Dec  6 16:01:39 PST 1999
 > > 
 > > >Description:
 > > 
 > > 	To have a reference to an article, RFC, etc. in a man page
 > > 	you're supposed to do this (right?):
 > > 
 > > 	.Rs
 > > 	.%A S. Hanks
 > > 	.%A T. Li
 > > 	.%A D. Farinacci
 > > 	.%A P. Traina
 > > 	.%T "Generic Routing Encapsulation over IPv4 networks"
 > > 	.%O RFC 1702
 > > 	.Re
 > > 
 > > 	The bug is that if you 'nroff -man' this and you have more
 > > 	than 8 authors total IN ALL REFERENCES then nroff bombs out
 > > 	into some kind of infinite loop, even if no single reference
 > > 	has 8 authors.
 > 
 > Sounds like the mdoc 8 macro parameters limit.  The work around probably
 > is to split the information up into 2 .Rs/.Re blocks.
 
 Um, I think you missed the whole point :-)
 
 It doesn't matter how many .Rs.Re blocks you split things up into,
 it still barfs if you have more than eight authors *total* over
 all blocks.
 
 So, somewhere some counter is not getting reset to zero when .Re
 is seen (or something like that).  I tried looking at the code but
 it was indecipherable.
 
 Plus, the failure mode is an infinite loop of stuff printed to the
 console, which is a separate bug in and of itself..
 
 > The 8 arg limit is something I want to try and increase, but I've had about
 > 0 time for anything the past couple of months.  I hope to get a chunk
 > of time off from work later this month through mid Jan (during our slow
 > time), so hopefully I can address this, along with a zillion other things
 > that are sitting on my plate right now.
 
 That would be great.. eight seems like a pretty arbitrary number.
 
 Thanks for responding to the bug report.
 
 Cheers,
 -Archie
 
 ___________________________________________________________________________
 Archie Cobbs   *   Whistle Communications, Inc.  *   http://www.whistle.com
 

From: Mike Pritchard <mpp@mppsystems.com>
To: Archie Cobbs <archie@whistle.com>
Cc: FreeBSD-gnats-submit@freebsd.org
Subject: Re: bin/15325: nroff -man bombs out with more than eight authors *total*
Date: Tue, 7 Dec 1999 05:30:20 -0600

 On Mon, Dec 06, 1999 at 04:04:49PM -0800, Archie Cobbs wrote:
 > >Synopsis:       nroff -man bombs out with more than eight authors *total*
 > 
 > 	Happens in both -current and -stable as of Mon Dec  6 16:01:39 PST 1999
 > 
 > >Description:
 > 
 > 	To have a reference to an article, RFC, etc. in a man page
 > 	you're supposed to do this (right?):
 > 
 > 	.Rs
 > 	.%A S. Hanks
 > 	.%A T. Li
 > 	.%A D. Farinacci
 > 	.%A P. Traina
 > 	.%T "Generic Routing Encapsulation over IPv4 networks"
 > 	.%O RFC 1702
 > 	.Re
 > 
 > 	The bug is that if you 'nroff -man' this and you have more
 > 	than 8 authors total IN ALL REFERENCES then nroff bombs out
 > 	into some kind of infinite loop, even if no single reference
 > 	has 8 authors.
 
 Sounds like the mdoc 8 macro parameters limit.  The work around probably
 is to split the information up into 2 .Rs/.Re blocks.
 
 The 8 arg limit is something I want to try and increase, but I've had about
 0 time for anything the past couple of months.  I hope to get a chunk
 of time off from work later this month through mid Jan (during our slow
 time), so hopefully I can address this, along with a zillion other things
 that are sitting on my plate right now.
 
 -Mike
 -- 
 Mike Pritchard
 mpp@FreeBSD.org or mpp@mppsystems.com
 

From: Bill Fenner <fenner@research.att.com>
To: archie@whistle.com
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: bin/15325: nroff -man bombs out with more than eight authors *total*
Date: Thu, 9 Dec 1999 17:20:09 -0800

 I think the actual problem is simply T. Li.  Poor Tony's last name is Li,
 and %A parses its args, and Li is a parsed "literal text", and calling
 Li from %A fails for some reason I haven't figured out.
 
 Hint for debugging: use ".Db on" and nroff -mdoc.
 
 DEBUG(argv) MACRO: `.%A'  Line #: 36
 Argc: 1  Argv: `T.'  Length: 2
 Space: `\& \&'  Class: String
 Argc: 2  Argv: `Li'  Length: 2
 Space: `'  Class: Executable
 ------------------^^^^^^^^^^
 MACRO REQUEST: .%A T. Li       
 Usage: %A - maximum 8 arguments (#36)
 Usage: Too many arguments (maximum of 8 accepted) (#36)
 T. Li rR rR rR rR rR rR rR
 
 
 Diagnosis: user error (man page states that %A is parsed)
 
 Fix: use .%A T. \Li
 
 Alternate fix: change mdoc not to parse the % stuff since the man page
 even says it's not very predictable.
 
   Bill
 

From: Bill Fenner <fenner@research.att.com>
To: archie@whistle.com
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: bin/15325: nroff -man bombs out with more than eight authors *total*
Date: Thu, 9 Dec 1999 18:07:20 -0800

 BTW, I don't really have any clue what the big picture is, but the
 misleading "Usage: %A - maximum 8 arguments" error message is coming
 from infinite recursion in .rR .  A hack to prevent rR from recursing
 infinitely is:
 
 diff -u /usr/obj/usr/src/tmp/usr/share/tmac/tmac.doc ..
 --- /usr/obj/usr/src/tmp/usr/share/tmac/tmac.doc	Wed Dec	 8 23:49:34 1999
 +++ ../tmac.doc Thu Dec	 9 17:59:43 1999
 @@ -2962,8 +2962,11 @@
  .	\}
  .	el \{\
  .		if \\n(aC>8 .tm Usage: \\*(mN - maximum 8 arguments (#\\n(.c)
 -.		aI rR 1
 -.		\\*(A\\n(aP
 +.		ie "\\*(A\\n(aP"rR" .tm ERROR: rR recursion (#\\n(.c)
 +.		el \{
 +.			aI rR 1
 +.			\\*(A\\n(aP
 +.		\}
  .	\}
  .\}
  .el \{\
 
 This at least eliminates the loop and gives an error message, but
 it's not really the error message you want.
 
 Is there a project to document mdoc's internals (i.e. I'd really like to
 read a comment on how rR is *supposed* to work)?
 
   Bill
 

From: Bill Fenner <fenner@research.att.com>
To: archie@whistle.com
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: bin/15325: nroff -man bombs out with more than eight authors *total*
Date: Thu, 9 Dec 1999 18:12:14 -0800

 >> Fix: use .%A T. \Li
 >
 >Then it prints OK but the "Li" is missing.
 
 Oops.  Of course I meant \&Li .
 
   Bill
 
State-Changed-From-To: open->closed 
State-Changed-By: mpp 
State-Changed-When: Thu Mar 23 16:37:10 PST 2000 
State-Changed-Why:  
The real problem here was the fact that one of the authors names 
was the same as an mdoc macro (Li).  This was the cause of the 
problem. 
>Unformatted:
