gbranden pushed a commit to branch master
in repository groff.
commit e8613792630f957a9ad105c2d7f9c6e56f34f4de
Author: G. Branden Robinson <[email protected]>
AuthorDate: Mon Sep 28 10:20:55 2026 -0500
[pre-grohtml]: Regression-test Savannah #68688.
* src/preproc/html/tests/does-not-defeat-safer-mode.sh: Do it.
* src/preproc/html/html.am (pre_grohtml_TESTS): Run test.
(TESTS, EXTRA_DIST): Wire `pre_grohtml_TESTS` into Automake test
harness and ship this and any future pre-grohtml test scripts.
Test fails at this commit.
---
ChangeLog | 9 +++
src/preproc/html/html.am | 5 ++
.../html/tests/does-not-defeat-safer-mode.sh | 69 ++++++++++++++++++++++
3 files changed, 83 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 2f6d16a52..41a93aaa3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2026-09-28 G. Branden Robinson <[email protected]>
+
+ [pre-grohtml]: Regression-test Savannah #68688.
+
+ * src/preproc/html/tests/does-not-defeat-safer-mode.sh: Do it.
+ * src/preproc/html/html.am (pre_grohtml_TESTS): Run test.
+ (TESTS, EXTRA_DIST): Wire `pre_grohtml_TESTS` into Automake test
+ harness and ship this and any future pre-grohtml test scripts.
+
2026-09-23 Deri James <[email protected]>
[pdfmom]: Fix Savannah #68687.
diff --git a/src/preproc/html/html.am b/src/preproc/html/html.am
index e928aafa4..0e14a1e80 100644
--- a/src/preproc/html/html.am
+++ b/src/preproc/html/html.am
@@ -22,6 +22,11 @@ pre_grohtml_SOURCES = \
src/preproc/html/pushback.h
src/preproc/html/pre-html.$(OBJEXT): defs.h
+pre_grohtml_TESTS = \
+ src/preproc/html/tests/does-not-defeat-safer-mode.sh
+TESTS += $(pre_grohtml_TESTS)
+EXTRA_DIST += $(pre_grohtml_TESTS)
+
# Local Variables:
# fill-column: 72
# mode: makefile-automake
diff --git a/src/preproc/html/tests/does-not-defeat-safer-mode.sh
b/src/preproc/html/tests/does-not-defeat-safer-mode.sh
new file mode 100755
index 000000000..8a6525ea7
--- /dev/null
+++ b/src/preproc/html/tests/does-not-defeat-safer-mode.sh
@@ -0,0 +1,69 @@
+#!/bin/sh
+#
+# Copyright 2026 G. Branden Robinson
+#
+# groff is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# groff is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+groff="${abs_top_builddir:-.}/test-groff"
+
+# Regression-test Savannah #68688.
+#
+# pre-grohtml should not permit defeat of troff's "safer mode".
+
+sandbox_dir=$(mktemp -d)
+if [ $? -ne 0 ]
+then
+ echo "cannot create temporary directory; skipping" >&2
+ exit 77 # skip
+fi
+
+# This method is based on a reproducer by Pavol Sloboda.
+
+oops_file="$sandbox_dir"/oops
+
+# Use of pic(1) does not trip the problem. Using either tbl(1) or
+# eqn(1) does, so exercise both.
+input='.
+text line 1
+.TS
+L.
+table cell
+.TE
+.sp
+.EQ
+x = 1
+.EN
+\O[5inonexistent.png;id>'"$oops_file"']
+\O[4]
+.br
+text line 2
+\O[3]\O[2]
+.'
+
+printf "%s\n" "$input" | "$groff" -et -T html > /dev/null
+
+if ! test -f "$oops_file"
+then
+ rmdir "$sandbox_dir"
+ # This removal is nasty, but forced upon us by grohtml's own
+ # nastiness in using '<img>' elements and relative paths. Employing
+ # a Base64 data URI would be better...and _much_ more robust.
+ # <img src="data:image/png;base64,ABCDEFGHIJK...">
+ rm -f grohtml-*-3.png
+else
+ echo "test failed; file left in \"$oops_file\"" >&2
+ exit 1
+fi
+
+# vim:set autoindent expandtab shiftwidth=4 tabstop=4 textwidth=72:
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit