gbranden pushed a commit to branch master
in repository groff.

commit 0cf605b9c22ce633b3c9d71641b76b344ad59507
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sat Oct 17 18:16:29 2026 -0500

    [troff]: `pnr` request advances past invalid args.
    
    * src/roff/troff/reg.cpp (print_register_request): If a request argument
      is an invalid identifier, skip over it instead of giving up on the
      control line.  Apart from maintaining a consistent symmetry with `rr`
      request behavior, if there's a troublesome `rr` control line (perhaps
      involving constructed register identifiers), this way you can
      duplicate the `rr` line, change `rr` to `pnr`, and isolate the
      troublesome argument(s) by its/their absence in the list.  (We don't
      report the names of invalid identifiers because we have defined no
      convention for encoding unprintable characters in this context.)
---
 ChangeLog              | 15 +++++++++++++++
 src/roff/troff/reg.cpp |  4 ++++
 2 files changed, 19 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 48b768539..62bd9c033 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2026-10-17  G. Branden Robinson <[email protected]>
+
+       [troff]: `pnr` request advances past invalid args.
+
+       * src/roff/troff/reg.cpp (print_register_request): If a request
+       argument is an invalid identifier, skip over it instead of
+       giving up on the control line.  Apart from maintaining a
+       consistent symmetry with `rr` request behavior, if there's a
+       troublesome `rr` control line (perhaps involving constructed
+       register identifiers), this way you can duplicate the `rr` line,
+       change `rr` to `pnr`, and isolate the troublesome argument(s) by
+       its/their absence in the list.  (We don't report the names of
+       invalid identifiers because we have defined no convention for
+       encoding unprintable characters in this context.)
+
 2026-10-17  G. Branden Robinson <[email protected]>
 
        [troff]: Fix Savannah #68791.
diff --git a/src/roff/troff/reg.cpp b/src/roff/troff/reg.cpp
index bd20f6b76..657884d19 100644
--- a/src/roff/troff/reg.cpp
+++ b/src/roff/troff/reg.cpp
@@ -628,6 +628,10 @@ static void print_register_request() // .pnr
   if (has_arg()) {
     do {
       identifier = read_identifier();
+      if (identifier.is_null()) {
+       skip_rest_of_argument();
+       continue;
+      }
       r = look_up_register(identifier, true /* suppress creation */);
       if (r != 0 /* nullptr */)
        dump_register(&identifier, r);

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

Reply via email to