source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mandoc.bsd.lv
To: source@mandoc.bsd.lv
Subject: mandoc: When parsing a tab character that is not preceded by a space
Date: Thu, 11 Jul 2019 12:06:21 -0500 (EST)	[thread overview]
Message-ID: <8629f2b87f24f447@mandoc.bsd.lv> (raw)

Log Message:
-----------
When parsing a tab character that is not preceded by a space character
on an .It -column line, args() sets the MDOC_PHRASEQL flag to Quote
the Last word of the Phrase.  Even if it turns out this quoting is not
needed because the word is already quoted for other reasons, clear the
flag at the end of parsing the phrase, such that the flag does not leak
to the next phrase.

This patch fixes the bug that the trailing Macro on a line of the form
.It "word<tab>word" Ta word Macro<eol>
was incorrectly considered quoted and hence not parsed.

Bug found by Havard Eidnes (he@) with the NetBSD gettytab(5) manual page:
https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=54361
Reported via Thomas Klausner (wiz@).

Modified Files:
--------------
    mandoc:
        mdoc_argv.c
    mandoc/regress/mdoc/Bl:
        column.in
        column.out_ascii
        column.out_lint
        column.out_markdown

Revision Data
-------------
Index: mdoc_argv.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/mdoc_argv.c,v
retrieving revision 1.119
retrieving revision 1.120
diff -Lmdoc_argv.c -Lmdoc_argv.c -u -p -r1.119 -r1.120
--- mdoc_argv.c
+++ mdoc_argv.c
@@ -1,7 +1,7 @@
 /*	$Id$ */
 /*
  * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2012, 2014-2018 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2012, 2014-2019 Ingo Schwarze <schwarze@openbsd.org>
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -454,6 +454,7 @@ args(struct roff_man *mdoc, int line, in
 			mandoc_msg(MANDOCERR_ARG_QUOTE, line, *pos, NULL);
 			mdoc->flags &= ~MDOC_PHRASELIT;
 		}
+		mdoc->flags &= ~MDOC_PHRASEQL;
 		return ARGS_EOLN;
 	}
 
Index: column.in
===================================================================
RCS file: /home/cvs/mandoc/mandoc/regress/mdoc/Bl/column.in,v
retrieving revision 1.3
retrieving revision 1.4
diff -Lregress/mdoc/Bl/column.in -Lregress/mdoc/Bl/column.in -u -p -r1.3 -r1.4
--- regress/mdoc/Bl/column.in
+++ regress/mdoc/Bl/column.in
@@ -1,4 +1,4 @@
-.\" $OpenBSD: column.in,v 1.10 2017/07/04 14:53:24 schwarze Exp $
+.\" $OpenBSD: column.in,v 1.11 2019/07/11 16:56:52 schwarze Exp $
 .Dd $Mdocdate$
 .Dt BL-COLUMN 1
 .Os
@@ -81,7 +81,8 @@
 .\" Mixed tab and Ta
 .Bl -column a b c d
 .It a	b	c	d
-.It a	b	c Ta d
+.It "a	b	c" Ta
+d
 .It a	b Ta c	d
 .It a	b Ta c Ta d
 .It a Ta b	c	d
Index: column.out_markdown
===================================================================
RCS file: /home/cvs/mandoc/mandoc/regress/mdoc/Bl/column.out_markdown,v
retrieving revision 1.2
retrieving revision 1.3
diff -Lregress/mdoc/Bl/column.out_markdown -Lregress/mdoc/Bl/column.out_markdown -u -p -r1.2 -r1.3
--- regress/mdoc/Bl/column.out_markdown
+++ regress/mdoc/Bl/column.out_markdown
@@ -75,4 +75,4 @@ BL-COLUMN(1) - General Commands Manual
 
 	aa    bb    cc    dd
 
-OpenBSD - July 4, 2017
+OpenBSD - July 11, 2019
Index: column.out_ascii
===================================================================
RCS file: /home/cvs/mandoc/mandoc/regress/mdoc/Bl/column.out_ascii,v
retrieving revision 1.2
retrieving revision 1.3
diff -Lregress/mdoc/Bl/column.out_ascii -Lregress/mdoc/Bl/column.out_ascii -u -p -r1.2 -r1.3
--- regress/mdoc/Bl/column.out_ascii
+++ regress/mdoc/Bl/column.out_ascii
@@ -71,4 +71,4 @@ D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
      aa    bb                          tab at eol
      aa    bb    cc    dd
 
-OpenBSD                          July 4, 2017                          OpenBSD
+OpenBSD                          July 11, 2019                         OpenBSD
Index: column.out_lint
===================================================================
RCS file: /home/cvs/mandoc/mandoc/regress/mdoc/Bl/column.out_lint,v
retrieving revision 1.6
retrieving revision 1.7
diff -Lregress/mdoc/Bl/column.out_lint -Lregress/mdoc/Bl/column.out_lint -u -p -r1.6 -r1.7
--- regress/mdoc/Bl/column.out_lint
+++ regress/mdoc/Bl/column.out_lint
@@ -4,4 +4,4 @@ mandoc: column.in:75:2: WARNING: skippin
 mandoc: column.in:77:2: WARNING: wrong number of cells: 2 columns, 4 cells
 mandoc: column.in:78:2: WARNING: wrong number of cells: 2 columns, 5 cells
 mandoc: column.in:79:2: WARNING: skipping empty macro: It
-mandoc: column.in:107:18: WARNING: skipping -width argument: Bl -column
+mandoc: column.in:108:18: WARNING: skipping -width argument: Bl -column
--
 To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv

                 reply	other threads:[~2019-07-11 17:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=8629f2b87f24f447@mandoc.bsd.lv \
    --to=schwarze@mandoc.bsd.lv \
    --cc=source@mandoc.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).