bugGNU roff - Bugs: bug #60803, tr request does not warn when it...

 
 

bug #60803: tr request does not warn when it can't translate an input space

Submitter:  G. Branden Robinson <gbranden>
Submitted:  Sun 20 Jun 2021 06:04:03 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
   

Wed 06 Jul 2022 07:46:34 PM UTC, comment #4: 


commit ab5d7f57b19db156f442a6855bd8bcf37662c560
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
Date:   Wed Jul 6 00:57:08 2022 -0500

    [troff]: Throw error when `tr`ing from a space.

    * src/roff/troff/input.cpp (do_translate): Throw an error diagnostic
      when the user attempts to translate space characters.  (By contrast,
      translating _to_ [unbreakable, unadjustable] spaces is an old troff
      hack often seen as ".tr ~ ", and largely superseded by groff's "\~"
      escape sequence, now widely supported by troffs.)

    Fixes <https://savannah.gnu.org/bugs/?60803>.  Thanks to T. Kurt Bond
    and Oliver Corff for the report.


G. Branden Robinson <gbranden>
Group administrator
Wed 06 Jul 2022 05:50:52 AM UTC, comment #3: 

I agree that a diagnostic would be useful for this.

I decided to make it an error, because there's no warning category well suited for it, and unlike with warnings there is no reasonable fallback behavior for what the user was trying to accomplish.


diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 758842972..c485b15a6 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -6982,6 +6982,7 @@ static void do_translate(int translate_transparent, int translate_input)
       translate_space_to_dummy = tok.is_dummy();
       if (tok.is_newline() || tok.is_eof())
        break;
+      error("cannot translate space character; ignoring");
       tok.next();
       continue;
     }


G. Branden Robinson <gbranden>
Group administrator
Sun 20 Jun 2021 09:48:12 AM UTC, comment #2: 

A warning would be helpful, but the restriction is documented in the Texinfo manual, which lists space and other characters after "The following characters can't be translated."

Bug #55154 also concerns issues with .tr and various space characters.

Dave <barx>
Group Member
Sun 20 Jun 2021 08:17:27 AM UTC, comment #1: 

It appears that the troff and nroff Heirloom Doctools both behave this way as well.

T. Kurt Bond <tkurtbond>
Sun 20 Jun 2021 06:04:03 AM UTC, original submission:  

T. Kurt Bond and Oliver Corff noted an oddity with .tr on the groff mailing list.

You can translate characters to space with .tr, but not from a space.  While this may make sense for a syntactical and/or typographical perspective, .tr is completely silent about this and it probably should not be.

"I fumbled with .tr after reading your mail and it seems how space is used as a delimiter in general input processing prohibits it from being recognized as a character which is recognized and accepted as an element of the input character set by .tr.

In contrary, normal characters can be converted to spaces by .tr--just consider the following example:


.tr n iI
This is a string.


I added the substitution pair iI in order a) to signal to .tr that the space is a valid input and b) in order to have quick check whether .tr works as expected with spaces in the chain of substitution pairs. It does."

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 barx (Posted a comment)
  • -email is unavailable- added by tkurtbond (Posted a comment)
  • -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 5 latest changes.

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

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code