bugGNU roff - Bugs: bug #49915, [me] don't trust interpolated...

 
 

bug #49915: [me] don't trust interpolated input not to clobber the previous type size

Submitter:  Bjarni Ingi Gislason <bjarniig>
Submitted:  Thu 22 Dec 2016 10:06:29 PM UTC
   
 
Category:  Macro me Severity:  3 - Normal
Item Group:  Incorrect behaviour Status:  Fixed
Privacy:  Public Assigned to:  carstenkunze
Open/Closed:  Closed Planned Release:  1.22.4
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 22 Jan 2022 12:43:40 PM UTC, comment #3: 

Nobody bothered to explain the original problem clearly, in my opinion (at least not in the ticket history--the mailing list may be another story).

Take the `sm` macro as it arrived from BSD (and as it remained through 4.4).


.de sm                        \" *** print in smaller font
\s-1\\$1\\s0\\$2
..


Consider the following input document.


.pp
Hello,
.sm W\s(36OR\s0ld.
Learn C today!


At what type size will "Learn C today!" render?

The input can still have unbalanced type size changes, but those are more obviously the responsibility of the document author to correct.


commit 98058a8a4b3a63d3cf96662ac48a9b543d657479
Author: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Date:   Thu Feb 16 20:36:22 2017 +0100

    -me: Use \s±n after a var. string instead of \s0

    See https://savannah.gnu.org/bugs/?49915

commit a2c9f9c28e9439bd2c1fb156840692b53a9a0d22
Author: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Date:   Thu Feb 16 20:42:44 2017 +0100

    -me: Use \s±n after a var. string instead of \s0

    One line missed to be fixed in previous commit.


G. Branden Robinson <gbranden>
Group administrator
Fri 17 Feb 2017 06:31:27 PM UTC, comment #2: 

  Examples for "groff":

1) From gcc(1), which was generated by Pod::Man 2.28 (Pod::Simple 3.29)

.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
The 1998 \s-1ISO \*(C+\s0 standard

2) Same as 1) with me-macros

.\" Make letters bigger to see mismatch better
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.lp
.sz +4
The 1998
.sm "ISO \*(C+"
standard
.lp
.sz +4
The 1998 \*{ISO \*(C+\*} standard
.lp
.sz +4
The 1998 \*<ISO \*(C+\*> standard
.
.\" Better definiton of used e-macros to eliminate size errors
.de sm
\s-1\\$1\\s+1\\$2
..
.ds } \s+3\v'0.4m'
.ds > \s+3\v'-0.4m'
.\" End of new definitions
.
.lp
.sz +4
The 1998
.sm "ISO \*(C+"
standard
.lp
.sz +4
The 1998 \*{ISO \*(C+\*} standard
.lp
.sz +4
The 1998 \*<ISO \*(C+\*> standard


Bjarni Ingi Gislason <bjarniig>
Wed 15 Feb 2017 08:11:11 PM UTC, comment #1: 

Could you please provide a test document (as small as possible) for your bug reports (i.e., a document which uses -me macros)?

Carsten Kunze <carstenkunze>
Group Member
Thu 22 Dec 2016 10:06:29 PM UTC, original submission:  


  Use explicit \s±n after a variable string instead of \s0

  Example:

.ps 10
normal\s+2big\s+3bigger\s-3big_again\s0normal
.br
.ps 10
normal\s+2big\s+3bigger\s0big_again\s0normal

  Sizes are 10, 12, 15, 12, 15 and 10, 12, 15, 12 and 15.


  Patch:

--- /home/bg/git/groff/tmac/e.tmac-u        2016-12-22 18:20:01.000000000 +0000
+++ ./e.tmac-u        2016-12-22 20:41:02.000000000 +0000
@@ -1487,7 +1487,7 @@
 ..
 .
 .de sm                        \" *** print in smaller font
-\s-1\\$1\\s0\\$2
+\s-1\\$1\\s+1\\$2
 ..
 .
 .de @F                        \" --- change font (0 -> no change)
@@ -1940,13 +1940,13 @@
 .\" GNU pic sets this register to 1, to indicate that \x should not be used.
 .@R 0x
 .ds { \v'-0.4m'\x'\\n(0x=0*-0.2m'\s-3
-.ds } \s0\v'0.4m'
+.ds } \s+3\v'0.4m'
 .\" for compatibility with traditional -me
 .\" (the first will work only in compatibility mode)
 .ds [ \*{
 .ds ] \*}
 .ds < \v'0.4m'\x'\\n(0x=0*0.2m'\s-3
-.ds > \s0\v'-0.4m'
+.ds > \s+3\v'-0.4m'
 .ds - \(em
 .\" Avoid warnings from groff -ww.
 .@S |0


  Patch also put into the attachment

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 #39295:  e.tmac added by bjarniig (977B - application/octet-stream)

 

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 carstenkunze (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-01-22 gbranden CategoryNone Macro me
        Item GroupNone Incorrect behaviour
        StatusReady for Merge Fixed
        Summary Use explicit \s±n after a variable string instead of \s0 [me] don't trust interpolated input not to clobber the previous type size
    2017-04-29 carstenkunze Open/ClosedOpen Closed
    2017-02-16 carstenkunze StatusNone Ready for Merge
        Assigned toNone carstenkunze
        Planned ReleaseNone 1.22.4
    2016-12-22 bjarniig Attached File- Added e.tmac, #39295

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code