diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2015-10-30 19:03:37 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2015-10-30 19:03:37 +0000 |
commit | 6dc5a404a5e323c8e3b23174db97f55b7835a51c (patch) | |
tree | 5ccb1e953941ef117b565c5716746bbf5806b4ef /usr.bin | |
parent | 35e1cd917ccbfb5d6040a5569f44a7db7bc10bb4 (diff) |
If a .Bd block has no arguments at all, drop the block and only keep
its contents. Removing a gratuitious difference to groff output
found after a related bug report from krw@.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/mandoc/mandoc.1 | 11 | ||||
-rw-r--r-- | usr.bin/mandoc/mandoc.h | 3 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc.c | 3 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_validate.c | 12 | ||||
-rw-r--r-- | usr.bin/mandoc/read.c | 3 |
5 files changed, 26 insertions, 6 deletions
diff --git a/usr.bin/mandoc/mandoc.1 b/usr.bin/mandoc/mandoc.1 index 39a66a81283..3500983b2e4 100644 --- a/usr.bin/mandoc/mandoc.1 +++ b/usr.bin/mandoc/mandoc.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: mandoc.1,v 1.86 2015/09/26 17:12:45 jmc Exp $ +.\" $OpenBSD: mandoc.1,v 1.87 2015/10/30 19:03:36 schwarze Exp $ .\" .\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> .\" Copyright (c) 2012, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org> @@ -15,7 +15,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: September 26 2015 $ +.Dd $Mdocdate: October 30 2015 $ .Dt MANDOC 1 .Os .Sh NAME @@ -1600,6 +1600,13 @@ By requesting the inclusion of a sensitive file, a malicious document might otherwise trick a privileged user into inadvertently displaying the file on the screen, revealing the file content to bystanders. The argument is ignored including the file name following it. +.It Sy "skipping display without arguments" +.Pq mdoc +A +.Ic \&Bd +block macro does not have any arguments. +The block is discarded, and the block content is displayed in +whatever mode was active before the block. .It Sy "missing list type, using -item" .Pq mdoc A diff --git a/usr.bin/mandoc/mandoc.h b/usr.bin/mandoc/mandoc.h index 25490fd8ebd..0aecdb0ce4d 100644 --- a/usr.bin/mandoc/mandoc.h +++ b/usr.bin/mandoc/mandoc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mandoc.h,v 1.148 2015/10/13 22:57:49 schwarze Exp $ */ +/* $OpenBSD: mandoc.h,v 1.149 2015/10/30 19:03:36 schwarze Exp $ */ /* * Copyright (c) 2010, 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org> @@ -172,6 +172,7 @@ enum mandocerr { /* related to request and macro arguments */ MANDOCERR_NAMESC, /* escaped character not allowed in a name: name */ MANDOCERR_BD_FILE, /* NOT IMPLEMENTED: Bd -file */ + MANDOCERR_BD_NOARG, /* skipping display without arguments: Bd */ MANDOCERR_BL_NOTYPE, /* missing list type, using -item: Bl */ MANDOCERR_NM_NONAME, /* missing manual name, using "": Nm */ MANDOCERR_OS_UNAME, /* uname(3) system call failed, using UNKNOWN */ diff --git a/usr.bin/mandoc/mdoc.c b/usr.bin/mandoc/mdoc.c index 0a84263dcb5..56ae0c9acd5 100644 --- a/usr.bin/mandoc/mdoc.c +++ b/usr.bin/mandoc/mdoc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc.c,v 1.144 2015/10/20 02:00:49 schwarze Exp $ */ +/* $OpenBSD: mdoc.c,v 1.145 2015/10/30 19:03:36 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2012-2015 Ingo Schwarze <schwarze@openbsd.org> @@ -203,6 +203,7 @@ mdoc_node_relink(struct roff_man *mdoc, struct roff_node *p) { roff_node_unlink(mdoc, p); + p->prev = p->next = NULL; roff_node_append(mdoc, p); } diff --git a/usr.bin/mandoc/mdoc_validate.c b/usr.bin/mandoc/mdoc_validate.c index b5f8fcebdb0..5c65594b432 100644 --- a/usr.bin/mandoc/mdoc_validate.c +++ b/usr.bin/mandoc/mdoc_validate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc_validate.c,v 1.215 2015/10/21 23:49:05 schwarze Exp $ */ +/* $OpenBSD: mdoc_validate.c,v 1.216 2015/10/30 19:03:36 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org> @@ -886,6 +886,16 @@ post_display(POST_ARGS) break; case ROFFT_BLOCK: if (n->tok == MDOC_Bd) { + if (n->args == NULL) { + mandoc_msg(MANDOCERR_BD_NOARG, + mdoc->parse, n->line, n->pos, "Bd"); + mdoc->next = ROFF_NEXT_SIBLING; + while (n->body->child != NULL) + mdoc_node_relink(mdoc, + n->body->child); + roff_node_delete(mdoc, n); + break; + } post_bd(mdoc); post_prevpar(mdoc); } diff --git a/usr.bin/mandoc/read.c b/usr.bin/mandoc/read.c index 830c73ef2c6..c5c7da6f65b 100644 --- a/usr.bin/mandoc/read.c +++ b/usr.bin/mandoc/read.c @@ -1,4 +1,4 @@ -/* $OpenBSD: read.c,v 1.119 2015/10/13 22:57:49 schwarze Exp $ */ +/* $OpenBSD: read.c,v 1.120 2015/10/30 19:03:36 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org> @@ -210,6 +210,7 @@ static const char * const mandocerrs[MANDOCERR_MAX] = { /* related to request and macro arguments */ "escaped character not allowed in a name", "NOT IMPLEMENTED: Bd -file", + "skipping display without arguments", "missing list type, using -item", "missing manual name, using \"\"", "uname(3) system call failed, using UNKNOWN", |