source@mandoc.bsd.lv
 help / color / Atom feed
* mandoc: Do not fail an assertion when a high level macro occurs in the 
@ 2019-12-26 19:52 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2019-12-26 19:52 UTC (permalink / raw)
  To: source

Log Message:
-----------
Do not fail an assertion when a high level macro occurs in the body
of a conditional inside a .ce request block.  Instead, abort the .ce
block just like when there is no conditional in between.

Bug found by espie@ working on the textproc/fstrcmp port.

Modified Files:
--------------
    mandoc:
        roff.c

Revision Data
-------------
Index: roff.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/roff.c,v
retrieving revision 1.367
retrieving revision 1.368
diff -Lroff.c -Lroff.c -u -p -r1.367 -r1.368
--- roff.c
+++ roff.c
@@ -2294,12 +2294,24 @@ roff_cond_sub(ROFF_ARGS)
 		}
 	}
 
+	t = roff_parse(r, buf->buf, &pos, ln, ppos);
+
+	/* For now, let high level macros abort .ce mode. */
+
+	if (roffce_node != NULL &&
+	    (t == TOKEN_NONE || t == ROFF_Dd || t == ROFF_EQ ||
+             t == ROFF_TH || t == ROFF_TS)) {
+		r->man->last = roffce_node;
+		r->man->next = ROFF_NEXT_SIBLING;
+		roffce_lines = 0;
+		roffce_node = NULL;
+	}
+
 	/*
 	 * Fully handle known macros when they are structurally
 	 * required or when the conditional evaluated to true.
 	 */
 
-	t = roff_parse(r, buf->buf, &pos, ln, ppos);
 	if (t == ROFF_break) {
 		if (irc & ROFF_LOOPMASK)
 			irc = ROFF_IGN | ROFF_LOOPEXIT;
--
 To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-26 19:52 mandoc: Do not fail an assertion when a high level macro occurs in the schwarze

source@mandoc.bsd.lv

Archives are clonable: git clone --mirror http://inbox.vuxu.org/mandoc-source

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.mandoc.source


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git