bug-groff
[Top][All Lists]
Advanced

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

Bug: gropdf does not iterate properly through DESC papersize arguments


From: David Marx
Subject: Bug: gropdf does not iterate properly through DESC papersize arguments
Date: Mon, 12 Jul 2021 01:57:30 -0700
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0

Groff Bug Report: Gropdf does not iterate properly through DESC papersize arguments

GROFF VERSION:
% gropdf -v
GNU gropdf (groff) version 1.22.3
% apt list | grep groff
groff/bionic,now 1.22.3-10 amd64 [installed]
groff-base/bionic,now 1.22.3-10 amd64 [installed, automatic]

MACHINE:
Dell XPS 8500

OS:
Windows Subsystem for Linux with Ubuntu
% uname -a
Linux x 4.4.0-19041-Microsoft #488-Microsoft Mon Sep 01 13:43:00 PST 2020 x86_64 x86_64 x86_64 GNU/linux
% cat /etc/issue
Ubuntu 18.04.5 LTS \n \l

COMPILER:
% file /usr/bin/gropdf
/usr/bin/gropdf: Perl script text executable
% perl -v
This is perl 5, version 26, subversion 1 (v5.26.1) built for x86_64-linux-gnuthread-multi

Adobe Acrobat Reader DC (32-bit):
Continuous Release | Version 2021.005.20048

INPUT FILES:
Groff's original DESC files:
% grep -n papersize /usr/share/groff/1.22.3/font/*/DESC
devdvi/DESC:12:papersize /etc/papersize a4
devlbp/DESC:10:papersize /etc/papersize a4
devlj4/DESC:12:papersize /etc/papersize a4
devpdf/DESC:12:papersize a4
devps/DESC:13:papersize /etc/papersize a4

Made the following changes:
1: /usr/share/groff/1.22.3/font/devpdf/DESC papersize line
changed to match other DESC files.
2: /etc/papersize changed from a4 to letter.

% diff /usr/share/groff/1.22.3/font/devpdf/DESC
12c12
< papersize a4
---
> papersize /etc/papersize a4

% diff /etc/papersize
1c1
< a4
---
> letter

COMMAND LINE:
% groff -Tpdf /etc/papersize > /tmp/papersize.pdf
% pdf2ps /tmp/papersize.pdf /tmp/papersize.ps
% grep Bound /tmp/papersize.ps
%%BoundingBox: 0 0 595 842
which dividing by 72 is 8.263888 by 11.69444 inches, a4.

DESCRIPTION OF INCORRECT BEHAVIOUR:
Its unpleasant and unobvious how to convince groff -Tpdf to be
sized for U.S. letter paper by default.  As a result, the top line was
being clipped when I tried to print the resulting pdf (sized for
a4 paper) using Adobe Acrobat Reader DC (32-bit).

Bringing up Acrobat Reader File -> Properties shows
Page Size: 8.26 x 11.69 in.
Bringing up Acrobat Reader Print file dialog in Acrobat Reader, and setting
Actual size in Page Sizing & Handling shows the text "letter"
in the gray area to be clipped.

Changing /etc/papersize doesn't do it, as it appears that gropdf
with the original DESC file isn't looking there.  I shouldn't
have to change /usr/share/groff/1.22.3/font/devpdf/DESC, as it is
a system file not a configuration file.  But changing the
papersize entry to match the other DESC files doesn't work.  It
appears that /usr/bin/gropdf does not iterate through the
papersize arguments properly.

According to the groff_font(5) man page under papersize: "More
than one argument can be specified; groff scans from left to
right and uses the first valid paper specification."

An strace of gropdf  shows that with the changed DESC entry
"papersize /etc/papersize a4", gropdf attempts to access a
file "/etc/papersize a4" that fails.
% strace /usr/bin/gropdf </dev/null 2>&1 | grep papersize
stat("/etc/papersize a4", 0x7fffda0694f0) = -1 ENOENT (No such file or directory)

The result appears to be that no valid papersize is given, and a4
paper size becomes the default.

SUGGESTED FIX [optional]:
1.  Change the entire world to use U.S. letter paper, and change
the defaults to match.

2.  Change /usr/bin/gropdf to iterate through papersize entries
as documented in the groff_font(5) man page, and change the
papersize entry in the devpdf/DESC file to match the others.

Attachment: DESC
Description: Text document

Attachment: papersize
Description: Text document


reply via email to

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