Package: groff Version: 1.22.4-9 Severity: normal Tags: patch X-Debbugs-Cc: bugs.debian....@wongs.net
Dear Maintainer, The gropdf Perl script has a few bugs. 1. It does not include /etc/papersize as the first place to check for the default paper size. The problem is that the "papersize" directive in fonts/devpdf/DESC only lists "a4" (or "letter"). papersize a4 Instead it should look like this: papersize /etc/papersize a4 2. It does not search each possible papersize listed in DESC, which is the documented behaviour in the groff_font manual. The fix for that requires editing the Perl script and splitting the papersizes on the space character. To reproduce the problem, try this: man -Tpdf groff > groff.pdf && pdfinfo groff.pdf | grep size I have attached two patches, one for each bug. The first changes the devpdf.am file so that it prepends "/etc/papersize" to the search. The code was copied from devps.am. The second patch adds a loop around the check of the $papersz variable in gropdf.pl. Because another level of indentation was added, the diff makes it look like more of the code changed than actually did. Thank you. -- System Information: Debian Release: bookworm/sid APT prefers testing APT policy: (500, 'testing') Architecture: amd64 (x86_64) Kernel: Linux 6.1.0-1-amd64 (SMP w/8 CPU threads; PREEMPT) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set Shell: /bin/sh linked to /usr/bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled Versions of packages groff depends on: ii groff-base 1.22.4-9 ii libc6 2.36-8 ii libgcc-s1 12.2.0-14 ii libstdc++6 12.2.0-14 ii libx11-6 2:1.8.3-3 ii libxaw7 2:1.0.14-1 ii libxmu6 2:1.1.3-3 ii libxt6 1:1.2.1-1 Versions of packages groff recommends: ii ghostscript 10.0.0~dfsg-9+b1 ii imagemagick 8:6.9.11.60+dfsg-1.4+b1 ii imagemagick-6.q16 [imagemagick] 8:6.9.11.60+dfsg-1.4+b1 ii libpaper1 1.1.28+b1 ii netpbm 2:11.01.00-2 ii perl 5.36.0-7 ii psutils 1.17.dfsg-4 groff suggests no packages. -- no debconf information
--- font/devpdf/devpdf.am.orig 2023-01-30 19:12:42.600754792 -0800 +++ font/devpdf/devpdf.am 2023-01-30 19:15:00.829075259 -0800 @@ -1,9 +1,9 @@ -# Copyright (C) 2011-2018 Free Software Foundation, Inc. +# Copyright (C) 2011-2022 Free Software Foundation, Inc. # Original Makefile.sub written # by Deri James <d...@chuzzlewit.demon.co.uk> # Automake migration by Bertrand Garrigues # -# Last update: 2017-11-02 +# Last update: 2022-01-30 # # This file is part of groff. # @@ -95,9 +95,9 @@ && $(RM) $(top_builddir)/font/devpdf/DESC \ && cat $(devpdf_srcdir)/DESC.in >$(top_builddir)/font/devpdf/DESC \ && if test "$(PAGE)" = A4; then \ - echo "papersize a4" >>$(top_builddir)/font/devpdf/DESC; \ + echo "papersize /etc/papersize a4" >>$(top_builddir)/font/devpdf/DESC; \ else \ - echo "papersize letter" >>$(top_builddir)/font/devpdf/DESC; \ + echo "papersize /etc/papersize letter" >>$(top_builddir)/font/devpdf/DESC; \ fi font/devpdf/Foundry:
--- src/devices/gropdf/gropdf.pl.orig 2023-01-30 17:23:40.938310920 -0800 +++ src/devices/gropdf/gropdf.pl 2023-01-30 18:55:24.859580795 -0800 @@ -248,39 +248,49 @@ LoadDesc(); my $unitwidth=$desc{unitwidth}; -my $papersz=$desc{papersize}; -$papersz=lc($fpsz) if $fpsz; - $env{FontHT}=0; $env{FontSlant}=0; MakeMatrix(); -if (substr($papersz,0,1) eq '/' and -r $papersz) +my $possiblesizes = $desc{papersize}; +$possiblesizes = $fpsz . " " . $possiblesizes if $fpsz; +my $papersz; +for $papersz ( split(" ", lc($possiblesizes)) ) { - if (open(P,"<$papersz")) + # Check for "/etc/papersize" + if (substr($papersz,0,1) eq '/' and -r $papersz) { - while (<P>) + if (open(P,"<$papersz")) { - chomp; - s/# .*//; - next if $_ eq ''; - $papersz=$_; - last + while (<P>) + { + chomp; + s/# .*//; + next if $_ eq ''; + $papersz=$_; + last; + } + close(P); } + } - close(P); + # Allow height,width specified directly in centimeters, inches, or points. + if ($papersz=~m/([\d.]+)([cipP]),([\d.]+)([cipP])/) + { + @defaultmb=@mediabox=(0,0,ToPoints($3,$4),ToPoints($1,$2)); + last; + } + # Look $papersz up as a name such as "a4" or "letter". + elsif (exists($ppsz{$papersz})) + { + @defaultmb=@mediabox=(0,0,$ppsz{$papersz}->[0],$ppsz{$papersz}->[1]); + last; } -} -if ($papersz=~m/([\d.]+)([cipP]),([\d.]+)([cipP])/) -{ - @defaultmb=@mediabox=(0,0,ToPoints($3,$4),ToPoints($1,$2)); -} -elsif (exists($ppsz{$papersz})) -{ - @defaultmb=@mediabox=(0,0,$ppsz{$papersz}->[0],$ppsz{$papersz}->[1]); + # If we get here, $papersz was invalid, so try the next one. } + my (@dt)=gmtime($ENV{SOURCE_DATE_EPOCH} || time); my $dt=PDFDate(\@dt);