Bug#600684: pdfcrop: Fails to crop due to bug in ghostscript printing bounding box information twice
Package: texlive-extra-utils
Version: 2007.dfsg.2-4+lenny3
Severity: important
Hi
ghostscript in Lenny has a bug which affects functionality of pdfcrop
which is not working and fails with:
PDFCROP 1.5, 2004/06/24 - Copyright (c) 2002, 2004 by Heiko Oberdiek.
!!! Error: pdfTeX run failed!
looking further it seems that this is ghostscript printing out
bounding box information twice [1].
[1] http://bugs.debian.org/593213
The following patch should fix the issue, as it is 'backported' from
upstream. I have tested it and it seems to work, but I hope you could
have a further look at it.
If you agree on the fix, would it be possible to upload it to s-p-u?
Bests
Salvatore
-- System Information:
Debian Release: squeeze/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.26-2-amd64 (SMP w/8 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash
--- /usr/bin/pdfcrop.orig 2010-04-30 20:01:26.000000000 +0200
+++ /usr/bin//pdfcrop 2010-10-19 09:17:41.863122023 +0200
@@ -254,10 +254,19 @@
my $page = 0;
open(CMD, $cmdpipe) or
die "$Error Cannot call ghostscript!\n";
+my $previous_line = 'Previous line';
+# Ghostscript workaround for buggy ports that prints
+# the bounding box data twice on STDERR.
while (<CMD>) {
my $bb = ($::opt_hires) ? "%%HiResBoundingBox" : "%%BoundingBox";
- next unless
- /^$bb:\s*([\.\d]+) ([\.\d]+) ([\.\d]+) ([\.\d]+)/o;
+ if (/^$bb:\s*(-?[\.\d]+) (-?[\.\d]+) (-?[\.\d]+) (-?[\.\d]+)/o) {
+ }
+ else {
+ $previous_line = $_;
+ next;
+ }
+ next if $previous_line eq $_;
+ $previous_line = $_;
$page++;
print "* Page $page: $1 $2 $3 $4\n" if $::opt_verbose;
if ($::opt_clip) {
Reply to: