bugGNU roff - Bugs: bug #54538, [hdtbl] hdmisc.tmac-u: macro...

 
 

bug #54538: [hdtbl] hdmisc.tmac-u: macro t*index emits "range" warning

Submitter:  Bjarni Ingi Gislason <bjarniig>
Submitted:  Sun 19 Aug 2018 07:44:32 PM UTC
   
 
Category:  Macro package - others/general Severity:  2 - Minor
Item Group:  Warning/Suspicious behaviour Status:  Fixed
Privacy:  Public Assigned to:  gbranden
Open/Closed:  Closed Planned Release:  1.24.0
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 07 Dec 2024 07:20:51 PM UTC, comment #4: 

I fixed this in a different way last month.


commit d82af36a7b86f2a92d178801f25a3921f661a839
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
Date:   Wed Nov 20 21:45:20 2024 -0600

    [hdtbl]: Make `-wall` clean.

    * contrib/hdtbl/hdmisc.tmac (t*index): Fix "range" warning: clamp
      substring extraction at length of string.

      (t*DI): Fix "tab" warnings: precede tab characters in macro calls with
      comment character.

    * contrib/hdtbl/hdtbl.tmac (ETC): Fix "range" warning: clamp line length
      at horizontal motion quantum the desired value is less.

    * contrib/hdtbl/hdtbl.am (HDTBLGROFF): Run groff with `-b` and `-wall`
      options.

    * contrib/hdtbl/examples/color_transitions.roff (ctab): When
      incrementing color channel value, cap it at "1f" to avoid "range"
      warning.

    * contrib/hdtbl/examples/common.roff (d2x): Fix "range" warning: clamp
      substring extraction at length of string.



G. Branden Robinson <gbranden>
Group administrator
Fri 28 Jul 2023 08:44:16 PM UTC, comment #3: 

comment #2:

> My patch was the result of adding "-b -ww" to "GROFFBIN" in
> "Makefile.am" to make the reported warnings superfluous.


In that case, I have concerns that the issues Ingo raised in comment 3 of bug #55044 apply here as well.

Without even minimal hdtbl input to demonstrate a misbehavior being corrected (especially given that there are no hdtbl regression tests among the numerous tests Branden has added throughout the groff tree in recent years), patching the code seems just as likely to create problems as to fix them.

Dave <barx>
Group Member
Sun 23 Jul 2023 04:59:18 PM UTC, comment #2: 

  My patch was the result of adding "-b -ww" to "GROFFBIN" in
"Makefile.am" to make the reported warnings superfluous.

Bjarni Ingi Gislason <bjarniig>
Sun 23 Jul 2023 12:31:46 AM UTC, comment #1: 

Commit f2f52b9a renamed contrib/hdtbl/hdmisc.tmac-u to contrib/hdtbl/hdmisc.tmac, so the given patch no longer applies as-is, but it does apply if the filename is manually edited.

However, it is unclear what bug the patch is supposed to fix.  Bjarni, can you provide a simple example input file that works incorrectly without the patch and correctly with it?

Dave <barx>
Group Member
Sun 19 Aug 2018 07:44:32 PM UTC, original submission:  


From cfb9555eaf69442a682b4e8f02b580e81c0d080d Mon Sep 17 00:00:00 2001
From: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Date: Sun, 19 Aug 2018 19:31:29 +0000
Subject: [PATCH] hdmisc.tmac-u: macro t*index: Fix the end value of a while
 loop

  Check if the second string is longer than the first one.

  The end value for the comparison of the strings is too large.

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
---
 contrib/hdtbl/hdmisc.tmac-u | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/contrib/hdtbl/hdmisc.tmac-u b/contrib/hdtbl/hdmisc.tmac-u
index 33111eb5..b001561f 100644
--- a/contrib/hdtbl/hdmisc.tmac-u
+++ b/contrib/hdtbl/hdmisc.tmac-u
@@ -158,7 +158,12 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 .  length $2 \\$2
 .  nr * 0-1 1
 .
-.  while (\\n+[*] < \\n[**]) \{\
+.  if \\n[$2]>\\n[**] \{\
+.    nr t*index 0
+.    return
+.  \}
+.
+.  while (\\n+[*] < (\\n[**]-\\n[$2]) ) \{\
 .    ds * \\$1\"
 .    substring * \\n[*] (\\n[*] + \\n[$2] - 1)
 .    \" The surrounding \? escapes emulate string comparison.
@@ -166,7 +171,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 .      break
 .  \}
 .
-.  ie (\\n[*] == \\n[**]) \
+.  ie (\\n[*] == (\\n[**]-\\n[$2]) ) \
 .    nr t*index 0
 .  el \
 .    nr t*index (\\n[*] + 1)
--
2.18.0


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 barx (Posted a comment)
  • -email is unavailable- added by bgarrigues (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
    2024-12-07 gbranden Summary[hdbtl] hdmisc.tmac-u: macro t*index emits &quot;range&quot; warning [hdtbl] hdmisc.tmac-u: macro t*index emits "range" warning
    2024-12-07 gbranden StatusNone Fixed
        Assigned toNone gbranden
        Open/ClosedOpen Closed
        Planned ReleaseNone 1.24.0
        Summary[PATCH] hdmisc.tmac-u: macro t*index: Fix the end value of a while loop [hdbtl] hdmisc.tmac-u: macro t*index emits "range" warning
    2023-07-28 barx StatusNeed Info None
    2023-07-23 barx StatusNone Need Info
    2018-11-26 bgarrigues Severity3 - Normal 2 - Minor
        Item GroupNone Warning/Suspicious behaviour

    Back to the top

    Powered by Savane 3.14-9aa3.
    Corresponding source code