bugGNU roff - Bugs: bug #51608, [PATCH] [mom] undefined...

 
 

bug #51608: [PATCH] [mom] undefined register/macro warnings

Submitter:  Bjarni Ingi Gislason <bjarniig>
Submitted:  Fri 28 Jul 2017 09:38:08 PM UTC
   
 
Category:  Macro mom Severity:  3 - Normal
Item Group:  Warning/Suspicious behaviour Status:  Fixed
Privacy:  Public Assigned to:  PTPi
Open/Closed:  Closed Planned Release:  1.22.4
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sat 22 Jan 2022 07:24:38 AM UTC, comment #8: 


commit ee9d8f5360232030f593d54d2e87db78afa1e004
Author: Peter Schaffter <peter@schaffter.ca>
Date:   Fri Nov 3 13:11:36 2017 -0400

    Fix DO_QUOTE not restting page offset when called within a float.

    Macro _STYLE: add check for $HDR_FTR string length <=5 before
    grabbing substring.

    Fixed position of aliases that were being created prior to their
    macro definitions.

    Add missing backslash to \n[#EN_Q_AUTOLEAD] in macro QUOTE.

    Defined END as a blank macro to prevent groff warning.


G. Branden Robinson <gbranden>
Group administrator
Fri 03 Nov 2017 05:22:38 PM UTC, comment #7: 

Thanks, Bjarni.  I see what's causing the warnings.

All the undefnined macro warnings except END and BREAK_QUOTE are the result of aliases preceding the definition of the macros being aliased.

END is not a macro, but rather a macro closure argument (second argument to MAC, which is an alias of .de) used throughout.  groff shouldn't be treating it as an undefined macro.  Since it is, defining it as a blank macro is the only way to remove the warning.

BREAK_QUOTE is not used any more.

The undefined register #EN_Q_AUTOLEAD is the result of a missing backslash.

Rather than apply your patch, I've moved alias definitions to their correct locations, removed the aliases of BREAK_QUOTE, fixed the missing backslash, and defined END near the top of the file.  I'll push the changes later today (2017-11-03) and mark this bug Fixed.

Peter Schaffter <PTPi>
Group Member
Fri 03 Nov 2017 03:59:54 AM UTC, comment #6: 


  The undefined entities I named in my patch can be seen by executing
"test-groff -ww -mpdf om.tmac"

om.tmac:219: warning: macro `END' not defined
om.tmac:2686: warning: macro `PDF_LINK_COLOR' not defined
om.tmac:2687: warning: macro `AUTO_RELOCATE_TOC' not defined
om.tmac:8805: warning: number register `#EN_Q_AUTOLEAD' not defined
om.tmac:13081: warning: macro `BREAK_QUOTE' not defined
om.tmac:13082: warning: macro `BREAK_QUOTE' not defined
om.tmac:13083: warning: macro `BREAK_QUOTE' not defined
om.tmac:13099: warning: macro `INDENT_REFS' not defined

  The register PDFHREF.VIEW.LEADING is not here, so it is defined in
"pdf.tmac".

  The macros END and BREAK_QUOTE are never defined.

  The macros, registers PDF_LINK_COLOR, AUTO_RELOCATE_TOC, #EN_Q_AUTOLEAD,
and INDENT_REFS are used before being defined.


Bjarni Ingi Gislason <bjarniig>
Fri 03 Nov 2017 12:04:21 AM UTC, comment #5: 


  My patch simply uses exactly the same definitions as "groff" does in the
same situation.
  The patch simply makes the default behaviour of "groff" visible.

  It also avoids warnings (feedback) from "groff".

  The macro "END" is used many times and should therefore be unconditionally
defined:

.de END
..

  I did not find any definition of this macro in my git/groff repository.


Bjarni Ingi Gislason <bjarniig>
Thu 02 Nov 2017 05:15:54 PM UTC, comment #4: 

Which warnings are you seeing?  Also, I'm not sure what you mean by "import the mom macros by hand."  Can you attach a file and give the command line invocation you're using?

Peter Schaffter <PTPi>
Group Member
Thu 02 Nov 2017 06:23:49 AM UTC, comment #3: 

Thanks for the feedback, Peter!

I can reproduce these warnings if I prepare a simple document and import the mom macros "by hand", not messing with pdfroff and similar.

Is that no longer a valid use case for the mom macros?  It seems to me like it still could be.

G. Branden Robinson <gbranden>
Group administrator
Wed 01 Nov 2017 06:27:54 PM UTC, comment #2: 


@@ -221,6 +221,9 @@ end
.ds PDFHREF.TEXTCOL.DEFAULT 0.0 0.3 0.9
.nr PDFHREF.VIEW.LEADING.C 3i
.nr PDFHREF.VIEW.LEADING.T 1i
+.if !r PDFHREF.VIEW.LEADING \{\
+. nr PDFHREF.VIEW.LEADING 0
+.\}
.nr PDFHREF.VIEW.LEADING.H \n[PDFHREF.VIEW.LEADING]
\#
\# ==================================================================

That seems like it's asking for trouble; if anything ever dereferences the PDFHREF.VIEW.LEADING or PDHREF.VIEW.LEADING.H registers before redefining them, and if they do what their names suggest, the resulting text will be "set solid" with no interline spacing. Won't it?

PDFHREF.VIEW.LEADING controls the distance from the top of the PDF viewer window to the baseline of link targets.  It has no effect on the formatting of the .pdf file itself.  The register is set in pdf.tmac; the default is 5 points (5000u).  There's no need for


.if !r PDFHREF.VIEW.LEADING


There's no need to define the "undefined" macros/registers either since, after loading pdf.tmac and om.tmac, they are, in fact, defined.  The assumption that pdf.tmac (Deri's re-write of Keith's pdfmark.tmac) is loaded is correct since pdf.tmac is loaded from troffrc when groff is called with -Tpdf.

The error "can't transparently output node at top level" may safely be ignored, which is documented.

Peter Schaffter <PTPi>
Group Member
Wed 01 Nov 2017 03:08:06 AM UTC, comment #1: 

I've fixed all but a few of these problems; unfortunately the ones that remain are probably exactly the ones that got Bjarni's attention because they make groff spew warnings.

<pre>
@@ -221,6 +221,9 @@ end
 .ds PDFHREF.TEXTCOL.DEFAULT 0.0 0.3 0.9
 .nr PDFHREF.VIEW.LEADING.C 3i
 .nr PDFHREF.VIEW.LEADING.T 1i
+.if !r PDFHREF.VIEW.LEADING \{\
+.    nr PDFHREF.VIEW.LEADING 0
+.\}
 .nr PDFHREF.VIEW.LEADING.H \n[PDFHREF.VIEW.LEADING]
 \#
 \# ====================================================================
</pre>

That seems like it's asking for trouble; if anything ever dereferences the PDFHREF.VIEW.LEADING or PDHREF.VIEW.LEADING.H registers before redefining them, and if they do what their names suggest, the resulting text will be "set solid" with no interline spacing. Won't it?

<pre>
@@ -264,6 +267,42 @@ end
 .nr #L_MARGIN \n[.o]  \" Tabs, etc require #L_MARGIN
 .cflags 4 /\[en]      \" So slash and en-dashes get broken
 \#
+\# DEFINE UNDEFINED MACROS AND REGISTERS
+\#
+.if !d AUTO_RELOCATE_TOC \{\
+.    de AUTO_RELOCATE_TOC
+.    .
+.\}
+.
+.if !d BREAK_QUOTE \{\
+.    de BREAK_QUOTE
+.    .
+.\}
+.
+.if !d END \{\
+.    de END
+.    .
+.\}
+.
+.if !d INDENT_REFS \{\
+.    de INDENT_REFS
+.    .
+.\}
+.
+.if !d PDF_LINK_COLOR \{\
+.    de PDF_LINK_COLOR
+.    .
+.\}
+.
+.if !d pdfview \{\
+.    de pdfview
+.    .
+.\}
+.
+.if !r #EN_Q_AUTOLEAD \{\
+.    nr #EN_Q_AUTOLEAD 0
+.\}
+\#
</pre>

