discuss@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mandoc assert()s on .Os \&
@ 2010-10-27 12:57 Joachim Schipper
  2010-10-27 19:28 ` Ingo Schwarze
  0 siblings, 1 reply; 2+ messages in thread
From: Joachim Schipper @ 2010-10-27 12:57 UTC (permalink / raw)
  To: discuss

Hi,

Consider the following document:

.Dd Oct 27, 2010
.Dt SOMETHING 1 LOCAL
.Os \&
.Sh NAME
.Nm something
.Nd does something

The interesting part is the '.Os \&', intended to remove the OS from the
footer. I got that snippet from some random place on the net; I *think*
it's legal, and groff renders it fine. mandoc, however, fails:

assertion "p->rmargin > p->offset" failed: file
"/usr/src/usr.bin/mandoc/term.c", line 145, function "term_flushln"

Thanks for your hard work! And feel free to fix this whenever/not at
all...

		Joachim
--
 To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: mandoc assert()s on .Os \&
  2010-10-27 12:57 mandoc assert()s on .Os \& Joachim Schipper
@ 2010-10-27 19:28 ` Ingo Schwarze
  0 siblings, 0 replies; 2+ messages in thread
From: Ingo Schwarze @ 2010-10-27 19:28 UTC (permalink / raw)
  To: Joachim Schipper; +Cc: discuss

Hi Joachim,

Joachim Schipper wrote on Wed, Oct 27, 2010 at 02:57:27PM +0200:

> .Dd Oct 27, 2010
> .Dt SOMETHING 1 LOCAL
> .Os \&
[...]
> I *think* it's legal,

And you are right.  Try

  mandoc -Tlint
  mandoc -Ttree

on it.  The parser is perfectly happy with that code.

When the parsing backend is happy and the rendering frontend fails,
that's never right.  And when anything crashes, even less so.

> assertion "p->rmargin > p->offset" failed: file
> "/usr/src/usr.bin/mandoc/term.c", line 145, function "term_flushln"

Wow.  Impressing.
That's the oldest mandoc bug i can remember being found.
This particular off-by-one was committed in term.c rev. 1.3,
on Sat Feb 21 14:56:58 2009 UTC (20 months ago).

That's before i became an OpenBSD developer.
At that time, i had no idea i would ever work on mandoc.
The file term.c, and in particular the function term_flushln(),
is probably the one i have changed most, to the point that
Kristaps has grown afraid of touching it.

It seems like i have always taken special care to preserve that
particular bug, all the way through several major reorganizations.

Thanks for reporting, i have fixed it in OpenBSD right away.

OK to commit to bsd.lv, too?

Yours,
  Ingo


Index: term.c
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/term.c,v
retrieving revision 1.53
diff -u -p -r1.53 term.c
--- term.c	2 Oct 2010 15:11:54 -0000	1.53
+++ term.c	27 Oct 2010 19:17:14 -0000
@@ -142,7 +142,7 @@ term_flushln(struct termp *p)
 	 * an indentation, but can be, for tagged lists or columns, a
 	 * small set of values. 
 	 */
-	assert  (p->rmargin > p->offset);
+	assert  (p->rmargin >= p->offset);
 	dv     = p->rmargin - p->offset;
 	maxvis = (int)dv > p->overstep ? dv - (size_t)p->overstep : 0;
 	dv     = p->maxrmargin - p->offset;

--
 To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-10-27 19:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-27 12:57 mandoc assert()s on .Os \& Joachim Schipper
2010-10-27 19:28 ` Ingo Schwarze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).