diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2018-12-21 16:58:50 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2018-12-21 16:58:50 +0000 |
commit | 7928109223463f24bfe9976dc7a663ec40d4f32f (patch) | |
tree | 6973d5b6b42df71093cd3b7fb8c0cc65af9c1045 /regress/usr.bin/mandoc/mdoc | |
parent | 69025f72dda5ad51f12ce2e464aa69ff47385c5f (diff) |
Rename mandoc_getarg() to roff_getarg() and pass it the roff parser
struct as an argument such that after copy-in, it can call roff_expand()
once again, which used to be called roff_res() before this. This
fixes a subtle low-level roff(7) parsing bug reported by Fabio
Scotoni <fabio at esse dot ch> in the 4.4BSD-Lite2 mdoc.samples(7)
manual page, because that page used an escaped escape sequence in
a macro argument.
To expand escaped escape sequences in quoted mdoc(7) arguments, too,
stop bypassing the call to roff_getarg() in mdoc_argv.c, function args()
for this case. This does not solve the case of escaped escape sequences
in quoted .Bl -column phrases yet.
Because roff_expand() can make the string longer, roff_getarg() can no
longer operate in-place but needs to malloc(3) the returned string.
In the high-level parsers, free(3) that string after processing it.
Diffstat (limited to 'regress/usr.bin/mandoc/mdoc')
25 files changed, 341 insertions, 12 deletions
diff --git a/regress/usr.bin/mandoc/mdoc/Bl/Makefile b/regress/usr.bin/mandoc/mdoc/Bl/Makefile index deda0bf7381..8fde5d9e07e 100644 --- a/regress/usr.bin/mandoc/mdoc/Bl/Makefile +++ b/regress/usr.bin/mandoc/mdoc/Bl/Makefile @@ -1,8 +1,8 @@ -# $OpenBSD: Makefile,v 1.39 2017/07/16 17:53:29 schwarze Exp $ +# $OpenBSD: Makefile,v 1.40 2018/12/21 16:58:49 schwarze Exp $ REGRESS_TARGETS = item inset diag ohang bullet dash enum hang tag REGRESS_TARGETS += column column_nogroff colNoIt -REGRESS_TARGETS += extend nested offset secstart +REGRESS_TARGETS += esc extend nested offset secstart REGRESS_TARGETS += notype multitype badargs REGRESS_TARGETS += empty noIt emptyhead emptytag emptyitem multitag diff --git a/regress/usr.bin/mandoc/mdoc/Bl/esc.in b/regress/usr.bin/mandoc/mdoc/Bl/esc.in new file mode 100644 index 00000000000..343ccc7de94 --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Bl/esc.in @@ -0,0 +1,19 @@ +.\" $OpenBSD: esc.in,v 1.1 2018/12/21 16:58:49 schwarze Exp $ +.Dd $Mdocdate: December 21 2018 $ +.Dt BL-ESC 1 +.Os +.Sh NAME +.Nm Bl-esc +.Nd escape sequences in full block macro heads +.Sh DESCRIPTION +.ds a \(at +.Bl -tag -width 2n +.It \*a +unquoted unescaped +.It "\*a" +quoted unescaped +.It \\*a +unquoted escaped +.It "\\*a" +quoted escaped +.El diff --git a/regress/usr.bin/mandoc/mdoc/Bl/esc.out_ascii b/regress/usr.bin/mandoc/mdoc/Bl/esc.out_ascii new file mode 100644 index 00000000000..e73c929f5b0 --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Bl/esc.out_ascii @@ -0,0 +1,15 @@ +BL-ESC(1) General Commands Manual BL-ESC(1) + +NNAAMMEE + BBll--eesscc - escape sequences in full block macro heads + +DDEESSCCRRIIPPTTIIOONN + @ unquoted unescaped + + @ quoted unescaped + + @ unquoted escaped + + @ quoted escaped + +OpenBSD December 21, 2018 OpenBSD diff --git a/regress/usr.bin/mandoc/mdoc/Bl/esc.out_markdown b/regress/usr.bin/mandoc/mdoc/Bl/esc.out_markdown new file mode 100644 index 00000000000..780a61b8f84 --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Bl/esc.out_markdown @@ -0,0 +1,25 @@ +BL-ESC(1) - General Commands Manual + +# NAME + +**Bl-esc** - escape sequences in full block macro heads + +# DESCRIPTION + +@ + +> unquoted unescaped + +@ + +> quoted unescaped + +@ + +> unquoted escaped + +@ + +> quoted escaped + +OpenBSD - December 21, 2018 diff --git a/regress/usr.bin/mandoc/mdoc/Eo/Makefile b/regress/usr.bin/mandoc/mdoc/Eo/Makefile index f8889a8f05b..1e101aceb97 100644 --- a/regress/usr.bin/mandoc/mdoc/Eo/Makefile +++ b/regress/usr.bin/mandoc/mdoc/Eo/Makefile @@ -1,6 +1,7 @@ -# $OpenBSD: Makefile,v 1.7 2017/03/08 22:53:35 schwarze Exp $ +# $OpenBSD: Makefile,v 1.8 2018/12/21 16:58:49 schwarze Exp $ -REGRESS_TARGETS = break empty obsolete unclosed +REGRESS_TARGETS = arg break empty obsolete unclosed +UTF8_TARGETS = arg LINT_TARGETS = break obsolete unclosed # groff-1.22.3 defect: diff --git a/regress/usr.bin/mandoc/mdoc/Eo/arg.in b/regress/usr.bin/mandoc/mdoc/Eo/arg.in new file mode 100644 index 00000000000..dd7928a740f --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Eo/arg.in @@ -0,0 +1,25 @@ +.\" $OpenBSD: arg.in,v 1.1 2018/12/21 16:58:49 schwarze Exp $ +.Dd $Mdocdate: December 21 2018 $ +.Dt EO-ARG 1 +.Os +.Sh NAME +.Nm Eo-arg +.Nd escapes in arguments of enclosure macros +.Sh DESCRIPTION +.ds o \(Fo +.ds c \(Fc +.Eo \*o +unquoted unescaped +.Ec \*c +.Pp +.Eo "\*o" +quoted unescaped +.Ec "\*c" +.Pp +.Eo \\*o +unquoted escaped +.Ec \\*c +.Pp +.Eo "\\*o" +quoted escaped +.Ec "\\*c" diff --git a/regress/usr.bin/mandoc/mdoc/Eo/arg.out_ascii b/regress/usr.bin/mandoc/mdoc/Eo/arg.out_ascii new file mode 100644 index 00000000000..004c3fe5804 --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Eo/arg.out_ascii @@ -0,0 +1,15 @@ +EO-ARG(1) General Commands Manual EO-ARG(1) + +NNAAMMEE + EEoo--aarrgg - escapes in arguments of enclosure macros + +DDEESSCCRRIIPPTTIIOONN + <<unquoted unescaped>> + + <<quoted unescaped>> + + <<unquoted escaped>> + + <<quoted escaped>> + +OpenBSD December 21, 2018 OpenBSD diff --git a/regress/usr.bin/mandoc/mdoc/Eo/arg.out_markdown b/regress/usr.bin/mandoc/mdoc/Eo/arg.out_markdown new file mode 100644 index 00000000000..9da6ff4fd5d --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Eo/arg.out_markdown @@ -0,0 +1,17 @@ +EO-ARG(1) - General Commands Manual + +# NAME + +**Eo-arg** - escapes in arguments of enclosure macros + +# DESCRIPTION + +«unquoted unescaped» + +«quoted unescaped» + +«unquoted escaped» + +«quoted escaped» + +OpenBSD - December 21, 2018 diff --git a/regress/usr.bin/mandoc/mdoc/Eo/arg.out_utf8 b/regress/usr.bin/mandoc/mdoc/Eo/arg.out_utf8 new file mode 100644 index 00000000000..3b4a30bd138 --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Eo/arg.out_utf8 @@ -0,0 +1,15 @@ +EO-ARG(1) General Commands Manual EO-ARG(1) + +NNAAMMEE + EEoo--aarrgg – escapes in arguments of enclosure macros + +DDEESSCCRRIIPPTTIIOONN + «unquoted unescaped» + + «quoted unescaped» + + «unquoted escaped» + + «quoted escaped» + +OpenBSD December 21, 2018 OpenBSD diff --git a/regress/usr.bin/mandoc/mdoc/Fd/Makefile b/regress/usr.bin/mandoc/mdoc/Fd/Makefile index d2daf08bd92..39b07f1d0d8 100644 --- a/regress/usr.bin/mandoc/mdoc/Fd/Makefile +++ b/regress/usr.bin/mandoc/mdoc/Fd/Makefile @@ -1,6 +1,6 @@ -# $OpenBSD: Makefile,v 1.6 2017/03/08 22:53:35 schwarze Exp $ +# $OpenBSD: Makefile,v 1.7 2018/12/21 16:58:49 schwarze Exp $ -REGRESS_TARGETS = break empty eos font +REGRESS_TARGETS = arg break empty eos font LINT_TARGETS = empty SKIP_TMAN = eos diff --git a/regress/usr.bin/mandoc/mdoc/Fd/arg.in b/regress/usr.bin/mandoc/mdoc/Fd/arg.in new file mode 100644 index 00000000000..659d03c9b53 --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Fd/arg.in @@ -0,0 +1,16 @@ +.\" $OpenBSD: arg.in,v 1.1 2018/12/21 16:58:49 schwarze Exp $ +.Dd $Mdocdate: December 21 2018 $ +.Dt FD-ARG 2 +.Os +.Sh NAME +.Nm Fd-arg +.Nd escape sequences in the arguments of in-line EOL macros +.Sh DESCRIPTION +.ds s \(sh +.Fd \*sunquoted unescaped +.Pp +.Fd "\*squoted" unescaped +.Pp +.Fd \\*sunquoted escaped +.Pp +.Fd "\\*squoted" escaped diff --git a/regress/usr.bin/mandoc/mdoc/Fd/arg.out_ascii b/regress/usr.bin/mandoc/mdoc/Fd/arg.out_ascii new file mode 100644 index 00000000000..42836e614a8 --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Fd/arg.out_ascii @@ -0,0 +1,15 @@ +FD-ARG(2) System Calls Manual FD-ARG(2) + +NNAAMMEE + FFdd--aarrgg - escape sequences in the arguments of in-line EOL macros + +DDEESSCCRRIIPPTTIIOONN + ##uunnqquuootteedd uunneessccaappeedd + + ##qquuootteedd uunneessccaappeedd + + ##uunnqquuootteedd eessccaappeedd + + ##qquuootteedd eessccaappeedd + +OpenBSD December 21, 2018 OpenBSD diff --git a/regress/usr.bin/mandoc/mdoc/Fd/arg.out_markdown b/regress/usr.bin/mandoc/mdoc/Fd/arg.out_markdown new file mode 100644 index 00000000000..14dba6fc52a --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Fd/arg.out_markdown @@ -0,0 +1,17 @@ +FD-ARG(2) - System Calls Manual + +# NAME + +**Fd-arg** - escape sequences in the arguments of in-line EOL macros + +# DESCRIPTION + +**#unquoted unescaped** + +**#quoted unescaped** + +**#unquoted escaped** + +**#quoted escaped** + +OpenBSD - December 21, 2018 diff --git a/regress/usr.bin/mandoc/mdoc/Li/Makefile b/regress/usr.bin/mandoc/mdoc/Li/Makefile index 197e61375b6..7b2a3313c5a 100644 --- a/regress/usr.bin/mandoc/mdoc/Li/Makefile +++ b/regress/usr.bin/mandoc/mdoc/Li/Makefile @@ -1,6 +1,6 @@ -# $OpenBSD: Makefile,v 1.6 2017/03/08 22:53:35 schwarze Exp $ +# $OpenBSD: Makefile,v 1.7 2018/12/21 16:58:49 schwarze Exp $ -REGRESS_TARGETS = punct font +REGRESS_TARGETS = arg punct font LINT_TARGETS = punct .include <bsd.regress.mk> diff --git a/regress/usr.bin/mandoc/mdoc/Li/arg.in b/regress/usr.bin/mandoc/mdoc/Li/arg.in new file mode 100644 index 00000000000..d6c806725f5 --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Li/arg.in @@ -0,0 +1,20 @@ +.\" $OpenBSD: arg.in,v 1.1 2018/12/21 16:58:49 schwarze Exp $ +.Dd $Mdocdate: December 21 2018 $ +.Dt LI-ARG 1 +.Os +.Sh NAME +.Nm Li-arg +.Nd escape sequences in arguments of in-line macros +.Sh DESCRIPTION +.ds a \(at +unquoted unescaped: +.Li \*a +.Pp +quoted unescaped: +.Li "\*a" +.Pp +unquoted escaped: +.Li \\*a +.Pp +quoted escaped: +.Li "\\*a" diff --git a/regress/usr.bin/mandoc/mdoc/Li/arg.out_ascii b/regress/usr.bin/mandoc/mdoc/Li/arg.out_ascii new file mode 100644 index 00000000000..f0a69f18c82 --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Li/arg.out_ascii @@ -0,0 +1,15 @@ +LI-ARG(1) General Commands Manual LI-ARG(1) + +NNAAMMEE + LLii--aarrgg - escape sequences in arguments of in-line macros + +DDEESSCCRRIIPPTTIIOONN + unquoted unescaped: @ + + quoted unescaped: @ + + unquoted escaped: @ + + quoted escaped: @ + +OpenBSD December 21, 2018 OpenBSD diff --git a/regress/usr.bin/mandoc/mdoc/Li/arg.out_markdown b/regress/usr.bin/mandoc/mdoc/Li/arg.out_markdown new file mode 100644 index 00000000000..1b0ba54e809 --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Li/arg.out_markdown @@ -0,0 +1,21 @@ +LI-ARG(1) - General Commands Manual + +# NAME + +**Li-arg** - escape sequences in arguments of in-line macros + +# DESCRIPTION + +unquoted unescaped: +`@` + +quoted unescaped: +`@` + +unquoted escaped: +`@` + +quoted escaped: +`@` + +OpenBSD - December 21, 2018 diff --git a/regress/usr.bin/mandoc/mdoc/Ns/Makefile b/regress/usr.bin/mandoc/mdoc/Ns/Makefile index a13fa6deeee..b2c409ab1f6 100644 --- a/regress/usr.bin/mandoc/mdoc/Ns/Makefile +++ b/regress/usr.bin/mandoc/mdoc/Ns/Makefile @@ -1,6 +1,6 @@ -# $OpenBSD: Makefile,v 1.7 2017/03/08 22:53:35 schwarze Exp $ +# $OpenBSD: Makefile,v 1.8 2018/12/21 16:58:49 schwarze Exp $ -REGRESS_TARGETS = position punct +REGRESS_TARGETS = arg position punct LINT_TARGETS = position .include <bsd.regress.mk> diff --git a/regress/usr.bin/mandoc/mdoc/Ns/arg.in b/regress/usr.bin/mandoc/mdoc/Ns/arg.in new file mode 100644 index 00000000000..b83a1f4ad3c --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Ns/arg.in @@ -0,0 +1,13 @@ +.\" $OpenBSD: arg.in,v 1.1 2018/12/21 16:58:49 schwarze Exp $ +.Dd $Mdocdate: December 21 2018 $ +.Dt NS-ARG 1 +.Os +.Sh NAME +.Nm Ns-arg +.Nd escape sequences in the arguments of in-line macros with an argument limit +.Sh DESCRIPTION +.ds a \(at +.No unquoted unescaped Ns \*a +.No quoted unescaped Ns "\*a" +.No unquoted escaped Ns \\*a +.No quoted escaped Ns "\\*a" diff --git a/regress/usr.bin/mandoc/mdoc/Ns/arg.out_ascii b/regress/usr.bin/mandoc/mdoc/Ns/arg.out_ascii new file mode 100644 index 00000000000..2b8a51047ba --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Ns/arg.out_ascii @@ -0,0 +1,10 @@ +NS-ARG(1) General Commands Manual NS-ARG(1) + +NNAAMMEE + NNss--aarrgg - escape sequences in the arguments of in-line macros with an + argument limit + +DDEESSCCRRIIPPTTIIOONN + unquoted unescaped@ quoted unescaped@ unquoted escaped@ quoted escaped@ + +OpenBSD December 21, 2018 OpenBSD diff --git a/regress/usr.bin/mandoc/mdoc/Ns/arg.out_markdown b/regress/usr.bin/mandoc/mdoc/Ns/arg.out_markdown new file mode 100644 index 00000000000..7d60059040f --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Ns/arg.out_markdown @@ -0,0 +1,14 @@ +NS-ARG(1) - General Commands Manual + +# NAME + +**Ns-arg** - escape sequences in the arguments of in-line macros with an argument limit + +# DESCRIPTION + +unquoted unescaped@ +quoted unescaped@ +unquoted escaped@ +quoted escaped@ + +OpenBSD - December 21, 2018 diff --git a/regress/usr.bin/mandoc/mdoc/Op/Makefile b/regress/usr.bin/mandoc/mdoc/Op/Makefile index 6bac1ba857f..b2a79566769 100644 --- a/regress/usr.bin/mandoc/mdoc/Op/Makefile +++ b/regress/usr.bin/mandoc/mdoc/Op/Makefile @@ -1,6 +1,6 @@ -# $OpenBSD: Makefile,v 1.6 2017/06/10 01:48:31 schwarze Exp $ +# $OpenBSD: Makefile,v 1.7 2018/12/21 16:58:49 schwarze Exp $ -REGRESS_TARGETS = break broken punct +REGRESS_TARGETS = arg break broken punct LINT_TARGETS = break broken punct SKIP_GROFF = break diff --git a/regress/usr.bin/mandoc/mdoc/Op/arg.in b/regress/usr.bin/mandoc/mdoc/Op/arg.in new file mode 100644 index 00000000000..2043b01e082 --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Op/arg.in @@ -0,0 +1,20 @@ +.\" $OpenBSD: arg.in,v 1.1 2018/12/21 16:58:49 schwarze Exp $ +.Dd $Mdocdate: December 21 2018 $ +.Dt OP-ARG 1 +.Os +.Sh NAME +.Nm Op-arg +.Nd escape sequences in the arguments of partial implicit macros +.Sh DESCRIPTION +.ds a \(at +unquoted unescaped: +.Op \*a +.Pp +quoted unescaped: +.Op "\*a" +.Pp +unquoted escaped: +.Op \\*a +.Pp +quoted escaped: +.Op "\\*a" diff --git a/regress/usr.bin/mandoc/mdoc/Op/arg.out_ascii b/regress/usr.bin/mandoc/mdoc/Op/arg.out_ascii new file mode 100644 index 00000000000..534917cb01b --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Op/arg.out_ascii @@ -0,0 +1,15 @@ +OP-ARG(1) General Commands Manual OP-ARG(1) + +NNAAMMEE + OOpp--aarrgg - escape sequences in the arguments of partial implicit macros + +DDEESSCCRRIIPPTTIIOONN + unquoted unescaped: [@] + + quoted unescaped: [@] + + unquoted escaped: [@] + + quoted escaped: [@] + +OpenBSD December 21, 2018 OpenBSD diff --git a/regress/usr.bin/mandoc/mdoc/Op/arg.out_markdown b/regress/usr.bin/mandoc/mdoc/Op/arg.out_markdown new file mode 100644 index 00000000000..5ad86f7d05a --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Op/arg.out_markdown @@ -0,0 +1,21 @@ +OP-ARG(1) - General Commands Manual + +# NAME + +**Op-arg** - escape sequences in the arguments of partial implicit macros + +# DESCRIPTION + +unquoted unescaped: +\[@] + +quoted unescaped: +\[@] + +unquoted escaped: +\[@] + +quoted escaped: +\[@] + +OpenBSD - December 21, 2018 |