Bug 807858

Summary: regression: fix for rotated PDF files breaks PS file convert
Product: Red Hat Enterprise Linux 5 Reporter: Buck Huppmann <buckh>
Component: ImageMagickAssignee: Benjamin Tissoires <btissoir>
Status: CLOSED DUPLICATE QA Contact: Desktop QE <desktop-qa-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 5.8CC: bmason, fish, jbastian, rbonser
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ImageMagick-6.2.8.0-15.el5_8 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-04-02 17:17:59 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
slapdash patch that might fix problem
none
revised none

Description Buck Huppmann 2012-03-28 23:38:50 UTC
Created attachment 573488 [details]
slapdash patch that might fix problem

Description of problem:
The fix referenced in http://rhn.redhat.com/errata/RHSA-2012-0301.html
for the private bz #694922 breaks convert, when converting from PS
input files.

Version-Release number of selected component (if applicable):
ImageMagick-6.2.8.0-12.el5

How reproducible:
convert file.ps file.whatever

Steps to Reproduce:
1.
2.
3.
  
Actual results:
[ghostscript library] -q -dBATCH -dSAFER -dMaxBitmap=500000000 -dNOPAUSE -dAlignToPixels=0 -dEPSCrop "-sDEVICE=pnmraw" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r612x792" 72x72 "-sOutputFile=" "-f/tmp/magick-XXOcprc6" "-f/tmp/magick-XXeCsmoL"
Error: /undefinedfilename in (72x72)
...
convert: no decode delegate for this image format `file.ps'.
convert: Postscript delegate failed `file.ps'.
convert: missing an image filename `file.jpg'.

 
Expected results:
successful file conversion

Additional info:
It seems like the
    ImageMagick-6.2.8-rotate-PDF.patch
changes coders/pdf.c to insert one less string into the ``delegate
command'' format string

@@ -504,7 +517,7 @@ static Image *ReadPDFImage(const ImageIn
   (void) FormatMagickString(command,MaxTextExtent,
     GetDelegateCommands(delegate_info),
     read_info->antialias != MagickFalse ? 4 : 1,
-    read_info->antialias != MagickFalse ? 4 : 1,geometry,density,options,
+    read_info->antialias != MagickFalse ? 4 : 1,density,options,
     read_info->filename,postscript_filename,input_filename);
   status=InvokePostscriptDelegate(read_info->verbose,command);
   image=ReadImage(read_info,exception);

There's corresponding changes to the delegates.xml file, like

-  <delegate decode="ps:alpha" stealth="True" command='"@PSDelegate@" -q dBATCH -dSAFER -dMaxBitmap=500000000 -dNOPAUSE -dAlignToPixels=0 -dEPSCrop -sDEVICE=@GSAlphaDevice@" -dTextAlphaBits=%u -dGraphicsAlphaBits=%u "-g%s" -r%s" %s "-sOutputFile=%s" "-f%s" "-f%s"' />

+  <delegate decode="ps:alpha" stealth="True" command='"@PSDelegate@" -q dBATCH -dSAFER -dMaxBitmap=500000000 -dNOPAUSE -dAlignToPixels=0 -dEPSCrop -sDEVICE=@GSAlphaDevice@" -dTextAlphaBits=%u -dGraphicsAlphaBits=%u "-r%s" %s "-sOutputFile=%s" "-f%s" "-f%s"' />

where the "-g%s" token has been dropped

Unfortunately, coders/ps.c uses the same delegates, and wasn't updated
accordingly, so, at a minimum, something like the attached needs to be
done to that file.  (I say, ``like,'' because ps.c might also call for
the same ``rotate fix'' that pdf.c did, and not just this band-aid that
fixes the regression.  Also, i haven't actually compiled or tested the
patched code)

Comment 1 Buck Huppmann 2012-03-29 19:02:24 UTC
Created attachment 573768 [details]
revised

should have hung a space after the -g option, as the
PDF patch does (at line 489 of pdf.c)

Comment 3 Buck Huppmann 2012-05-14 12:53:20 UTC
i reckon this is probably the same as bz804546 referenced in

https://rhn.redhat.com/errata/RHSA-2012-0545.html

or bz797364 referenced in the RPM changelog for revision -13.el5

but, of course, i can't see those bz's cause they're private, so
i don't know for sure if this is a duplicate

Comment 4 Bryan Mason 2012-05-14 17:19:30 UTC
Yes, this is a duplicate of Bug 804546 and should be fixed in ImageMagick-6.2.8.0-15.el5_8 as described in the Erratum you referenced.

Comment 5 Bryan Mason 2013-04-02 17:17:59 UTC

*** This bug has been marked as a duplicate of bug 804546 ***