bugGNU roff - Bugs: bug #62298, [eqn] handles complex matrix badly...

 
 

bug #62298: [eqn] handles complex matrix badly in nroff mode

Submitter:  G. Branden Robinson <gbranden>
Submitted:  Tue 12 Apr 2022 01:44:43 AM UTC
   
 
Category:  Preprocessor eqn Severity:  3 - Normal
Item Group:  Incorrect behaviour Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 12 Apr 2022 01:44:43 AM UTC, original submission:  

A long time ago, so long that I was still maintaining XFree86 for Debian, David Schmitt reported a problem with a Mesa GLU-related man page.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=192144

Colin Watson boiled things down to a pretty simple reproducer.


$ cat EXPERIMENTS/bad_matrix.roff
The generated matrix is
.sp
.ce
.EQ
left ( ~~ down 130 { matrix {
   ccol { {f over "aspect"} above 0 above 0 above 0 }
   ccol { 0 above f above 0 above 0 }
   ccol { 0 above 0 above {{"zFar" + "zNear"} over {"zNear" - "zFar"}} above -1 }
   ccol { 0 above 0 above {{2 * "zFar" * "zNear"} over {"zNear" - "zFar"}} above 0}
}}  ~~~ right )
.EN


The resulting conversation was not fruitful, with observations that groff's output was worse than AIX troff's, but that the latter was pretty badly damaged as well.

Nobody remarked on this at the time--perhaps our diagnostics have since gotten better--but contemporary groff suggests whence some of the problems may arise.


$ ./build/test-groff -Tutf8 -e EXPERIMENTS/bad_matrix.roff  | cat -s
troff:EXPERIMENTS/bad_matrix.roff:184: error: division by zero
troff:EXPERIMENTS/bad_matrix.roff:230: error: division by zero
The generated matrix is

               ⎝______ 0      0           0      ⎠
                   0   f      0           0
                   0   0 __________ _____________
                   0   0    −1            0


If we further turn on all warnings, we get this...


troff:EXPERIMENTS/bad_matrix.roff:185: warning: register '0temp' not defined


...which suggests to me that the evaluation of a numeric expression involving zero division cancelled the register definition in progress.

Nobody ever promised that nroff-mode eqn output was going to look good (as far as I can tell, eqn didn't even start getting written until typesetter roff was in development--there was just no point bothering with line printers and typewriters).  But if we can make eqn robust against zero divisors for itself--particularly in generating them for itself--and fall back to some sane value if a supposedly invariantly-existing temp register ends up missing, maybe we can produce output that sucks less for the above input.

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 (original reporter)
  • -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.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-04-12 gbranden Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code