bugGNU roff - Bugs: bug #63197, [tmac] missing backslashes in...

 
 

bug #63197: [tmac] missing backslashes in conditional blocks

Submitter:  Bjarni Ingi Gislason <bjarniig>
Submitted:  Mon 10 Oct 2022 08:47:48 PM UTC
   
 
Category:  General Severity:  3 - Normal
Item Group:  Warning/Suspicious behaviour Status:  Fixed
Privacy:  Public Assigned to:  gbranden
Open/Closed:  Closed Planned Release:  1.23.0
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 16 Nov 2022 05:51:54 PM UTC, comment #5: 

Revising summary.

In


.if \n[AB] \{\
.  bp
.  ft R
.\}


`\n[AB]` is the conditional expression.  The brace escape sequences and the input between them is the conditional block.

G. Branden Robinson <gbranden>
Group administrator
Sat 05 Nov 2022 02:12:21 PM UTC, comment #4: 

Additionally, commit 022e246b fixed the contrib/mom/om.tmac instance and commit c6360c15 the contrib/sboxes/sboxes.tmac one.

Dave <barx>
Group Member
Mon 24 Oct 2022 02:29:25 AM UTC, comment #3: 


commit f35dcc992c1852802347d1758588c1862808d9b9
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
Date:   Sun Oct 23 13:56:08 2022 -0500

    [man, ms]: Fix Savannah #63197.

    * tmac/an.tmac:
    * tmac/s.tmac: Escape newlines when opening conditional blocks.

    Fixes <https://savannah.gnu.org/?63197>.  Thanks to Bjarni Ingi Gislason
    for the report and Dave Kemper for the quick fix.

    Problems introduced by me in commits d56382d8ff, 2021-05-19; d576e17aa9,
    2021-05-08 (man); and 1887bbe68c, 2021-11-05 (ms).


G. Branden Robinson <gbranden>
Group administrator
Sun 23 Oct 2022 06:40:33 PM UTC, comment #2: 

Looping in Peter on this ticket.

There's one occurrence of a missing backslash after \{ in mom.

I'll fix this with the others, all of which I think I introduced.


diff --git a/contrib/mom/om.tmac b/contrib/mom/om.tmac
index b36129ece..83a23cafe 100644
--- a/contrib/mom/om.tmac
+++ b/contrib/mom/om.tmac
@@ -8725,7 +8725,7 @@ Shimming must be disabled with NO_SHIM before using FLEX.
 .       nr #DOC_COVER_BLANKPAGE 1
 .       nr #COVER_BLANKPAGE 1
 .    \}
-.    el \{
+.    el \{\
 .       rr #FORCE_RECTO
 .       rr #DOC_COVER_BLANKPAGE
 .       rr #COVER_BLANKPAGE


Thanks for the handy one-liner Dave.  It's an improvement on the patch, so dropping the annotation.

G. Branden Robinson <gbranden>
Group administrator
Tue 11 Oct 2022 05:13:24 AM UTC, comment #1: 

It's straightforward to confirm that the six instances in the four files Bjarni identified are the only ones in the current git tree.

$ find . -type f -name \*.tmac -exec grep '\\{ *$' {} \; -print
.       ie \\n[ds*badarg] \{
./tmac/s.tmac
.if d an-msg \{
.if d an-msg \{
.if (\n[an-HF-length] > 1) \{
./tmac/an.tmac
.    el \{
./contrib/mom/om.tmac
.if !\n[GSBOX] \{
./contrib/sboxes/sboxes.tmac

They can also be fixed in a fell swoop with a variant on this command:

$ find . -type f -name \*.tmac -exec sed -i 's/\\{ *$/\\{\\/' {} \;

(Tested using GNU's "find" and "sed")

This might be a stretch of the [PATCH] label, but is arguably easier to apply than a conventional patch.

Dave <barx>
Group Member
Mon 10 Oct 2022 08:47:48 PM UTC, original submission:  

Subject: [tmac] missing backslashes in conditional expressions

  In ".if <anything>" and multi-line "anything", the first logical line
should (must?) contain text to be compatible with (some) other
implementations.

  See also bug #63075.

  Defective tmac files:

Input file is ./contrib/mom/om.tmac, case 1
Test nr. 17:

Add a backslash, if it is missing after \{ at the end of a line.

8728:.    el \{

#####

Input file is ./contrib/sboxes/sboxes.tmac, case 1
Test nr. 17:

Add a backslash, if it is missing after \{ at the end of a line.

61:.if !\n[GSBOX] \{

#####

Input file is ./tmac/an.tmac, case 1
Test nr. 17:

Add a backslash, if it is missing after \{ at the end of a line.

1300:.if d an-msg \{
1339:.if d an-msg \{
1358:.if (\n[an-HF-length] > 1) \{

#####

Input file is ./tmac/s.tmac, case 1
Test nr. 17:

Add a backslash, if it is missing after \{ at the end of a line.

1081:. ie \\n[ds*badarg] \{

#####

  Test file:

.pl 10v
.nr a 0
.ie a \{
a is \na
add a second line.
.sp
.el \{
a is \na
add a second line.
.\}
.
.sp 1v
With backslash
.sp 1v
.ie a \{\
a \na
add a second line.
.el \{\
a is \na
add a second line.
.\}


####

  Result from "test-nroff -b -ww":

troff: backtrace: file 'prof.missing.backslash':3
troff:prof.missing.backslash:3: warning: missing closing delimiter in
output comparison operator (got a newline)
troff: backtrace: file 'prof.missing.backslash':16
troff:prof.missing.backslash:16: warning: missing closing delimiter in
output comparison operator (got a newline)
a is 0 add a second line.


a is 0 add a second line.

With backslash

add a second line.  a is 0 add a second line.


####

  Result from "heirloom..."

add a second line.


a is 0 add a second line.

With backslash

a is 0 add a second line.


####


Bjarni Ingi Gislason <bjarniig>

 

(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 gbranden (mom package author)
  • -email is unavailable- added by barx (Posted a comment)
  • -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 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-11-16 gbranden Summary[tmac] missing backslashes in conditional expressions [tmac] missing backslashes in conditional blocks
    2022-10-24 gbranden StatusIn Progress Fixed
        Open/ClosedOpen Closed
        Planned ReleaseNone 1.23.0
    2022-10-23 gbranden StatusNone In Progress
        Assigned toNone gbranden
        Summary[PATCH] [tmac] missing backslashes in conditional expressions [tmac] missing backslashes in conditional expressions
    2022-10-23 gbranden Carbon-Copy- Added -email is unavailable-
    2022-10-11 barx Summary[tmac] missing backslashes in conditional expressions [PATCH] [tmac] missing backslashes in conditional expressions

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code