I'd like to run these by Peter Schaffter.  There seems to be some assumption that pdf.tmac or pdfmark.tmac will already be loaded.

G. Branden Robinson <gbranden>
Group administrator
Fri 28 Jul 2017 09:38:08 PM UTC, original submission:  


From 23a25549fcf88bfae6af80f57e96bfd0ef8899e8 Mon Sep 17 00:00:00 2001
From: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Date: Fri, 28 Jul 2017 21:33:48 +0000
Subject: [PATCH] om.tmac-u: Fix some mistakes, fix one bug

  Fix some spelling

  Define undefined macros and registers

  Fix the spelling of register "\\*[label-type]*label-suffx-set"

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
---
 contrib/mom/om.tmac-u | 77 ++++++++++++++++++++++++++++++++++++++-------------
 1 file changed, 58 insertions(+), 19 deletions(-)

diff --git a/contrib/mom/om.tmac-u b/contrib/mom/om.tmac-u
index c20510e9..c34ea5c1 100644
--- a/contrib/mom/om.tmac-u
+++ b/contrib/mom/om.tmac-u
@@ -161,7 +161,7 @@ extensions, and float management).
 .sty \n[.fp] UBLI    \"  Ultra Black Italic
 .sty \n[.fp] UBLCD   \"  Ultra Black Condensed
 .sty \n[.fp] UBLCDI  \"  Ultra Black Condensed Italic
-.sty \n[.fp] UBLEX   \"  Ultra Black Exteneded
+.sty \n[.fp] UBLEX   \"  Ultra Black Extended
 .sty \n[.fp] UBLEXI  \"  Ultra Black Extended Italic
 \#
 .sty \n[.fp] SC      \"  Small Caps Roman
@@ -222,6 +222,9 @@ end
 .ds PDFHREF.TEXTCOL.DEFAULT 0.0 0.3 0.9
 .nr PDFHREF.VIEW.LEADING.C 3i
 .nr PDFHREF.VIEW.LEADING.T 1i
+.if !r PDFHREF.VIEW.LEADING \{\
+.    nr PDFHREF.VIEW.LEADING 0
+.\}
 .nr PDFHREF.VIEW.LEADING.H \n[PDFHREF.VIEW.LEADING]
 \#
 \# ====================================================================
@@ -265,6 +268,42 @@ end
 .nr #L_MARGIN \n[.o]  \" Tabs, etc require #L_MARGIN
 .cflags 4 /\[en]      \" So slash and en-dashes get broken
 \#
+\# DEFINE UNDEFINED MACROS AND REGISTERS
+\#
+.if !d AUTO_RELOCATE_TOC \{\
+.    de AUTO_RELOCATE_TOC
+.    .
+.\}
+.
+.if !d BREAK_QUOTE \{\
+.    de BREAK_QUOTE
+.    .
+.\}
+.
+.if !d END \{\
+.    de END
+.    .
+.\}
+.
+.if !d INDENT_REFS \{\
+.    de INDENT_REFS
+.    .
+.\}
+.
+.if !d PDF_LINK_COLOR \{\
+.    de PDF_LINK_COLOR
+.    .
+.\}
+.
+.if !d pdfview \{\
+.    de pdfview
+.    .
+.\}
+.
+.if !r #EN_Q_AUTOLEAD \{\
+.    nr #EN_Q_AUTOLEAD 0
+.\}
+\#
 \# ====================================================================
 \#
 \# +++PAGE LAYOUT+++
@@ -1734,7 +1773,7 @@ end
 \# *Argument:
 \#   <none>
 \# *Function:
-\#   Automagically moves to TAB<n+1> on the same line as the last
+\#   Automatically moves to TAB<n+1> on the same line as the last
 \#   line of the previous tab.
 \# *Notes:
 \#   The \c inline must be appended to the end of input lines when in
@@ -2376,7 +2415,7 @@ end
 \#
 \# PAD
 \# ---
-\# *Argments:
+\# *Arguments:
 \#   "<string of text with padding markers inserted>"
 \#   "<id of bookmark created by .PDF_BOOKMARK>"
 \# *Function:
