Follow-up Comment #1, bug #68132 (group groff):

My list of grievances with the application of the character translation
feature to non-characters can be found in bug #68133.

I believe I have a fix for the reported problem.


$ groff --version | head -n 1
GNU groff version 1.24.0.58-023e
$ make
groff -ww -T pdf c0 c1 c2 c3 c4 c5 c6 ca > cref_v6.pdf
troff:c0:3: error: expected ordinary, special, or indexed character, got a
horizontal motion
troff:c0:3: error: cannot perform character translation to a horizontal
motion
troff:c2:428: error: expected ordinary, special, or indexed character, got a
horizontal motion
troff:c2:428: error: cannot perform character translation to a horizontal
motion
troff:c2:527: error: expected ordinary, special, or indexed character, got a
horizontal motion
troff:c2:527: error: cannot perform character translation to a horizontal
motion
troff:c3:62: warning: name 'a' not defined
troff:c5:574: error: expected ordinary, special, or indexed character, got a
horizontal motion
troff:c5:574: error: cannot perform character translation to a horizontal
motion
troff:ca:3: error: expected ordinary, special, or indexed character, got a
horizontal motion
troff:ca:3: error: cannot perform character translation to a horizontal
motion
troff:ca:115: warning: name 'to' not defined
troff:ca:182: error: a space character is not allowed in an escape sequence
argument
troff:ca:204: error: expected ordinary, special, or indexed character, got a
horizontal motion
troff:ca:204: error: cannot perform character translation to a horizontal
motion
troff:ca:221: error: expected ordinary, special, or indexed character, got a
horizontal motion
troff:ca:221: error: cannot perform character translation to a horizontal
motion


New diagnostics ("cannot perform").  No assertion failure, no core dump.

In the foregoing, I applied Clem's patch converting all instances of `.ti0`
(old-fashioned syntax) to `.ti 0` (portable syntax).

One can get by without that by using _groff_'s AT&T compatibility mode,
however that provokes a riot of other diagnostics relating to a
[https://www.gnu.org/software/groff/manual/groff.html.node/Compatibility-Mode.html#DOCF187
wart in AT&T _troff_ grammar] that Kernighan warned about in CSTR #54 (1992)
(and maybe CSTR #97 circa 1982--I can't remember) but did not correct.


$ make
groff -C -ww -T pdf c0 c1 c2 c3 c4 c5 c6 ca > cref_v6.pdf
troff:c0:3: error: expected ordinary, special, or indexed character, got a
horizontal motion
troff:c1:10: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c1:13: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c1:15: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c1:17: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c1:20: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c1:24: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c1:25: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c1:28: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c1:32: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c1:127: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c1:128: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c1:129: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c1:130: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c1:145: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c1:198: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c1:240: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c1:250: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c2:95: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c2:207: error: ambiguous type size in escape sequence; rewrite to use
'\s(14' or similar
troff:c2:207: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c2:209: error: ambiguous type size in escape sequence; rewrite to use
'\s(14' or similar
troff:c2:209: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c2:428: error: expected ordinary, special, or indexed character, got a
horizontal motion
troff:c2:527: error: expected ordinary, special, or indexed character, got a
horizontal motion
troff:c3:11: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c3:62: warning: name 'a' not defined
troff:c3:111: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c3:179: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c3:179: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c3:179: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c3:181: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c3:185: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c3:185: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c3:185: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c3:186: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c3:276: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c4:71: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c4:71: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c4:72: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c5:21: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c5:29: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c5:53: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c5:106: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c5:106: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c5:106: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c5:123: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c5:252: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c5:291: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c5:572: error: ambiguous type size in escape sequence; rewrite to use
'\s(14' or similar
troff:c5:572: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:c5:574: error: expected ordinary, special, or indexed character, got a
horizontal motion
troff:c6:352: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:3: error: expected ordinary, special, or indexed character, got a
horizontal motion
troff:ca:94: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:105: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:111: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:115: warning: name 'to' not defined
troff:ca:139: error: ambiguous type size in escape sequence; rewrite to use
'\s(14' or similar
troff:ca:139: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:156: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:182: error: a space character is not allowed in an escape sequence
argument
troff:ca:182: error: ambiguous type size in escape sequence; rewrite to use
'\s(14' or similar
troff:ca:182: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:204: error: expected ordinary, special, or indexed character, got a
horizontal motion
troff:ca:221: error: expected ordinary, special, or indexed character, got a
horizontal motion
troff:ca:229: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:266: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:292: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:292: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:292: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:335: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:339: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:352: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:356: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:356: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:356: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:365: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:401: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:401: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:402: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:402: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:410: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:411: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:427: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:429: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:433: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:437: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:450: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:450: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:455: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:455: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:456: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:456: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:461: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:461: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:464: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:464: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:467: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:467: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:469: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:470: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:472: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:476: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:476: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:477: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:481: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:482: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:484: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:485: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:495: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:496: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:498: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:502: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:505: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:508: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:511: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:513: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:515: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:516: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:519: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:519: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:521: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:523: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:534: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:535: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:538: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:538: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:542: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:542: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:552: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:553: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:555: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:555: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:558: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:558: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:561: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar
troff:ca:561: error: ambiguous type size in escape sequence; rewrite to use
'\s(10' or similar


Here's the patch.


$ git diff
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 1fe5b1631..22def984f 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -8594,10 +8594,16 @@ static void do_translate(bool transparently, bool
as_input)
       tok.next();
       continue;
     }
+    // The semantics of character translation operations on
+    // non-characters (space escape sequences) are ill-defined and vary
+    // among troffs; see Savannah #68133.  However, documents such as
+    // Ritchie's "C Reference Manual" distributed with Sixth Edition
+    // Unix did things like `.tr ^\|`, so some support must be retained.
     charinfo *ci1 = tok.get_charinfo(true /* required */);
     if (0 /* nullptr */ == ci1) {
-      assert(0 == "attempted to use token without charinfo in character"
-            " translation request");
+      if (!want_att_compat)
+       error("cannot perform character translation from %1",
+             tok.description());
       break;
     }
     tok.next();
@@ -8621,8 +8627,9 @@ static void do_translate(bool transparently, bool
as_input)
     else {
       charinfo *ci2 = tok.get_charinfo(true /* required */);
       if (0 /* nullptr */ == ci2) {
-       assert(0 == "attempted to use token without charinfo in"
-              " character translation request");
+       if (!want_att_compat)
+         error("cannot perform character translation to %1",
+               tok.description());
        break;
       }
       if (ci1 == ci2)




    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?68132>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature

Reply via email to