gbranden pushed a commit to branch master
in repository groff.

commit 3fb566fdcc847c77fce57b23d0a1942203dfec57
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri Jan 30 18:51:33 2026 -0600

    [troff]: Fix Savannah #67990.
    
    * src/roff/troff/input.cpp (token::description): Fix assertion failures
      (potential and actual) by supplying descriptions even of internally
      generated token types.  While a user _should_ never be exposed to
      these in a diagnostic message, the event is not impossible (and said
      descriptions could be helpful to groff developers in tracking down the
      "impossible" situation).
    
    Fixes <https://savannah.gnu.org/bugs/?67990>.  Thanks to Deri James for
    the report.
---
 ChangeLog                | 12 ++++++++++++
 src/roff/troff/input.cpp | 13 +++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index f6d1ee9ec..41068619a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2026-01-31  G. Branden Robinson <[email protected]>
+
+       * src/roff/troff/input.cpp (token::description): Fix assertion
+       failures (potential and actual) by supplying descriptions even
+       of internally generated token types.  While a user _should_
+       never be exposed to these in a diagnostic message, the event is
+       not impossible (and said descriptions could be helpful to groff
+       developers in tracking down the "impossible" situation).
+
+       Fixes <https://savannah.gnu.org/bugs/?67990>.  Thanks to Deri
+       James for the report.
+
 2026-01-29  G. Branden Robinson <[email protected]>
 
        * src/devices/grodvi/grodvi.1.man (FT):
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 944f9bcd9..1fe5b1631 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -3103,6 +3103,19 @@ const char *token::description()
     return "an escaped ':'";
   case TOKEN_EOF:
     return "end of input";
+  // troff generates the following token types internally; the input
+  // can't (directly), so seeing them described likely suggests a bug in
+  // the formatter.  We consequently don't attempt to make their
+  // descriptions intelligible to the novice.
+  case TOKEN_BEGIN_TRAP:
+    return "a \"begin trap\" token";
+  case TOKEN_END_TRAP:
+    return "an \"end trap\" token";
+  // TOKEN_NODE is handled above
+  case TOKEN_PAGE_EJECTOR:
+    return "a \"page ejector\" token";
+  case TOKEN_REQUEST:
+    return "a \"request\" token";
   default:
     assert(0 == "unhandled case of `type` (token)");
     return "an undescribed token";

_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to