bugGNU roff - Bugs: bug #64466, [ms] poorly diagnosed diversion...

 
 

bug #64466: [ms] poorly diagnosed diversion error

Submitter:  Dave <barx>
Submitted:  Mon 24 Jul 2023 02:27:01 PM UTC
   
 
Category:  Macro ms Severity:  2 - Minor
Item Group:  Warning/Suspicious behaviour Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 04 Aug 2023 07:11:40 PM UTC, comment #1: 

original submission:

> There was no follow-up on the list, and while the error text has improved a bit since 1.20.1, the second error is still not as helpful as the first, and it seems (says someone who has never looked at the ms code) a simple enough condition to detect earlier (presuming .KS can't legally nest).


It apparently can.


$ cat EXPERIMENTS/nested-keep.ms
.pl 20v
.LP
Hello!
.KS
This my keep.
.KS
Now I'm nesting.
.nf
I'm gonna put a bunch of lines on the output to force a page break.
.nr i 0 1
.while (\n[i] < 20) \n+[i]
.KE
How is this working out?
.KE
Are we okay?
$ nroff -ms EXPERIMENTS/nested-keep.ms|cat -s

Hello!

                               ‐2‐

This my keep.

                               ‐3‐

Now I’m nesting.
I’m gonna put a bunch of lines on the output to force a page break.
1
2
3
4
5
6

                               ‐4‐

7
8
9
10
11
12
13
14

                               ‐5‐

15
16
17
18
19
20
How is this working out?
Are we okay?

                               ‐6‐


Also, there is more than one cause of diversions.  They're used for cover sheet information and footnotes, too.  So when I revised the diagnostic messages I found it difficult to improve on the (new) status quo.

https://git.savannah.gnu.org/cgit/groff.git/commit/?id=c7b14cb8f84b102dd591843a4e7fc2fbfe2a25a3

> Reordering the lines has a similar effect to the one Doug observed:


> $ sed -n '1p; 2h; 3{p;g;p}; 4p' test.ms | groff -ms > /dev/null
> s.tmac: error: diversion open while ejecting page (last file seen: <standard input>) (recovering)


G. Branden Robinson <gbranden>
Group administrator
Mon 24 Jul 2023 02:27:01 PM UTC, original submission:  

Reported by Doug McIlroy, some time ago (http://lists.gnu.org/r/bug-groff/2011-03/msg00012.html).

$ cat test.ms
.LP
.KS
.KF
.KE
$ groff -ms test.ms > /dev/null
s.tmac:test.ms:3: error: .KF while diversion open (recovering)
$ sed s/KF/KS/ test.ms | groff -ms > /dev/null
s.tmac: error: diversion open while ejecting page (last file seen: <standard input>) (recovering)

There was no follow-up on the list, and while the error text has improved a bit since 1.20.1, the second error is still not as helpful as the first, and it seems (says someone who has never looked at the ms code) a simple enough condition to detect earlier (presuming .KS can't legally nest).

Reordering the lines has a similar effect to the one Doug observed:

$ sed -n '1p; 2h; 3{p;g;p}; 4p' test.ms | groff -ms > /dev/null
s.tmac: error: diversion open while ejecting page (last file seen: <standard input>) (recovering)


Dave <barx>
Group Member

 

(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 (Posted a comment)
  • -email is unavailable- added by barx (Submitted the item)
  • -email is unavailable- added by barx (original reporter)
  •  

    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
    2023-07-24 barx Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code