@@ -3686,7 +3725,7 @@ end
 \#   a trap (when they break the preceding line, they spring the
 \#   trap, and groff won't back up to the line preceding the trap).
 \#   TRAP is a kludge to get EL and TN work properly on last lines.
-\#   The user simply enloses the offending lines in TRAP OFF/TRAP.
+\#   The user simply encloses the offending lines in TRAP OFF/TRAP.
 \#
 .MAC TRAP END
 .    ie '\\$1'' .vpt
@@ -4283,7 +4322,7 @@ y\R'#DESCENDER \\n[.cdp]'
 \#   Instructs TYPEWRITE to treat italics as italics, whether
 \#   invoked via control lines or inline.
 \# *Notes:
-\#   ITALIC_MEANS_ITALIC and UNDERLINE_ITALIC are mututally exclusive,
+\#   ITALIC_MEANS_ITALIC and UNDERLINE_ITALIC are mutually exclusive,
 \#   hence invoking the one automatically turns off the other.
 \#
 .MAC ITALIC_MEANS_ITALIC END
@@ -4307,7 +4346,7 @@ y\R'#DESCENDER \\n[.cdp]'
 \#   Instructs TYPEWRITE to underline italics, whether invoked
 \#   via control lines or inline.
 \# *Notes:
-\#   UNDERLINE_ITALIC and ITALIC_MEANS_ITALIC are mututally exclusive,
+\#   UNDERLINE_ITALIC and ITALIC_MEANS_ITALIC are mutually exclusive,
 \#   hence invoking the one automatically turns off the other.
 \#
 \#   UNDERLINE_ITALIC is the default for TYPEWRITE.
@@ -4338,7 +4377,7 @@ y\R'#DESCENDER \\n[.cdp]'
 \#   italic but didn't have it, ergo the need to tell TYPEWRITE to
 \#   treat \*[SLANT] as italic (i.e. underlined).
 \#
-\#   UNDERLINE_SLANT and SLANT_MEANS_SLANT are mututally exclusive,
+\#   UNDERLINE_SLANT and SLANT_MEANS_SLANT are mutually exclusive,
 \#   hence invoking the one automatically turns off the other.
 \#
 \#   UNDERLINE_SLANT is the default for TYPEWRITE.
