bugGNU roff - Bugs: bug #62346, [PATCH] [gropdf] B0-B6 sizes don't...

 
 

bug #62346: [PATCH] [gropdf] B0-B6 sizes don't work as documented

Submitter:  Dave <barx>
Submitted:  Fri 22 Apr 2022 03:57:42 AM UTC
   
 
Category:  Driver gropdf Severity:  2 - Minor
Item Group:  Incorrect behaviour Status:  Fixed
Privacy:  Public Assigned to:  gbranden
Open/Closed:  Closed Planned Release:  1.23.0
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 27 Jun 2023 01:34:31 AM UTC, comment #8: 

comment #6:

> nonsense page sizes like "zzzz" provoke no warning even with
> all warning categories turned on.


Fixed 7 months later in commit 49aff9b9, probably independently and not a result of my grousing here.

Dave <barx>
Group Member
Wed 27 Apr 2022 07:45:24 PM UTC, comment #7: 


commit 956b7bf15704c63ae8175558025d942eb711efc8
Author: Dave Kemper <saint.snit@gmail.com>
Date:   Fri Apr 22 03:57:42 2022 +0000

    [gropdf]: Fix Savannah #62346.

    * src/devices/gropdf/gropdf.pl (ppsz): Recognize ISO B-series paper
      formats using strings of the form "b0-b6", not "isob0-b6", for
      consistency with libgroff and papersize.tmac.

    Fixes <http://savannah.gnu.org/bugs/?62346>.

    [Thanks to Deri James for reviewing the patch. --GBR]


G. Branden Robinson <gbranden>
Group administrator
Wed 27 Apr 2022 01:53:35 AM UTC, comment #6: 

This perhaps warrants a different bug report, but it's also mildly concerning that nonsense page sizes like "zzzz" provoke no warning even with all warning categories turned on.

Dave <barx>
Group Member
Mon 25 Apr 2022 05:41:51 AM UTC, comment #5: 

comment #4:

> The patch is fine, although it may become moot depending on
> what is decided in bug #62344.


True.  Part of my goal with this patch was to provide one less complication for 62344, by getting all the different places to at least use the same names.  (Another goal was to make a simple fix to something that currently doesn't work as documented, which can hopefully make it into 1.23, since the more involved work of 62344 may get deferred.)

The rest of your comment applies more to 62344 than this bug, so I'll address it over there.  Thanks for the feedback.

Dave <barx>
Group Member
Mon 25 Apr 2022 12:40:57 AM UTC, comment #4: 

The patch is fine, although it may become moot depending on what is decided in bug #62344.

I'm pretty agnostic on the "best" solution, I'm quite happy to add code to gropdf to parse paper.tmac, if this considered to be the authoritive source. Which has the advantage that a user can add their own paper sizes, there are several used in the print industry which we don't mention, and we are light on envelope sizes, i.e. an A4 envelope must be bigger than an A4 page, ’cos it would be a devil of a job to insert it!

Deri James <deri>
Group Member
Sun 24 Apr 2022 10:59:12 PM UTC, comment #3: 

Haha, like all the best code!

So you think the patch here is worth applying?

Dave <barx>
Group Member
Sun 24 Apr 2022 03:56:45 PM UTC, comment #2: 

Copied from somewhere on the net!!

Deri James <deri>
Group Member
Sun 24 Apr 2022 02:43:19 PM UTC, comment #1: 

Added gropdf's original author to the cc as he may have some insight on why the B names are handled differently.

Dave <barx>
Group Member
Fri 22 Apr 2022 03:57:42 AM UTC, original submission:  

The problem


gropdf(1) says that gropdf's -p option "accepts the same arguments as the papersize command.  See groff_font(5) for details."

So we trundle over to groff_font(5) and read: "Recognized paper formats are the ISO and DIN formats A0-A7, B0-B7, C0-C7, ..."

In fact, gropdf does not recognize the sizes B0 - B6 under those names, but it does recognize them under the alternate, undocumented names ISOB0 - ISOB6:

$ groff -Tpdf -P-pzzzz  <<<'Hello.' | fgrep -a MediaBox  # nonsense size, for reference
/MediaBox [0 0 595 842 ]
$ groff -Tpdf -P-pb3    <<<'Hello.' | fgrep -a MediaBox  # first attempt to specify B3, fails
/MediaBox [0 0 595 842 ]
$ groff -Tpdf -P-pisob3 <<<'Hello.' | fgrep -a MediaBox  # specify B3 using secret name, works
/MediaBox [0 0 1001 1417 ]

The problem does not occur with the A and C names; these are recognized in their unadorned form, as documented.

The fix


The attached patch makes a simple edit to src/devices/gropdf/gropdf.pl that seems to resolve this.  With the modified gropdf in place, the new results are:

$ groff -Tpdf -P-pzzzz <<<'Hello.' | fgrep -a MediaBox  # nonsense size, for reference
/MediaBox [0 0 595 842 ]
$ groff -Tpdf -P-pb3   <<<'Hello.' | fgrep -a MediaBox  # first attempt to specify B3, now works
/MediaBox [0 0 1001 1417 ]

It's unclear to me why the B names are different in the source code from the A and C names; they've been that way since the file debuted in git (commit 87046b29), so the commit history holds no clues.  But someone had to go to extra effort to put the extra characters before all the B names, so it seems like it must have been done for some deliberate reason.

Further blathering


groff_font(5) lists several other sizes that gropdf does not recognize at all, but this is the subject of bug #62344.  The B0-B6 bug could also conceivably be considered under that one's purview: that bug requests synching the paper sizes in various parts of the groff distribution, which could arguably cover making them all use the same names as well.  But that bug concerns itself primarily with adding paper sizes that are not currently recognized; the present bug addresses some paper sizes that gropdf does already recognize, but only using undocumented forms of their names.

Dave <barx>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #53128:  gropdf.papersize.patch added by barx (655B - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by gbranden (Updated the item)
  • -email is unavailable- added by deri (Posted a comment)
  • -email is unavailable- added by barx (original author of gropdf.pl)
  • -email is unavailable- added by barx (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 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-04-27 gbranden StatusIn Progress Fixed
        Open/ClosedOpen Closed
        Planned ReleaseNone 1.23.0
    2022-04-26 gbranden StatusNone In Progress
        Assigned toNone gbranden
    2022-04-24 barx Carbon-Copy- Added deri
    2022-04-22 barx Attached File- Added gropdf.papersize.patch, #53128

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code