Bug 15325

Summary: nroff -man bombs out with more than eight authors *total*
Product: Base System Reporter: Archie Cobbs <archie>
Component: binAssignee: mpp
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 3.1-STABLE   
Hardware: Any   
OS: Any   

Description Archie Cobbs 1999-12-07 00:10:01 UTC
	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.

Fix: 

Unknown.
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>
Comment 1 Mike Pritchard 1999-12-07 11:30:20 UTC
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
Comment 2 Sheldon Hearn freebsd_committer freebsd_triage 1999-12-07 15:23:35 UTC
Responsible Changed
From-To: freebsd-bugs->mpp

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. :-) 

Comment 3 Archie Cobbs 1999-12-07 16:17:48 UTC
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
Comment 4 Bill Fenner 1999-12-10 01:20:09 UTC
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
Comment 5 Bill Fenner 1999-12-10 02:07:20 UTC
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
Comment 6 Bill Fenner 1999-12-10 02:12:14 UTC
>> Fix: use .%A T. \Li
>
>Then it prints OK but the "Li" is missing.

Oops.  Of course I meant \&Li .

  Bill
Comment 7 mpp freebsd_committer freebsd_triage 2000-03-24 00:37:10 UTC
State Changed
From-To: open->closed

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.