POSIX doesn’t explicitly specify (or explicitly un-specify) what happens when a backslash in the format string is followed by a character other than those listed by POSIX with special behavior. OpenBSD’s printf, at least, warns about it and prints the literal character following the backslash. That is:
$ printf '\(\n' printf: unknown escape sequence `\(' ( Fixes: 4adc25dd2156 (“Add smoke test for HTML output.”) --- src/roff/groff/tests/html-device-smoke-test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/roff/groff/tests/html-device-smoke-test.sh b/src/roff/groff/tests/html-device-smoke-test.sh index 8d2aad7fd..d8fa234a8 100755 --- a/src/roff/groff/tests/html-device-smoke-test.sh +++ b/src/roff/groff/tests/html-device-smoke-test.sh @@ -103,7 +103,7 @@ printf '\303\241' | "$groff" -k -Thtml | grep -qx '<p>á</p>' \ # We test compatibility-mode HTML output somewhat differently since # preconv only emits groffish \[uXXXX] escapes for non-ASCII codepoints. echo "checking -C -k -Thtml" >&2 -printf "\('a" | "$groff" -C -k -Thtml | grep -qx '<p>á</p>' \ +printf "\\\\('a" | "$groff" -C -k -Thtml | grep -qx '<p>á</p>' \ || wail test -z "$fail" -- 2.48.1