groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tbl numeric overflow


From: G. Branden Robinson
Subject: Re: tbl numeric overflow
Date: Fri, 28 Apr 2023 02:14:03 -0500

Hi Peter,

At 2023-04-25T14:59:22-0400, Peter Schaffter wrote:
> This thread picks up from
>   Re: [mom] Extraneous empty line that starts a new page
> 
> I've built and installed 1.23.0.rc4.26-3aa8c and continue to get
> numeric overflow errors in documents that use tbl, starting with
> the second and continuing for all subsequent tables.  The output
> is clean despite the errors, which all originate from tbl's 3init
> macro.

Yup.

> When I switch out the newly installed /usr/local/bin/tbl for an
> older version of tbl (from 1.22.4), the error messages disappear.

Yup.

> I'm loathe to file a bug report at this time because you appear to
> be getting different results when processing with tbl, i.e. you are
> not seeing the error messages.

But I am now--maybe I was before and didn't notice, overlooking them in
the flood of output generated by the barracks inspector.

> Given that an older version of tbl does not report any errors, it
> would seem the problem is with tbl in 1.23.0.rc4, however I wouldn't
> bet the farm on it.

You are right.  The problem is simple and originates in a commit I made
a couple of years ago.

commit cee547e8839a82f8b21b2859a9370fd74f9793f3
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
Date:   Sat Jan 30 08:13:43 2021 +1100

    [tbl]: Save and restore hyphenation parameters.

    * src/preproc/tbl/table.cpp (table::init_output): When starting a
      table, save the hyphenation parameters (\n[.hy], \n[.hla],
      \n[.hlm], \n[.hym], \n[.hys]).  Restore them in the table reset
      macro (confusingly called "3init"), which is called before
      performing each diversion and before exiting a table.

      This enables people to, e.g., turn off hyphenation in a table text
      block with .nh, just as they can turn off adjustment with .na,
      without having to manually reset it.  The next text block, and the
      material after the table, will not be affected.

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

Looking at the diff:

+        ".hym \\\\n[" SAVED_HYPHENATION_MARGIN_REG "]\n"
+        ".hys \\\\n[" SAVED_HYPHENATION_SPACE_REG "]\n"

There's my problem, right there.  I'm not supplying a scaling unit of
'u'; the default for these requests is 'm'.

I suspect no one ever noticed this before because (1) no other macro
package actually exercises this feature and (2) you have to use more
than one tbl(1) table in a mom(7) document before it rears its head.

Here's sample output from my debugging exhibit (attached).

$ ./build/test-groff -t -mom -z ATTIC/frederic3.mom
GBR1: hym=0, hys=0
GBR2: hym=36000, hys=1000
gropdf-info:href tbl:1
GBR3: hym=504000000, hys=14000000
gropdf-info:href tbl:2
troff:ATTIC/frederic3.mom:57: error: numeric overflow
troff:ATTIC/frederic3.mom:57: error: numeric overflow

Pretty easy to see where those values were headed.

Will fix.

Also find attached a small reproducer.  I'll be turning this into a
regression test.

Regards,
Branden

Attachment: frederic3.mom
Description: Text document

Attachment: hym-and-hys.roff
Description: Text Data

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]