gbranden pushed a commit to branch master
in repository groff.
commit aedba9a6c0f0b9f3bdea5b272237da50888a9aec
Author: G. Branden Robinson <[email protected]>
AuthorDate: Wed Apr 1 04:13:02 2026 -0500
[troff]: Fix Savannah #68202 (2/2).
* src/roff/troff/env.cpp (add_hyphenation_exception_words_request):
Continue interpreting any arguments subsequent to an invalid one.
Doing so is more consistent with AT&T troff (tested: DWB 3.3, Plan 9
from User Space, Heirloom Doctools, Solaris). Convert diagnostic
emitted in this circumstance from an error to a warning in category
"char".
Fixes <https://savannah.gnu.org/bugs/?68202>. Problem appears to date
back to groff's birth.
---
ChangeLog | 13 +++++++++++++
src/roff/troff/env.cpp | 40 ++++++++++++++++++++++++++++------------
2 files changed, 41 insertions(+), 12 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 2c6a71e7f..ba2526219 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2026-04-01 G. Branden Robinson <[email protected]>
+
+ * src/roff/troff/env.cpp
+ (add_hyphenation_exception_words_request): Continue interpreting
+ any arguments subsequent to an invalid one. Doing so is more
+ consistent with AT&T troff (tested: DWB 3.3, Plan 9 from User
+ Space, Heirloom Doctools, Solaris). Convert diagnostic emitted
+ in this circumstance from an error to a warning in category
+ "char".
+
+ Fixes <https://savannah.gnu.org/bugs/?68202>. Problem appears
+ to date back to groff's birth.
+
2026-04-01 G. Branden Robinson <[email protected]>
[groff]: Regression-test Savannah #68202.
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index 75dc1d747..9ccdd7bdc 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -3898,28 +3898,44 @@ static void add_hyphenation_exception_words_request()
break;
int i = 0;
int npos = 0;
+ // Warn at most once per invalid word, not per request invocation.
+ bool is_word_valid = true;
+ bool was_warned = false;
while ((i < WORD_MAX)
&& !tok.is_space()
&& !tok.is_newline()
&& !tok.is_eof()) {
- charinfo *ci = tok.get_charinfo(true /* required */);
+ charinfo *ci = tok.get_charinfo(false /* required */);
if (0 /* nullptr */ == ci) {
- skip_line();
- return;
+ is_word_valid = false;
+ if (!was_warned) {
+ warning(WARN_CHAR, "skipping hyphenation exception word"
+ " containing %1", tok.description());
+ was_warned = true;
+ }
}
- tok.next();
- if (ci->get_ascii_code() == '-') {
- if (i > 0 && (npos == 0 || pos[npos - 1] != i))
- pos[npos++] = i;
+ if (is_word_valid) {
+ tok.next();
+ if (ci->get_ascii_code() == '-') {
+ if (i > 0 && (npos == 0 || pos[npos - 1] != i))
+ pos[npos++] = i;
+ }
+ else {
+ unsigned char c = ci->get_hyphenation_code();
+ if (0U == c)
+ break;
+ buf[i++] = c;
+ }
}
else {
- unsigned char c = ci->get_hyphenation_code();
- if (0U == c)
- break;
- buf[i++] = c;
+ do
+ tok.next();
+ while (!tok.is_space()
+ && !tok.is_newline()
+ && !tok.is_eof());
}
}
- if (i > 0) {
+ if (is_word_valid && (i > 0)) {
pos[npos] = 0;
buf[i] = '\0';
// C++03: new unsigned char[npos + 1]();
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit