diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2019-07-11 16:56:53 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2019-07-11 16:56:53 +0000 |
commit | f792fa6d1b62ca64f420c84a3f958b0d5adf49ae (patch) | |
tree | fc6012faa939875855d2d8e1a54be93100e44b86 | |
parent | f0ac229154833a940dd404b22639d8347135b823 (diff) |
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@).
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Bl/column.in | 7 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Bl/column.out_lint | 2 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_argv.c | 5 |
3 files changed, 8 insertions, 6 deletions
diff --git a/regress/usr.bin/mandoc/mdoc/Bl/column.in b/regress/usr.bin/mandoc/mdoc/Bl/column.in index a6c791d7318..8bb32698da5 100644 --- a/regress/usr.bin/mandoc/mdoc/Bl/column.in +++ b/regress/usr.bin/mandoc/mdoc/Bl/column.in @@ -1,5 +1,5 @@ -.\" $OpenBSD: column.in,v 1.10 2017/07/04 14:53:24 schwarze Exp $ -.Dd $Mdocdate: July 4 2017 $ +.\" $OpenBSD: column.in,v 1.11 2019/07/11 16:56:52 schwarze Exp $ +.Dd $Mdocdate: July 11 2019 $ .Dt BL-COLUMN 1 .Os .Sh NAME @@ -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 diff --git a/regress/usr.bin/mandoc/mdoc/Bl/column.out_lint b/regress/usr.bin/mandoc/mdoc/Bl/column.out_lint index 4d64846ea28..49135fadf9b 100644 --- a/regress/usr.bin/mandoc/mdoc/Bl/column.out_lint +++ b/regress/usr.bin/mandoc/mdoc/Bl/column.out_lint @@ -4,4 +4,4 @@ mandoc: column.in:75:2: WARNING: skipping empty macro: It 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 diff --git a/usr.bin/mandoc/mdoc_argv.c b/usr.bin/mandoc/mdoc_argv.c index 4c7d09659a5..bacac340b11 100644 --- a/usr.bin/mandoc/mdoc_argv.c +++ b/usr.bin/mandoc/mdoc_argv.c @@ -1,7 +1,7 @@ -/* $OpenBSD: mdoc_argv.c,v 1.75 2018/12/21 16:58:49 schwarze Exp $ */ +/* $OpenBSD: mdoc_argv.c,v 1.76 2019/07/11 16:56:52 schwarze Exp $ */ /* * 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 @@ -452,6 +452,7 @@ args(struct roff_man *mdoc, int line, int *pos, mandoc_msg(MANDOCERR_ARG_QUOTE, line, *pos, NULL); mdoc->flags &= ~MDOC_PHRASELIT; } + mdoc->flags &= ~MDOC_PHRASEQL; return ARGS_EOLN; } |