gbranden pushed a commit to branch master in repository groff. commit 5b5d3d5531d15770fc1316c66ea119f87ccefd61 Author: G. Branden Robinson <g.branden.robin...@gmail.com> AuthorDate: Fri Jul 11 08:21:15 2025 -0500
[pic]: Stop validating non-intepreted input. ...for character codes acceptable to GNU troff. * src/preproc/eqn/main.cpp (top_input::get, top_input::peek, do_file): Stop diagnosing errors on and discarding GNU troff-invalid input characters in portions of the input that are passed through without alteration. pic, like eqn, grn, refer, soelim, and tbl, is a _filter_. Its job is to transform only _part_ of its input stream and leave the rest unaltered. * src/preproc/pic/tests/passes-through-input-with-eighth-bit-set.sh: Add test. * src/preproc/pic/pic.am (pic_TESTS): Run test. Continues fixing Savannah #67285. --- ChangeLog | 18 +++++++++++++ src/preproc/pic/main.cpp | 14 ---------- src/preproc/pic/pic.am | 1 + .../passes-through-input-with-eighth-bit-set.sh | 30 ++++++++++++++++++++++ 4 files changed, 49 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 01b8d7487..b082f050b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2025-07-11 G. Branden Robinson <g.branden.robin...@gmail.com> + + [pic]: Stop validating non-intepreted input for character codes + acceptable to GNU troff. + + * src/preproc/eqn/main.cpp (top_input::get, top_input::peek) + (do_file): Stop diagnosing errors on and discarding GNU + troff-invalid input characters in portions of the input that are + passed through without alteration. pic, like eqn, grn, refer, + soelim, and tbl, is a _filter_. Its job is to transform only + _part_ of its input stream and leave the rest unaltered. + + * src/preproc/pic/tests/\ + passes-through-input-with-eighth-bit-set.sh: Add test. + * src/preproc/pic/pic.am (pic_TESTS): Run test. + + Continues fixing Savannah #67285. + 2025-07-11 G. Branden Robinson <g.branden.robin...@gmail.com> * src/utils/addftinfo/addftinfo.cpp: Fix code style nits. Give diff --git a/src/preproc/pic/main.cpp b/src/preproc/pic/main.cpp index 923c838c2..0e66f34d6 100644 --- a/src/preproc/pic/main.cpp +++ b/src/preproc/pic/main.cpp @@ -96,11 +96,6 @@ int top_input::get() return c; } int c = getc(fp); - while (is_invalid_input_char(c)) { - error("invalid input character code %1", c); - c = getc(fp); - bol = 0; - } if (bol && c == '.') { c = getc(fp); if (c == 'P') { @@ -169,11 +164,6 @@ int top_input::peek() if (push_back[0] != EOF) return push_back[0]; int c = getc(fp); - while (is_invalid_input_char(c)) { - error("invalid input character code %1", c); - c = getc(fp); - bol = 0; - } if (bol && c == '.') { c = getc(fp); if (c == 'P') { @@ -338,10 +328,6 @@ void do_file(const char *filename) = START; for (;;) { int c = getc(fp); - while (is_invalid_input_char(c)) { - error("invalid input character code %1", c); - c = getc(fp); - } if (c == EOF) break; switch (state) { diff --git a/src/preproc/pic/pic.am b/src/preproc/pic/pic.am index 421ab7f1e..79682f2db 100644 --- a/src/preproc/pic/pic.am +++ b/src/preproc/pic/pic.am @@ -48,6 +48,7 @@ EXTRA_DIST += \ src/preproc/pic/pic-lex.$(OBJEXT): src/preproc/pic/pic.hpp pic_TESTS = \ + src/preproc/pic/tests/passes-through-input-with-eighth-bit-set.sh \ src/preproc/pic/tests/polygon-command-works.sh TESTS += $(pic_TESTS) EXTRA_DIST += $(pic_TESTS) diff --git a/src/preproc/pic/tests/passes-through-input-with-eighth-bit-set.sh b/src/preproc/pic/tests/passes-through-input-with-eighth-bit-set.sh new file mode 100755 index 000000000..e6c74c489 --- /dev/null +++ b/src/preproc/pic/tests/passes-through-input-with-eighth-bit-set.sh @@ -0,0 +1,30 @@ +#!/bin/sh +# +# Copyright (C) 2025 Free Software Foundation, Inc. +# +# This file is part of groff. +# +# 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/>. +# + +pic="${abs_top_builddir:-.}/pic" + +# pic should not strip "invalid" characters from parts of a document it +# does not interpret. + +output=$(printf '.\\" degree sign: \313\232\n' | "$pic") +printf "%s\n" "$output" +printf "%s\n" "$output" | od -c | grep -q ' 232' + +# vim:set ai et sw=4 ts=4 tw=72: _______________________________________________ groff-commit mailing list groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit