bug-groff
[Top][All Lists]
Advanced

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

[bug #60772] [PATCH] [grog] Interpret pic begin and end macros correctly


From: Dave
Subject: [bug #60772] [PATCH] [grog] Interpret pic begin and end macros correctly
Date: Fri, 11 Jun 2021 07:03:39 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux i686; rv:45.0) Gecko/20100101 Firefox/45.0

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

                 Summary: [PATCH] [grog] Interpret pic begin and end macros
correctly
                 Project: GNU troff
            Submitted by: barx
            Submitted on: Fri 11 Jun 2021 06:03:38 AM CDT
                Category: Utilities
                Severity: 3 - Normal
              Item Group: Incorrect behaviour
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None

    _______________________________________________________

Details:

Some of the grog logic determining whether to output the -p flag (invoking pic
preprocessing) is questionable.  grog turns out to usually get the right
answer despite this, some of the errors canceling each other out.  But the
code (and the comments) may as well be correct, and the output should be
correct in edge cases.

A particular edge case that grog currently gets wrong is the input file


.PF
.PE


This causes grog to output the -p option, despite this not containing a valid
pic segment.

Some of the fallacies in the code:

* The top of the file defines a 'PS' key of the %Groff hash, and sets its
value to 0.  Nothing in the code ever changes this key's value, yet its value
is later used in a conditional and tested whether it is nonzero.

* A comment in grog.pl states, "pic can be opened by .PS or .PF and closed by
.PE."  Granted, .PF is presently poorly documented (bug #60504), but this
description is incorrect: .PS begins a pic picture; .PE or .PF ends it.  That
is, without a .PS in the input, pic is a no-op, so there is no need for the -p
to be output given the example input above.

The attached patch fixes this case and makes the logic clearer.



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Fri 11 Jun 2021 06:03:38 AM CDT  Name: grog_pic.patch  Size: 1KiB   By:
barx

<http://savannah.gnu.org/bugs/download.php?file_id=51547>

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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