bugGNU roff - Bugs: bug #59573, [troff] diagnostics about...

 
 

bug #59573: [troff] diagnostics about unplanted traps should be warnings, not errors

Submitter:  Bjarni Ingi Gislason <bjarniig>
Submitted:  Mon 30 Nov 2020 01:06:18 AM UTC
   
 
Category:  Core Severity:  3 - Normal
Item Group:  Warning/Suspicious behaviour Status:  Fixed
Privacy:  Public Assigned to:  gbranden
Open/Closed:  Closed Planned Release:  1.23.0
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 09 Dec 2020 02:24:25 AM UTC, comment #5: 


commit 4e23c800e68ebf13d345491483639b97107816d6 (HEAD -> master, origin/master, origin/HEAD)
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
Date:   Wed Dec 9 12:46:49 2020 +1100

    Lower new unplanted trap error to 'mac' warning.

    * src/roff/troff/div.cpp (top_level_diversion::change_trap): Change
      error upon invalid attempt to move an unplanted trap into a warning of
      type 'mac'.

    This somewhat stretches the documented semantics of the 'mac' warning
    type, so recast them to accommodate the new instance.

    * doc/groff.texi (Warnings):
    * src/roff/troff/troff.1.man (Warnings): Recast description of 'mac'
      warning type to include the above scenario.

      Recast to mention boxes as well as traditional diversions.  Refer to
      macros, strings, diversions, and boxes collectively as "objects"
      instead of "macros", avoiding synecdoche.  Use complete sentences.

    Thanks to Bjarni Ingi Gislason for reporting the diagnostic arising in
    real life, and to Peter Schaffter for the discussion and recommendation.
    Some bike sheds get painted quickly!

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


G. Branden Robinson <gbranden>
Group administrator
Sat 05 Dec 2020 09:34:11 PM UTC, comment #4: 

Setting as blocker because a decision needs to be taken before release.

G. Branden Robinson <gbranden>
Group administrator
Sat 05 Dec 2020 04:31:08 PM UTC, comment #3: 
G. Branden Robinson <gbranden>
Group administrator
Mon 30 Nov 2020 08:43:26 PM UTC, comment #2: 

Until now, the exhibited behaviour of groff, if not the intended behaviour, was to ignore .ch requests for non-existent traps.  The file typesetting.mom demonstrates bare-metal typesetting, so the FOOTER and FN_OVERFLOW traps, which are only used if START has been invoked (full document processing), are never set.  This has allowed PDF_IMAGE conveniently to process all pdf images inside the FLOAT mechanism, which necessarily .ch's the aforementioned traps if they exist and does nothing if they do not, as is the case with typesetting.mom.

It is simple enough to amend the PDF_IMAGE macro to invoke FLOAT only if START has been invoked, thus eliminating the .ch operations on non-existent traps, but before I do, I'd like to know the rationale behind the change to what, from my perspective as a macro developer, breaks established groff behaviour.


Peter Schaffter <PTPi>
Group Member
Mon 30 Nov 2020 10:02:10 AM UTC, comment #1: 

Confirmed.  These were latent problems, exposed by my recent commit e3b909eda11419daaf9e1ff028defc0e972ac827 (17 November).

Here's the function in question:


$ sed -n '/::change_trap/,/^}$/p' src/roff/troff/div.cpp
void top_level_diversion::change_trap(symbol nam, vunits pos)
{
  for (trap *p = page_trap_list; p; p = p->next)
    if (p->nm == nam) {
      p->position = pos;
      return;
    }
  error("cannot move unplanted trap macro '%1'", nam.contents());
}


Before my change, an attempt to .ch an unplanted macro would simply fall off the end of this for loop and return without changing anything, so I'm reasonably confident this is exposing an actual problem.

Assigning to Peter for his thoughts.

G. Branden Robinson <gbranden>
Group administrator
Mon 30 Nov 2020 01:06:18 AM UTC, original submission:  

contrib/mom/examples/typesetting.mom: traps are not initialised (set,
planted)

  Running "make" on "master":

  GROFF    contrib/mom/examples/typesetting.pdf
troff: ../contrib/mom/examples/typesetting.mom:638: error: cannot move
unplanted trap macro 'FOOTER'

troff: ../contrib/mom/examples/typesetting.mom:638: error: cannot move
unplanted trap macro 'FN_OVERFLOW_TRAP'

  Setting the named traps has been overlooked.

Code in line 638:

.if '\*[.T]'pdf' .PDF_IMAGE penguin.pdf 81p 96p

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 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 12 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-10-05 gbranden CategoryMacro mom Core
        Severity5 - Blocker 3 - Normal
        Summarytypesetting.mom: traps are not initialised (set, planted) [troff] diagnostics about unplanted traps should be warnings, not errors
    2020-12-09 gbranden StatusNeed Info Fixed
        Open/ClosedOpen Closed
        Planned ReleaseNone 1.23.0
    2020-12-05 gbranden Severity3 - Normal 5 - Blocker
    2020-12-05 gbranden StatusConfirmed Need Info
        Assigned toPTPi gbranden
    2020-11-30 gbranden CategoryCore Macro mom
        StatusNone Confirmed
        Assigned toNone PTPi

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code