From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from krisdoz.my.domain (kristaps@localhost [127.0.0.1]) by krisdoz.my.domain (8.14.3/8.14.3) with ESMTP id oB6DPQj2025146 for ; Mon, 6 Dec 2010 08:25:26 -0500 (EST) Received: (from kristaps@localhost) by krisdoz.my.domain (8.14.3/8.14.3/Submit) id oB6DPP9M000090; Mon, 6 Dec 2010 08:25:25 -0500 (EST) Date: Mon, 6 Dec 2010 08:25:25 -0500 (EST) Message-Id: <201012061325.oB6DPP9M000090@krisdoz.my.domain> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: kristaps@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: Track down a bug of empty `de XX' macros causing uncertain X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- Track down a bug of empty `de XX' macros causing uncertain behaviour by returning empty strings in roff_getstrn() instead of NULL. This caused maddeningly irregular segfaults in the pod2man preamble for `de IX'. But only on DEC alpha. Also integrate the kinda-probably-safe assertion relaxation in term.c, field-tested by schwarze@. This allows ALL [unpreprocessed] base and xenocara manuals for all BSD systems to run without segfault. Modified Files: -------------- mdocml: roff.c term.c Revision Data ------------- Index: term.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/term.c,v retrieving revision 1.174 retrieving revision 1.175 diff -Lterm.c -Lterm.c -u -p -r1.174 -r1.175 --- term.c +++ term.c @@ -146,7 +146,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; Index: roff.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/roff.c,v retrieving revision 1.106 retrieving revision 1.107 diff -Lroff.c -Lroff.c -u -p -r1.106 -r1.107 --- roff.c +++ roff.c @@ -463,8 +463,10 @@ roff_parseln(struct roff *r, int ln, cha if (ROFF_MAX == (t = roff_parse(r, *bufp, &pos))) return(ROFF_CONT); - ROFF_DEBUG("roff: intercept new-scope: %s, [%s]\n", - roffs[t].name, &(*bufp)[pos]); + ROFF_DEBUG("roff: intercept new-scope: [%s], [%s]\n", + ROFF_USERDEF == t ? r->current_string : roffs[t].name, + &(*bufp)[pos]); + assert(roffs[t].proc); return((*roffs[t].proc) (r, t, bufp, szp, @@ -650,6 +652,12 @@ roff_block(ROFF_ARGS) (*r->msg)(MANDOCERR_NOARGS, r->data, ln, ppos, NULL); return(ROFF_IGN); } + + /* + * Re-write `de1', since we don't really care about + * groff's strange compatibility mode, into `de'. + */ + if (ROFF_de1 == tok) tok = ROFF_de; if (ROFF_de == tok) @@ -657,8 +665,10 @@ roff_block(ROFF_ARGS) else (*r->msg)(MANDOCERR_REQUEST, r->data, ln, ppos, roffs[tok].name); + while ((*bufp)[pos] && ' ' != (*bufp)[pos]) pos++; + while (' ' == (*bufp)[pos]) (*bufp)[pos++] = '\0'; } @@ -670,14 +680,18 @@ roff_block(ROFF_ARGS) * with the same name, if there is one. New content will be * added from roff_block_text() in multiline mode. */ + if (ROFF_de == tok) - roff_setstr(r, name, "", 0); + roff_setstr(r, name, NULL, 0); if ('\0' == (*bufp)[pos]) return(ROFF_IGN); + /* If present, process the custom end-of-line marker. */ + sv = pos; - while ((*bufp)[pos] && ' ' != (*bufp)[pos] && + while ((*bufp)[pos] && + ' ' != (*bufp)[pos] && '\t' != (*bufp)[pos]) pos++; @@ -699,8 +713,7 @@ roff_block(ROFF_ARGS) r->last->end[(int)sz] = '\0'; if ((*bufp)[pos]) - if ( ! (*r->msg)(MANDOCERR_ARGSLOST, r->data, ln, pos, NULL)) - return(ROFF_ERR); + (*r->msg)(MANDOCERR_ARGSLOST, r->data, ln, pos, NULL); return(ROFF_IGN); } @@ -933,9 +946,8 @@ roff_cond(ROFF_ARGS) */ if ('\0' == (*bufp)[pos] && sv != pos) { - if ((*r->msg)(MANDOCERR_NOARGS, r->data, ln, ppos, NULL)) - return(ROFF_IGN); - return(ROFF_ERR); + (*r->msg)(MANDOCERR_NOARGS, r->data, ln, ppos, NULL); + return(ROFF_IGN); } roffnode_push(r, tok, NULL, ln, ppos); -- To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv