Bug 846211 - Ghostscript unable to generate thumbnails for PDF files with jpeg2000 data
Ghostscript unable to generate thumbnails for PDF files with jpeg2000 data
Status: CLOSED WONTFIX
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: ghostscript (Show other bugs)
5.8
x86_64 Linux
unspecified Severity low
: rc
: ---
Assigned To: Tim Waugh
QE Internationalization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-08-07 03:28 EDT by Derek Tamsen
Modified: 2013-03-11 13:18 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-03-11 13:05:55 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
ghostscript.spec.patch (345 bytes, text/plain)
2012-08-07 03:28 EDT, Derek Tamsen
no flags Details

  None (edit)
Description Derek Tamsen 2012-08-07 03:28:46 EDT
Created attachment 602662 [details]
ghostscript.spec.patch

Description of problem: 
Ghostscript is unable to convert adobe pdf version 1.7 with jpeg2000 data to thumbnails. During the conversion process convert prints "ERROR: Unable to process JPXDecode data. Page will be missing data.". Once ghostscript has finished processing the data no thumbnails are produced.

Version-Release number of selected component (if applicable):
ghostscript-8.70-14.el5
ImageMagick-6.7.8-3

How reproducible:
Reliable with Valve Handbook

Steps to Reproduce:
1. Download the Valve Handbook (http://newcdn.flamehaus.com/Valve_Handbook_LowRes.pdf)
2.convert Valve_Handbook_LowRes.pdf -debug all -quality 100 -density 150 -resize x1080 -colorspace YUV /tmp/Valve_Handbook_LowRes_pdf_images.%d.jpg
3.
  
Actual results:

convert ~/Valve_Handbook_LowRes.pdf -debug all -quality 100 -density 150 -resize x1080 -colorspace YUV /tmp/Valve_Handbook_LowRes_pdf_images.%d.jpg
2012-08-06T23:52:53-07:00 0:00.000 0.000u 6.7.8 Configure convert[5156]: utility.c/ExpandFilenames/939/Configure
  Command line: convert {/root/Valve_Handbook_LowRes.pdf} {-debug} {all} {-quality} {100} {-density} {150} {-resize} {x1080} {-colorspace} {YUV} {/tmp/Valve_Handbook_LowRes_pdf_images.%d.jpg}
2012-08-06T23:52:53-07:00 0:00.000 0.000u 6.7.8 Configure convert[5156]: configure.c/GetConfigureOptions/564/Configure
  Searching for configure file: "/usr/share/ImageMagick-6.7.8/coder.xml"
2012-08-06T23:52:53-07:00 0:00.000 0.000u 6.7.8 Configure convert[5156]: configure.c/GetConfigureOptions/564/Configure
  Searching for configure file: "/usr/lib64/ImageMagick-6.7.8/config/coder.xml"
2012-08-06T23:52:53-07:00 0:00.000 0.000u 6.7.8 Configure convert[5156]: configure.c/GetConfigureOptions/564/Configure
  Searching for configure file: "/etc/ImageMagick/coder.xml"
2012-08-06T23:52:53-07:00 0:00.000 0.000u 6.7.8 Configure convert[5156]: configure.c/GetConfigureOptions/564/Configure
  Searching for configure file: "/usr/share/doc/ImageMagick-6.7.8/coder.xml"
2012-08-06T23:52:53-07:00 0:00.000 0.000u 6.7.8 Configure convert[5156]: configure.c/GetConfigureOptions/564/Configure
  Searching for configure file: "/root/.magick/coder.xml"
2012-08-06T23:52:53-07:00 0:00.000 0.000u 6.7.8 Configure convert[5156]: coder.c/LoadCoderList/693/Configure
  Loading coder configuration file "/etc/ImageMagick/coder.xml" ...
2012-08-06T23:52:53-07:00 0:00.000 0.000u 6.7.8 Module convert[5156]: module.c/OpenModule/1264/Module
  Searching for module "PDF" using filename "pdf.la"
2012-08-06T23:52:53-07:00 0:00.000 0.000u 6.7.8 Module convert[5156]: module.c/GetMagickModulePath/565/Module
  Searching for coder module file "pdf.la" ...
2012-08-06T23:52:53-07:00 0:00.000 0.000u 6.7.8 Module convert[5156]: module.c/OpenModule/1273/Module
  Opening module at path "/usr/lib64/ImageMagick-6.7.8/modules-Q16/coders/pdf.la"
2012-08-06T23:52:53-07:00 0:00.010 0.000u 6.7.8 Module convert[5156]: module.c/OpenModule/1300/Module
  Method "RegisterPDFImage" in module "PDF" at address 0x2ab22deb77c0
2012-08-06T23:52:53-07:00 0:00.010 0.000u 6.7.8 Module convert[5156]: module.c/OpenModule/1314/Module
  Method "UnregisterPDFImage" in module "PDF" at address 0x2ab22deb7780
2012-08-06T23:52:53-07:00 0:00.010 0.000u 6.7.8 Policy convert[5156]: policy.c/IsRightsAuthorized/485/Policy
  Domain: Path; rights=Read; pattern="/root/Valve_Handbook_LowRes.pdf" ...
2012-08-06T23:52:53-07:00 0:00.010 0.000u 6.7.8 Blob convert[5156]: blob.c/OpenBlob/2530/Blob
    read 3 magic header bytes
2012-08-06T23:52:53-07:00 0:00.010 0.010u 6.7.8 Cache convert[5156]: cache.c/DestroyPixelCache/1446/Cache
  destroy 
2012-08-06T23:52:53-07:00 0:00.010 0.010u 6.7.8 Configure convert[5156]: configure.c/GetConfigureOptions/564/Configure
  Searching for configure file: "/usr/share/ImageMagick-6.7.8/magic.xml"
2012-08-06T23:52:53-07:00 0:00.010 0.010u 6.7.8 Configure convert[5156]: configure.c/GetConfigureOptions/564/Configure
  Searching for configure file: "/usr/lib64/ImageMagick-6.7.8/config/magic.xml"
2012-08-06T23:52:53-07:00 0:00.010 0.010u 6.7.8 Configure convert[5156]: configure.c/GetConfigureOptions/564/Configure
  Searching for configure file: "/etc/ImageMagick/magic.xml"
2012-08-06T23:52:53-07:00 0:00.010 0.010u 6.7.8 Configure convert[5156]: configure.c/GetConfigureOptions/564/Configure
  Searching for configure file: "/usr/share/doc/ImageMagick-6.7.8/magic.xml"
2012-08-06T23:52:53-07:00 0:00.010 0.010u 6.7.8 Configure convert[5156]: configure.c/GetConfigureOptions/564/Configure
  Searching for configure file: "/root/.magick/magic.xml"
2012-08-06T23:52:53-07:00 0:00.010 0.010u 6.7.8 Configure convert[5156]: magic.c/LoadMagicList/679/Configure
  Loading magic configure file "/etc/ImageMagick/magic.xml" ...
2012-08-06T23:52:53-07:00 0:00.010 0.010u 6.7.8 Policy convert[5156]: policy.c/IsRightsAuthorized/485/Policy
  Domain: Coder; rights=Read; pattern="PDF" ...
2012-08-06T23:52:53-07:00 0:00.010 0.010u 6.7.8 Policy convert[5156]: policy.c/IsRightsAuthorized/485/Policy
  Domain: Path; rights=Read; pattern="/root/Valve_Handbook_LowRes.pdf" ...
2012-08-06T23:52:53-07:00 0:00.010 0.010u 6.7.8 Blob convert[5156]: blob.c/OpenBlob/2530/Blob
    read 3 magic header bytes
2012-08-06T23:52:53-07:00 0:00.010 0.010u 6.7.8 Cache convert[5156]: cache.c/DestroyPixelCache/1446/Cache
  destroy 
2012-08-06T23:52:53-07:00 0:00.010 0.010u 6.7.8 Policy convert[5156]: policy.c/IsRightsAuthorized/485/Policy
  Domain: Path; rights=Read; pattern="/root/Valve_Handbook_LowRes.pdf" ...
2012-08-06T23:52:53-07:00 0:00.010 0.010u 6.7.8 Blob convert[5156]: blob.c/OpenBlob/2530/Blob
    read 3 magic header bytes
2012-08-06T23:52:53-07:00 0:00.010 0.010u 6.7.8 Resource convert[5156]: resource.c/AcquireUniqueFileResource/439/Resource
  0*?*
2012-08-06T23:52:53-07:00 0:00.010 0.010u 6.7.8 Resource convert[5156]: resource.c/AcquireUniqueFileResource/479/Resource
  /tmp/magick-MEv5n2yB
2012-08-06T23:52:53-07:00 0:00.010 0.010u 6.7.8 Resource convert[5156]: resource.c/RelinquishUniqueFileResource/844/Resource
  /tmp/magick-MEv5n2yB
2012-08-06T23:52:53-07:00 0:00.100 0.100u 6.7.8 Resource convert[5156]: resource.c/AcquireUniqueFileResource/439/Resource
  
2012-08-06T23:52:53-07:00 0:00.100 0.100u 6.7.8 Resource convert[5156]: resource.c/AcquireUniqueFileResource/479/Resource
  /tmp/magick-DrRJHjXf
2012-08-06T23:52:53-07:00 0:00.100 0.100u 6.7.8 Configure convert[5156]: configure.c/GetConfigureOptions/564/Configure
  Searching for configure file: "/usr/share/ImageMagick-6.7.8/delegates.xml"
2012-08-06T23:52:53-07:00 0:00.100 0.100u 6.7.8 Configure convert[5156]: configure.c/GetConfigureOptions/564/Configure
  Searching for configure file: "/usr/lib64/ImageMagick-6.7.8/config/delegates.xml"
2012-08-06T23:52:53-07:00 0:00.100 0.100u 6.7.8 Configure convert[5156]: configure.c/GetConfigureOptions/564/Configure
  Searching for configure file: "/etc/ImageMagick/delegates.xml"
2012-08-06T23:52:53-07:00 0:00.100 0.100u 6.7.8 Configure convert[5156]: configure.c/GetConfigureOptions/564/Configure
  Searching for configure file: "/usr/share/doc/ImageMagick-6.7.8/delegates.xml"
2012-08-06T23:52:53-07:00 0:00.100 0.100u 6.7.8 Configure convert[5156]: configure.c/GetConfigureOptions/564/Configure
  Searching for configure file: "/root/.magick/delegates.xml"
2012-08-06T23:52:53-07:00 0:00.100 0.100u 6.7.8 Configure convert[5156]: delegate.c/LoadDelegateList/1228/Configure
  Loading delegate configuration file "/etc/ImageMagick/delegates.xml" ...
2012-08-06T23:52:53-07:00 0:00.100 0.100u 6.7.8 Resource convert[5156]: resource.c/AcquireUniqueFileResource/439/Resource
  /root/Valve_Handbook_LowRes.pdf
2012-08-06T23:52:53-07:00 0:00.100 0.100u 6.7.8 Resource convert[5156]: resource.c/AcquireUniqueFileResource/479/Resource
  /tmp/magick-adetQLlU
2012-08-06T23:52:53-07:00 0:00.100 0.100u 6.7.8 Policy convert[5156]: policy.c/IsRightsAuthorized/485/Policy
  Domain: Delegate; rights=Execute; pattern="gs" ...
   **** ERROR: Unable to process JPXDecode data. Page will be missing data.


Expected results:
Convert should output thumbnails for each page in the pdf file. The output directory is /tmp/Valve_Handbook_LowRes_pdf_images.%d.jpg where %d is the page number from the pdf.

Additional info:
It appears this issue is related to jasper. I attempted to build the ghostscript rpm with jasper support using jasper-devel from base. However, I ran into an issue where I needed to reactivate a jasper patch (http://www.redhat.com/archives/fedora-extras-commits/2008-February/msg09468.html) so that the rpm would build correctly. I then saw different error messages with the new rpm. The error messages were:
**** Warning: File has insufficient data for an image.
error: cannot decode code stream
unable to decode JPX image data.

Those error message led me to a ghostscript bug report (http://bugs.ghostscript.com/show_bug.cgi?id=692820). It appears that ghostscript is now being bundled with its own version of jasper. Ghostscript has modified jasper but the modifications were not accepted upstream by jasper per the last comment, "libjasper is the one which contains subtantial enhancements/bug-fixes which were not taken up by upsteam.". I then noticed that line 95 removes the bundled jasper library. After removing the "rm jasper" command in the spec file the rpm built successfully and correctly converts pdf files with jpeg2000 data embedded in them.

I have attached a patch for the spec file. I am not sure if this is the correct approach to fix the problem or if the base jasper should be fixed to correct the issue.
Comment 1 Jiri Popelka 2013-03-11 13:05:55 EDT
RHEL-5.10 (the next RHEL-5 minor release) is going to be the first production phase 2 [1] release of RHEL-5.
Since phase 2 we'll be addressing only security and critical issues.
I'm closing this ticket as WONTFIX because this problem is neither security nor critical.

[1] https://access.redhat.com/support/policy/updates/errata/
Comment 2 Jiri Popelka 2013-03-11 13:18:05 EDT
(In reply to comment #0)

> Ghostscript
> has modified jasper but the modifications were not accepted upstream by
> jasper per the last comment, "libjasper is the one which contains subtantial
> enhancements/bug-fixes which were not taken up by upsteam."

jasper upstream has been dead for couple years so the only way this can be fixed is by patching the jasper we ship in Fedora/RHEL.

> I then noticed
> that line 95 removes the bundled jasper library. After removing the "rm
> jasper" command in the spec file the rpm built successfully and correctly
> converts pdf files with jpeg2000 data embedded in them.
> I have attached a patch for the spec file. I am not sure if this is the
> correct approach to fix the problem or if the base jasper should be fixed to
> correct the issue.

There's no way we can ship bundled libraries, no.
But if you have some idea what should be fixed in jasper fill a bug against jasper. You should choose Fedora as a product, because such a low severity bug will never gain enough priority in RHEL.

Note You need to log in before you can comment on or make changes to this bug.