tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: Ingo Schwarze <schwarze@usta.de>
To: tech@mdocml.bsd.lv
Subject: Re: TERMP_NOLPAD r.i.p.
Date: Tue, 20 Sep 2011 15:34:35 +0200	[thread overview]
Message-ID: <20110920133435.GD13269@iris.usta.de> (raw)
In-Reply-To: <4E788668.2060502@bsd.lv>

Hi Kristaps,

Kristaps Dzonsons wrote on Tue, Sep 20, 2011 at 02:26:16PM +0200:

> That indeed fixes it!  But another takes its place... The relevant
> file is enclosed.

I have no idea why this pops up only now, but let's fix it
anyway.

The problem is that groff_hdtbl(7) is doing something like

  .de OUCH
  .TP
  .BI
  ..
  .OUCH

tricking the .TP macro and its *next-line* head argument
onto the *same* input line.  So .TP is not allowed to assume
that a head argument being on the same line is indeed a same-line
argument.

I don't see any other similar case in this source file,
and i don't see any regressions.

OK?
  Ingo


P.S.:
Of course, the fix only fixes the segfault.
This raises a more serious question:
In the view of macros, our use of the source line
for semantic purposes is fundamentally broken.
We do that at several places.

P.P.S.:
Mandoc is definitely not the right tool to process groff_hdtbl(7),
but at least it shouldn't segfault.


Index: man_term.c
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/man_term.c,v
retrieving revision 1.74
diff -u -p -r1.74 man_term.c
--- man_term.c	20 Sep 2011 13:13:21 -0000	1.74
+++ man_term.c	20 Sep 2011 13:16:41 -0000
@@ -636,7 +636,7 @@ pre_TP(DECL_ARGS)
 	/* Calculate offset. */
 
 	if (NULL != (nn = n->parent->head->child))
-		if (nn->parent->line == nn->line)
+		if (nn->string && nn->parent->line == nn->line)
 			if ((ival = a2width(p, nn->string)) >= 0)
 				len = (size_t)ival;
 
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

  reply	other threads:[~2011-09-20 13:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20110918161317.GE29692@iris.usta.de>
     [not found] ` <4E765AFE.9070302@bsd.lv>
2011-09-19 21:39   ` Ingo Schwarze
2011-09-19 21:58     ` Kristaps Dzonsons
2011-09-20 11:12       ` Kristaps Dzonsons
2011-09-20 11:14         ` Kristaps Dzonsons
2011-09-20 12:14         ` Ingo Schwarze
2011-09-20 12:26           ` Kristaps Dzonsons
2011-09-20 13:34             ` Ingo Schwarze [this message]
2011-09-20 14:05               ` Kristaps Dzonsons

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110920133435.GD13269@iris.usta.de \
    --to=schwarze@usta.de \
    --cc=tech@mdocml.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).