From: schwarze Date: Tue, 16 Dec 2014 17:24:58 +0000 (+0000) Subject: Explicit block closure macros clobber next-line block head scope, X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=2eb2afb2a25275228c9a94f2010de28ee7e3adf1;p=openbsd Explicit block closure macros clobber next-line block head scope, just like explicit block macros themselves. Fixing an assertion failure jsg@ found with afl. --- diff --git a/regress/usr.bin/mandoc/man/SH/noarg.in b/regress/usr.bin/mandoc/man/SH/noarg.in index b62d318e30b..d85c12035fd 100644 --- a/regress/usr.bin/mandoc/man/SH/noarg.in +++ b/regress/usr.bin/mandoc/man/SH/noarg.in @@ -1,4 +1,4 @@ -.TH SH-NOARG 1 "July 30, 2014" OpenBSD +.TH SH-NOARG 1 "December 16, 2014" OpenBSD .SH NAME SH-noarg \- empty header lines .SH DESCRIPTION @@ -9,3 +9,9 @@ text in section with empty name .SS .PP text in subsection with empty name +.SH +.RE +text in section with empty name +.SS +.RE +text in subsection with empty name diff --git a/regress/usr.bin/mandoc/man/SH/noarg.out_ascii b/regress/usr.bin/mandoc/man/SH/noarg.out_ascii index ca892880587..2cace7f657f 100644 --- a/regress/usr.bin/mandoc/man/SH/noarg.out_ascii +++ b/regress/usr.bin/mandoc/man/SH/noarg.out_ascii @@ -10,8 +10,9 @@ DDEESSCCRRIIPPTTIIOONN text in section with empty name - text in subsection with empty name + text in subsection with empty name text in section with empty name text + in subsection with empty name -OpenBSD July 30, 2014 SH-NOARG(1) +OpenBSD December 16, 2014 SH-NOARG(1) diff --git a/regress/usr.bin/mandoc/man/SH/noarg.out_lint b/regress/usr.bin/mandoc/man/SH/noarg.out_lint index b852aad4a12..fbae21e469e 100644 --- a/regress/usr.bin/mandoc/man/SH/noarg.out_lint +++ b/regress/usr.bin/mandoc/man/SH/noarg.out_lint @@ -1,2 +1,6 @@ mandoc: noarg.in:6:2: WARNING: line scope broken: PP breaks SH mandoc: noarg.in:9:2: WARNING: line scope broken: PP breaks SS +mandoc: noarg.in:12:2: WARNING: line scope broken: RE breaks SH +mandoc: noarg.in:13:2: ERROR: skipping end of block that is not open: RE +mandoc: noarg.in:15:2: WARNING: line scope broken: RE breaks SS +mandoc: noarg.in:16:2: ERROR: skipping end of block that is not open: RE diff --git a/regress/usr.bin/mandoc/man/TP/Makefile b/regress/usr.bin/mandoc/man/TP/Makefile index 0ff19165166..dfbcee19803 100644 --- a/regress/usr.bin/mandoc/man/TP/Makefile +++ b/regress/usr.bin/mandoc/man/TP/Makefile @@ -1,13 +1,14 @@ -# $OpenBSD: Makefile,v 1.9 2014/07/07 21:35:42 schwarze Exp $ +# $OpenBSD: Makefile,v 1.10 2014/12/16 17:24:58 schwarze Exp $ -REGRESS_TARGETS = badarg double eof literal longhead macrotag manyargs -REGRESS_TARGETS += sameline width +REGRESS_TARGETS = badarg broken double eof literal longhead +REGRESS_TARGETS += macrotag manyargs sameline width -LINT_TARGETS = double eof +LINT_TARGETS = broken double eof -# groff-1.22.1 defect: +# groff-1.22.3 defects: +# - If .TP precedes .RE, the latter does not properly reset indentation. # - If the last line of the file is .TP, groff does not print a page footer. -SKIP_GROFF = eof +SKIP_GROFF = broken eof .include diff --git a/regress/usr.bin/mandoc/man/TP/broken.in b/regress/usr.bin/mandoc/man/TP/broken.in new file mode 100644 index 00000000000..c111caeb9e1 --- /dev/null +++ b/regress/usr.bin/mandoc/man/TP/broken.in @@ -0,0 +1,13 @@ +.TH TP-BROKEN 1 "December 16, 2014" OpenBSD +.SH NAME +TP-broken \- broken tagged paragraph +.SH DESCRIPTION +regular +text +.RS 4n +indented +text +.TP +.RE +regular +text diff --git a/regress/usr.bin/mandoc/man/TP/broken.out_ascii b/regress/usr.bin/mandoc/man/TP/broken.out_ascii new file mode 100644 index 00000000000..e19efdf0275 --- /dev/null +++ b/regress/usr.bin/mandoc/man/TP/broken.out_ascii @@ -0,0 +1,15 @@ +TP-BROKEN(1) General Commands Manual TP-BROKEN(1) + + + +NNAAMMEE + TP-broken - broken tagged paragraph + +DDEESSCCRRIIPPTTIIOONN + regular text + indented text + regular text + + + +OpenBSD December 16, 2014 TP-BROKEN(1) diff --git a/regress/usr.bin/mandoc/man/TP/broken.out_lint b/regress/usr.bin/mandoc/man/TP/broken.out_lint new file mode 100644 index 00000000000..3a1024fcd17 --- /dev/null +++ b/regress/usr.bin/mandoc/man/TP/broken.out_lint @@ -0,0 +1 @@ +mandoc: broken.in:10:2: WARNING: line scope broken: RE breaks TP diff --git a/usr.bin/mandoc/man_macro.c b/usr.bin/mandoc/man_macro.c index 96dd04e51b9..cb5430a52a2 100644 --- a/usr.bin/mandoc/man_macro.c +++ b/usr.bin/mandoc/man_macro.c @@ -1,4 +1,4 @@ -/* $OpenBSD: man_macro.c,v 1.53 2014/11/28 05:51:29 schwarze Exp $ */ +/* $OpenBSD: man_macro.c,v 1.54 2014/12/16 17:24:58 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2012, 2013, 2014 Ingo Schwarze @@ -74,7 +74,7 @@ const struct man_macro __man_macros[MAN_MAX] = { { in_line_eoln, MAN_NSCOPED }, /* sp */ { in_line_eoln, MAN_BSCOPE }, /* nf */ { in_line_eoln, MAN_BSCOPE }, /* fi */ - { blk_close, 0 }, /* RE */ + { blk_close, MAN_BSCOPE }, /* RE */ { blk_exp, MAN_BSCOPE | MAN_EXPLICIT }, /* RS */ { in_line_eoln, 0 }, /* DT */ { in_line_eoln, 0 }, /* UC */ @@ -86,7 +86,7 @@ const struct man_macro __man_macros[MAN_MAX] = { { in_line_eoln, MAN_BSCOPE }, /* EX */ { in_line_eoln, MAN_BSCOPE }, /* EE */ { blk_exp, MAN_BSCOPE | MAN_EXPLICIT }, /* UR */ - { blk_close, 0 }, /* UE */ + { blk_close, MAN_BSCOPE }, /* UE */ { in_line_eoln, 0 }, /* ll */ };