bugGNU troff - Bugs: bug #55155, .tr is overzealous in nroff output

 
 

bug #55155: .tr is overzealous in nroff output

Submitted by:  Dave <barx>
Submitted on:  Mon 03 Dec 2018 05:50:22 PM UTC  
 
Category:  Device - others Severity:  3 - Normal
Item Group:  Incorrect behaviour Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open Planned Release:  None

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Tue 04 Dec 2018 11:03:25 AM UTC, comment #3: 

(That should read "commit babca15fa2d3f5ec1dd7214e31e1efc42759c220" -- copy/paste error)

Dave <barx>
Tue 04 Dec 2018 04:25:44 AM UTC, comment #2: 

It turns out commit babca15fa2d3f5ec1dd7214e31e1efc42759c220vax solved this specific instance of the problem by changing how nroff displays a dagger symbol.  So the examples below do not fail in the manner described using the latest groff code and .tmac files.

But the general problem -- that .tr sometimes changes characters that don't actually appear in input -- remains.  Using the latest tmac/tty-char.tmac, for instance, you can get the result:

$ printf '.tr n-\nA \[if] B\n' | nroff | head -1
A <i-fi-ity> B

.tr should only change n's that appear in input, not ones that appear only in output, and especially not ones part of a predefined symbol.

Dave <barx>
Mon 03 Dec 2018 06:04:14 PM UTC, comment #1: 

UGH, this bug tracker is so broken.  I have no idea why it munged the output of those od commands.  At least the code is unmolested, so you can generate the correct output on your own system.

Dave <barx>
Mon 03 Dec 2018 05:50:22 PM UTC, original submission:  

$ printf 'A \[dg] B\n' | nroff | od -t x1z | head -1

              1. 41 20 7c 08 2d 20 42 0a 0a 0a 0a 0a 0a 0a 0a 0a  >A |.- B.........<

This shows that nroff outputs the dagger character as 7C 08 2D -- that is, a vertical bar, a backspace, and a hyphen -- a perfectly reasonable facsimile of a dagger in ASCII characters.

Now add a .tr request at the start of the file to change vertical bars in input to the letter O:

$ printf '.tr |O\nA \[dg] B\n' | nroff | od -t x1z | head -1

              1. 41 20 4f 08 2d 20 42 0a 0a 0a 0a 0a 0a 0a 0a 0a  >A O.- B.........<

Now the dagger is represented by 4F 08 2D (capital O, backspace, hyphen -- not at all a reasonable dagger construction).  The .tr is modifying not just vertical bars in the input (which is its documented function: "the first argument of `tr' should be an input character or entity") but a vertical bar that was part of the way nroff built the dagger.  It's difficult to imagine a situation in which this would be desirable.

Dave <barx>

 

(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 (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    No changes have been made to this item

    Back to the top


    Powered by Savane 3.5