URL:
  <https://savannah.gnu.org/bugs/?68667>

                 Summary: [mm] should accept scaling units in indentation
arguments to list-beginning macros, fixing 1.24 regression
                   Group: GNU roff
               Submitter: gbranden
               Submitted: Tue 01 Sep 2026 04:49:31 PM UTC
                Category: Macro package mm
                Severity: 4 - Important
              Item Group: Incorrect behaviour
                  Status: Confirmed
                 Privacy: Public
             Assigned to: gbranden
             Open/Closed: Open
         Discussion Lock: Unlocked
         Planned Release: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Tue 01 Sep 2026 04:49:31 PM UTC By: G. Branden Robinson <gbranden>
[https://lists.gnu.org/archive/html/groff/2026-09/msg00001.html Deri spotted a
bug in _groff mm_ 1.24.]

Here are excerpts of my analysis.


Here's the description of this GNU extension to DWB mm.

groff_mm(7):
     Except where noted, mm assumes that horizontal measurements are
     reckoned in ens (scaling unit n) and vertical ones in vees (scaling
     unit v).  groff mm permits use of non‐integral typographical points
     (scaling unit z).  Use explicit scaling units for clarity and
     predictable behavior.
...
     BVL [text‐indent [mark‐indent [1]]]
             Begin broken variable‐item (or “tagged”) list.  Each item
             should supply its own mark.  The line is always broken
             after the mark; contrast VL.  A text‐indent argument
             overrides register Pi; mark‐indent sets the distance from
             the indentation of the current list to the mark.  A third
             argument suppresses the vertical space that normally
             precedes each list item; see register Lsp.  Vertical space
             in the amount of Lsp precedes the list itself, but does not
             accumulate with pre‐item space when this list is nested in
             another.  BVL calls LB; use LI to declare list items, and
             LE to end the list.

However, that last sentence in the first quote reveals a problem, and
this is the bug you found.  I think traditionally, mm authors tend _not_
to specify units, since DWB mm inculcated a doctrine of "ens and vees
only".[1]

What we need here is to use groff's extended syntax for interpolating
numeric quanities with an "implied" scaling unit.

...

I've known that groff mm needed "porting" to use `(c;e)` in more places,
as Jörgen Hägg didn't exercise that operator (much?) initially, but I
wasn't aware of any specific places where leaving it out caused a
problem.

Now I am, so I'll fix it.

Changing one line of my input exhibit manifests the problem.

$ diff -u ATTIC/BVL-lists.mm ATTIC/BVL-lists-busted.mm
--- ATTIC/BVL-lists.mm  2026-09-01 09:54:38.159256301 -0500
+++ ATTIC/BVL-lists-busted.mm   2026-09-01 10:32:17.038845525 -0500
@@ -1,6 +1,6 @@
 .P
 Hello, world!
-.BVL 10
+.BVL 10n
 .LI alpha
 2 neutrons and 2 protons
 .LI beta
$ nroff -mm ATTIC/BVL-lists-busted.mm -z
troff:ATTIC/BVL-lists-busted.mm:4: warning [page 1, line 10]: cannot adjust 
line; overset by 180n
troff:ATTIC/BVL-lists-busted.mm:5: warning [page 1, line 11]: cannot adjust 
line; overset by 181n
troff:ATTIC/BVL-lists-busted.mm:5: warning [page 1, line 12]: cannot adjust 
line; overset by 188n
troff:ATTIC/BVL-lists-busted.mm:5: warning [page 1, line 13]: cannot adjust 
line; overset by 183n
troff:ATTIC/BVL-lists-busted.mm:5: warning [page 1, line 14]: cannot adjust 
line; overset by 181n
troff:ATTIC/BVL-lists-busted.mm:5: warning [page 1, line 15]: cannot adjust 
line; overset by 187n
troff:ATTIC/BVL-lists-busted.mm:6: warning [page 1, line 17]: cannot adjust 
line; overset by 180n
troff:ATTIC/BVL-lists-busted.mm:7: warning [page 1, line 18]: cannot adjust 
line; overset by 182n
troff:ATTIC/BVL-lists-busted.mm:7: warning [page 1, line 19]: cannot adjust 
line; overset by 188n
troff:ATTIC/BVL-lists-busted.mm:8: warning [page 1, line 21]: cannot adjust 
line; overset by 180n
troff:ATTIC/BVL-lists-busted.mm:9: warning [page 1, line 22]: cannot adjust 
line; overset by 181n
troff:ATTIC/BVL-lists-busted.mm:9: warning [page 1, line 23]: cannot adjust 
line; overset by 187n
troff:ATTIC/BVL-lists-busted.mm:10: warning [page 1, line 24]: cannot adjust 
line; overset by 187n
troff:ATTIC/BVL-lists-busted.mm:10: warning [page 1, line 25]: cannot adjust 
line; overset by 186n
troff:ATTIC/BVL-lists-busted.mm:10: warning [page 1, line 26]: cannot adjust 
line; overset by 189n
troff:ATTIC/BVL-lists-busted.mm:14: error: ignoring invalid numeric expression

containing character 'f'

Ingo's document manifests the same problem, and because older versions
of GNU troff did not diagnose garbage in numeric expressions, the
formatter did not assist him.

$ grep BVL eurobsdcon2018-mandoc.roff
.BVL 1c
.BVL 1cm
.BVL 1cm
.BVL 1cm
.BVL 1cm
.BVL 1cm
.BVL 1c
.BVL 1c
.BVL 1cm
$ echo '.nr a 10cm' | ~/groff-1.23.0/bin/nroff -ww 2>&1 | grep . \
  || echo NO DIAGNOSTIC
NO DIAGNOSTIC
$ echo '.nr a 10cm' | ~/groff-1.24.0/bin/nroff -ww 2>&1 | grep . \
  || echo NO DIAGNOSTIC
troff:<standard input>:1: warning: expected end of line or an auto-increment 
argument in register definition request; got character 'm'

I point out that no _behavior_ change arises from the above; in the
past, GNU troff behaved like AT&T troff and _silently_ stopped
interpreting a numeric expression as soon as it read a character that
was invalid therein.  Now, GNU troff diagnoses the invalid character if
the user enables warnings in category `number`.  That permits the user
to more readily infer the change of parser state that results.









    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?68667>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature

Reply via email to