bugGNU roff - Bugs: bug #64105, [eqn] off-by-one error in line...

 
 

bug #64105: [eqn] off-by-one error in line numbering

Submitter:  G. Branden Robinson <gbranden>
Submitted:  Tue 25 Apr 2023 02:14:24 AM UTC
   
 
Category:  Preprocessor eqn Severity:  4 - Important
Item Group:  Incorrect behaviour Status:  None
Privacy:  Public Assigned to:  gbranden
Open/Closed:  Open Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 21 Nov 2023 09:10:34 PM UTC, comment #6: 

Doug McIlroy raised another couple of cases.

https://lists.gnu.org/archive/html/groff/2023-11/msg00059.html

Ensure those get fixed, too.

G. Branden Robinson <gbranden>
Group administrator
Tue 30 May 2023 06:57:59 PM UTC, comment #5: 

Err, well, maybe 75% of a regression.

"at line 4" says a true thing if you understand what the diagnostic is trying to say (that the delimiter on line 4 in unmatched at the end of input), but there is no line 5.


eqn:EXPERIMENTS/eqn-delimited-64105.roff:5: fatal error: unterminated '$' at line 4, looking for '$'


G. Branden Robinson <gbranden>
Group administrator
Tue 30 May 2023 06:55:04 PM UTC, comment #4: 

I found another case.  This is from groff Git HEAD.


$ nl EXPERIMENTS/eqn-delimited-64105.roff
     1  .EQ
     2  delim $$
     3  .EN
     4  foo bar $x = 1
$ ./build/eqn -Tascii EXPERIMENTS/eqn-delimited-64105.roff >/dev/null
./build/eqn:EXPERIMENTS/eqn-delimited-64105.roff:3: fatal error: unterminated inline equation; started with '$', expecting '$'
$ ./build/eqn -N -Tascii EXPERIMENTS/eqn-delimited-64105.roff >/dev/null
./build/eqn:EXPERIMENTS/eqn-delimited-64105.roff:3: error: unterminated inline equation; started with '$', expecting '$'


This is only partially a regression from 1.22.4, because that eqn got the number wrong the other way if `-N` wasn't specified.


$ eqn -Tascii EXPERIMENTS/eqn-delimited-64105.roff >/dev/null
eqn:EXPERIMENTS/eqn-delimited-64105.roff:5: fatal error: unterminated '$' at line 4, looking for '$'
$ eqn -N -Tascii EXPERIMENTS/eqn-delimited-64105.roff >/dev/null
eqn:EXPERIMENTS/eqn-delimited-64105.roff:4: missing '$'


G. Branden Robinson <gbranden>
Group administrator
Mon 08 May 2023 12:50:29 AM UTC, comment #3: 

Kicking up to Important severity because this is a regression from groff 1.22.4.

(This is mainly me being a stickler: likely few users of valid and un-diagnosed eqn documents bothered to audit the line numbers within, whereas they are much more likely to have noticed bug #63299.)

G. Branden Robinson <gbranden>
Group administrator
Sun 07 May 2023 04:17:25 AM UTC, comment #2: 
G. Branden Robinson <gbranden>
Group administrator
Sun 30 Apr 2023 11:35:04 AM UTC, comment #1: 

I have a fix in my working copy, with further regression tests.


commit 254befbbde98b0b55e6521ae5a159f2733835b46
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
Date:   Sun Apr 30 06:06:51 2023 -0500

    [eqn]: Fix Savannah #64105.

    * src/preproc/eqn/main.cpp (do_file): Increment the line number if a
      malformed `lf` request was encountered, instead of decrementing it if
      a valid one was.  Increment it when processing an end eqn macro call
      (".EN"), not just a start one.  Drop an incrementation of the line
      number that applied too generally.

    This ensures we don't throw the line numbers off in normal input
    processing.  Fixes a problem introduced by me in commit dc98a8b09e, 31
    October.

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

commit e185954f414bbf85c53146215b2e3e4b6daf3470
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
Date:   Sun Apr 30 06:03:08 2023 -0500

    [eqn]: Improve tests of line number accuracy.

    * src/preproc/eqn/tests/diagnostics-report-correct-line-numbers.sh: Add
      cases to check behavior of valid input, not just error cases.

    Test fails at this commit.


G. Branden Robinson <gbranden>
Group administrator
Tue 25 Apr 2023 02:14:24 AM UTC, original submission:  

This is a regression from groff 1.22.4.

Input:


$ cat EXPERIMENTS/line-number-when-no-eqn-output.roff
.nf
2=\n(.c
.EQ
delim $$
.EN
6=\n(.c
.pl \n(nlu


groff 1.22.4 output:


$ eqn -Tascii EXPERIMENTS/line-number-when-no-eqn-output.roff | groff -Tascii
2=2
6=6


groff Git HEAD output:


$ ./build/eqn -Tascii EXPERIMENTS/line-number-when-no-eqn-output.roff | ./build/test-groff -Tascii
2=2
6=5


The fix for bug #63299 last Halloween apparently needed more test cases.

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 (supplemental 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.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-11-21 gbranden Carbon-Copy- Added -email is unavailable-
    2023-08-10 gbranden StatusIn Progress None
    2023-05-30 gbranden StatusReady for Merge In Progress
    2023-05-08 gbranden Severity3 - Normal 4 - Important
    2023-05-07 gbranden StatusIn Progress Ready for Merge
    2023-04-29 gbranden StatusConfirmed In Progress
        Assigned toNone gbranden

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code