bugGNU roff - Bugs: bug #55136, [ms] recover from .DS within .DS

 
 

bug #55136: [ms] recover from .DS within .DS

Submitter:  Bjarni Ingi Gislason <bjarniig>
Submitted:  Thu 29 Nov 2018 09:53:49 PM UTC
   
 
Category:  Macro ms Severity:  1 - Wish
Item Group:  Feature change Status:  Fixed
Privacy:  Public Assigned to:  gbranden
Open/Closed:  Closed Planned Release:  1.23.0
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 01 May 2021 10:34:59 AM UTC, comment #3: 


commit 78421dbbfd30c0451de93e4719b2c7ae2ac202fd
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
Date:   Sat May 1 02:01:45 2021 +1000

    [ms]: Diagnose, recover from nested diversions.

    * tmac/s.tmac (DS): Issue diagnostic and attempt recovery if document
      attempts to start a display within another display.

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


G. Branden Robinson <gbranden>
Group administrator
Fri 30 Apr 2021 03:43:12 PM UTC, comment #2: 

Bad news first:

1. I'm rejecting the patch.
2. The ms @fatal macro has been retired since this bug was filed, so it wouldn't work anyway.

The good news:

3. Checking for nested diversions is a good idea, and user-friendly.
4. The situation is recoverable, with no loss of text, and therefore we don't need a fatal diagnostic anyway as Bjarni suggested for such a scenario.
5. The recovery mechanism is already implemented and has been in place for years.
6. A one-line patch not only addresses the simple reproducing case reported in bug #55099, but it preserves groff ms's existing ability to have a display within a footnote within a display.
7. We fare much better than Heirloom Doctools ms in this regard; it discards the contents of all diversions in the stack, producing no diagnostic and exiting with a successful status.

I'm attaching some reproducers.  Here's the patch.


diff --git a/tmac/s.tmac b/tmac/s.tmac
index 01f92e62..9d617d4b 100644
--- a/tmac/s.tmac
+++ b/tmac/s.tmac
@@ -1013,6 +1013,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 .el .@error-recover mismatched .DE
 ..
 .de DS
+.if '\\n(.z'ds*div' .@error-recover cannot use .DS within a .DS
 .br
 .di ds*div
 .ie '\\$1'B' \{\


I'll do some more tests.

(file #51344, file #51345)

G. Branden Robinson <gbranden>
Group administrator
Mon 26 Oct 2020 11:18:01 AM UTC, comment #1: 

This patch may also address bug #55099.

Dave <barx>
Group Member
Thu 29 Nov 2018 09:53:49 PM UTC, original submission:  

From 8047d1a28f564663fe397839c305f3b5e03a21dc Mon Sep 17 00:00:00 2001
From: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Date: Thu, 29 Nov 2018 21:28:00 +0000
Subject: [PATCH] s.tmac: Check the closure of the .DS macro (display)

  If the display macro is not properly ended, its content doesn't go to
the output.

  Aborting is necessary to avoid missing pieces of text in the output.

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
---
 tmac/s.tmac | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tmac/s.tmac b/tmac/s.tmac
index 6dda23b7..5737dfd3 100644
--- a/tmac/s.tmac
+++ b/tmac/s.tmac
@@ -965,6 +965,14 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 .el .@error-recover \\$0: mismatched DE
 ..
 .de DS
+.\" Check if an earlier display has be closed with .DE
+.if r \\n[.ev]:ds-type \{
+. if !\\n[\\n[.ev]:ds-type]==0 \{\
+.\" "@warning" leaves the "display" empty
+. @fatal \\$0: New .DS used without closing a former one.
+. \}
+.\}
+.
 .br
 .di ds*div
 .ie '\\$1'B' \{\
--
2.19.2


Bjarni Ingi Gislason <bjarniig>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #51344:  ds-ds-de.ms added by gbranden (20B - text/x-troff-ms)
file #51345:  ds-ds-fn-de.ms added by gbranden (144B - text/x-troff-ms)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by gbranden (Updated the item)
  • -email is unavailable- added by bjarniig (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 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-05-01 gbranden StatusIn Progress Fixed
        Open/ClosedOpen Closed
        Planned ReleaseNone 1.23.0
    2021-04-30 barx Carbon-CopyRemoved 93119 -
    2021-04-30 gbranden Attached File- Added ds-ds-fn-de.ms, #51345
        Severity3 - Normal 1 - Wish
        StatusNone In Progress
        Assigned toNone gbranden
        Summary[PATCH] s.tmac: Check the closure of the .DS macro (display) [ms] recover from .DS within .DS
    2021-04-30 gbranden Attached File- Added ds-ds-de.ms, #51344

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code