@@ -7557,7 +7596,7 @@ $\\*[DOC_]COVERTITLE_\\n+[#\\*[DOC_]COVERTITLE_NUM] \\$\\n[#\\*[DOC_]COVERTITLE_
 \# *Arguments:
 \#   <none>
 \# *Function:
-\#   Macro to start document processiong.  Reads in default document
+\#   Macro to start document processing.  Reads in default document
 \#   style parameters and any parameters the user has changed before
 \#   issuing START.  Using the information gathered in the opening
 \#   macros, prints appropriate title (or chapter #), subtitle,
@@ -8886,7 +8925,7 @@ Shimming must be disabled with NO_SHIM before using FLEX.
 \#
 \#   If the user wants to incorporate the page number into the string,
 \#   \*[PAGE#] must be used.  For example, if the user wants to put
-\#   an elipsis before the page number in the string, s/he should use
+\#   an ellipsis before the page number in the string, s/he should use
 \#   ...\*[PAGE#], not ...#
 \#
 .MAC HDRFTR_LEFT END
@@ -8958,7 +8997,7 @@ Shimming must be disabled with NO_SHIM before using FLEX.
 \#
 \#   If the user wants to incorporate the page number into the string,
 \#   \*[PAGE#] must be used.  For example, if the user wants to put
-\#   an elipsis before the page number in the string, s/he should use
+\#   an ellipsis before the page number in the string, s/he should use
 \#   ...\*[PAGE#], not ...#
 \#
 .MAC HDRFTR_CENTER END
@@ -9048,7 +9087,7 @@ Shimming must be disabled with NO_SHIM before using FLEX.
 \#
 \#   If the user wants to incorporate the page number into the string,
 \#   \*[PAGE#] must be used.  For example, if the user wants to put
-\#   an elipsis before the page number in the string, s/he should use
+\#   an ellipsis before the page number in the string, s/he should use
 \#   ...\*[PAGE#], not ...#
 \#
 .MAC HDRFTR_RIGHT END
@@ -9764,7 +9803,7 @@ Shimming must be disabled with NO_SHIM before using FLEX.
 .    \}
 .    if \\n[#PRINT_STYLE]=1 \{\
 .       if \\n[#ENDNOTES]=1 \{\
-.\" Single-spaced endotes have a different lead
+.\" Single-spaced endnotes have a different lead
 .          if \\n[#EN_SINGLESPACE] \{\
 .             nr #RESTORE_DOC_LEAD \\n[#DOC_LEAD]
 .             nr #DOC_LEAD \\n[#EN_LEAD]u
@@ -11260,7 +11299,7 @@ Shimming must be disabled with NO_SHIM before using FLEX.
 \#   [character] [iterations] [vertical adjustment]
 \# *Function:
 \#   Allows user to specify a line break character and the number
-\#   of times to repeat it horiontally.
+\#   of times to repeat it horizontally.
 \# *Notes:
 \#   Without an argument, LINEBREAK_CHAR will deposit a blank line.
 \#
@@ -13963,7 +14002,7 @@ E\\R'#CAP_HEIGHT \\n[.cht]'
 .
 .ALIAS ENDNOTE_STRING ENDNOTES_HEADER_STRING
 \#
-\# ENDNOTE STRING START POSTION
+\# ENDNOTE STRING START POSITION
 \# ----------------------------
 \# *Argument:
 \#   <distance from page top>
@@ -14884,8 +14923,8 @@ E\\R'#CAP_HEIGHT \\n[.cht]'
 \#   Sets #BIB_LIST to 1 for numbered list style, 0 for plain output
 \# *Notes:
 \#   Technically, user is supposed to enter PLAIN if s/he wants an
-\#   unumbered bibliography, but the el clause says "any arg but
-\#   LIST means unumbered."  Effectively, any arg but LIST produces
+\#   unnumbered bibliography, but the el clause says "any arg but
+\#   LIST means unnumbered."  Effectively, any arg but LIST produces
 \#   a "plain" bibliographic list.
 \#
 \# The 2nd and 3rd args have the same options as the 2nd and 3rd
@@ -18863,7 +18902,7 @@ E\\R'#CAP_HEIGHT \\n[.cht]'
 .    if \\n[#NUM_ARGS]=1 \{\
 .       rr \\*[label-type]*autolabel
 .       rr \\*[label-type]*label-prfx-set
-.       rr \\*[label-type]*label-suffx-set
+.       rr \\*[label-type]*label-sffx-set
 .    \}
 .    rr \\*[label-type]-label-args
 .END
@@ -21337,7 +21376,7 @@ does not fit on page \\n[pgnum]\\*[col-num].
 .while !'\\*[eval*[E]',' \{\
 .   ds eval*[E \\*([E
 .   substring eval*[E \\n+[position] \\n[position]
-.   if \\n+[counter]>30 .break \" 30 is abitrary
+.   if \\n+[counter]>30 .break \" 30 is arbitrary
 .\}
 .\" Check for " and"
 .if '\\*[eval*[E]',' \{\
@@ -21598,7 +21637,7 @@ does not fit on page \\n[pgnum]\\*[col-num].
 \#
 \# Book reprints
 \# -------------
-\# %d date of publication (the orignal date of publication)
+\# %d date of publication (the original date of publication)
 .de ref*add-d
 .ie '\\*[$REF_STYLE]'NOTE' \{\
 .   ref*field d "" ( ;
--
2.13.2


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

    Date Changed by Updated Field Previous Value => Replaced by
    2022-01-22 gbranden Item GroupNone Warning/Suspicious behaviour
        Summary[PATCH] om.tmac-u: Fix some mistakes, fix one bug [PATCH] [mom] undefined register/macro warnings
    2018-11-05 gbranden Assigned togbranden PTPi
        Open/ClosedOpen Closed
        Planned ReleaseNone 1.22.4
    2017-11-03 PTPi StatusNeed Info Fixed
    2017-11-01 gbranden StatusNone Need Info
        Assigned toNone gbranden
    2017-09-01 bgarrigues CategoryNone Macro mom

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code