bugGNU roff - Bugs: bug #63149, [troff] confusing diagnostic when...

 
 

bug #63149: [troff] confusing diagnostic when delete character in input

Submitter:  G. Branden Robinson <gbranden>
Submitted:  Tue 04 Oct 2022 02:16:06 AM UTC
   
 
Category:  Core Severity:  3 - Normal
Item Group:  Warning/Suspicious behaviour Status:  Fixed
Privacy:  Public Assigned to:  gbranden
Open/Closed:  Closed Planned Release:  1.23.0
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 06 Oct 2022 01:18:17 PM UTC, comment #2: 


commit 0c5e4b9d8b09434d6720e547e918d6205a64c4f7
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
Date:   Mon Oct 3 21:48:53 2022 -0500

    [troff]: Fix Savannah #63149.

    * src/roff/troff/reg.cpp (alter_format): Throw comprehensible diagnostic
      when input delete character encountered in register format.

    Fixes <https://savannah.gnu.org/bugs/?63149>.


G. Branden Robinson <gbranden>
Group administrator
Tue 04 Oct 2022 02:38:03 AM UTC, comment #1: 

A token type is not necessary, just a way to encode an input delete character, much as was done recently for no-break spaces and soft hyphens in commit f9fb11f662.


ff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 4797a9a55..0005cdaad 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -2405,11 +2405,15 @@ const char *token::description()
   case TOKEN_BACKSPACE:
     return "a backspace character";
   case TOKEN_CHAR:
-    buf[0] = '\'';
-    buf[1] = c;
-    buf[2] = '\'';
-    buf[3] = '\0';
-    return buf;
+    if (c == INPUT_DELETE)
+      return "a delete character";
+    else {
+      buf[0] = '\'';
+      buf[1] = c;
+      buf[2] = '\'';
+      buf[3] = '\0';
+      return buf;
+    }
   case TOKEN_DUMMY:
     return "an escaped '&'";
   case TOKEN_ESCAPE:
diff --git a/src/roff/troff/input.h b/src/roff/troff/input.h
index 5b1c88244..e78124f92 100644
--- a/src/roff/troff/input.h
+++ b/src/roff/troff/input.h
@@ -41,6 +41,8 @@ const int ESCAPE_e = 035;
 const int ESCAPE_PERCENT = 036;
 const int ESCAPE_SPACE = 037;

+const int INPUT_DELETE = 0177;
+
 const int TITLE_REQUEST = 0200;
 const int COPY_FILE_REQUEST = 0201;
 const int TRANSPARENT_FILE_REQUEST = 0202;
@@ -63,6 +65,8 @@ const int INPUT_SOFT_HYPHEN= 0255;

 #else /* IS_EBCDIC_HOST */

+const int INPUT_DELETE = 007;
+
 const int ESCAPE_QUESTION = 010;
 const int BEGIN_TRAP = 011;
 const int END_TRAP = 013;


G. Branden Robinson <gbranden>
Group administrator
Tue 04 Oct 2022 02:16:06 AM UTC, original submission:  

Problem observed in groff 1.22.4; probably goes back to the beginning.


$ printf '.af a \177\n' | groff -Tascii
troff: <standard input>:1: bad number register format (got '')


Those empty quotes don't tell us much.  In fact, in groff 1.22.4, if you omit the register format entirely, you get no diagnostic.


$ printf '.af a \n' | groff -Tascii 2>&1 | grep . || echo EMPTY
EMPTY


I propose to add a token type for this.



G. Branden Robinson <gbranden>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by gbranden (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-10-06 gbranden StatusIn Progress Fixed
        Open/ClosedOpen Closed
        Planned ReleaseNone 1.23.0

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code