Ticket #790 (closed defect: fixed)

Opened 8 years ago

Last modified 8 years ago

gs-magick.pl to set localised environment when calling imagemagick

Reported by: ak19 Owned by: ak19
Priority: moderate Milestone: 2.85 Release
Component: Greenstone2&3 Severity: major
Keywords: Cc:

Description

Commit message for 24600:

Added new gs-magick.pl script which will set the environment for ImageMagick? (including LD_LIBRARY_PATH) before launching the requested ImageMagick? command and arguments. By setting the Imagemagick environment from this script we ensure that the modified env variables don't create conflicts with libraries needed for normal linux execution. All the Greenstone files in the *binary* that made direct calls to imagemagick now go through this script. The affected files are perl files in bin/script and perllib and Gatherer.java of GLI. (wvware has files that test for imagemagick during compilation stage, which is independent of our changs which are only for users running imagemagick from a GS binary.) The final problems were related to how different perl files made use of the return values and the output of running their imagemagick command: they would query the $? and/or $! and/or run the command with backtick operators to get the output printed to STDOUT. By inserting an intermediate gs-magick.pl file, needed to ensure that the exit code stored in $? would at least be passed on correctly, as is necessary when testing the exit code against non-zero values or greater/less than zero (instead of comparing them with equals/not equal to 0). To get the correct exit code as emitted by imagemagick, calling code needs to shift bits in $? and converting it to a signed value."

Adding bin/script/gs-magick.pl

Sending bin/script/gsConvert.pl Sending bin/script/pdfpstoimg.pl Sending bin/script/pdftohtml.pl

Sending perllib/cgiactions/imageaction.pm Sending perllib/convertutil.pm Sending perllib/giget.pm

Sending perllib/plugins/HTMLImagePlugin.pm Sending perllib/plugins/ImageConverter.pm Sending perllib/plugins/StructuredHTMLPlugin.pm

Sending gli/src/org/greenstone/gatherer/Gatherer.java

Change History

Changed 8 years ago by ak19

  • status changed from new to closed
  • resolution set to fixed

Changed 8 years ago by ak19

Clarifying the above list of changed and added files (r 24600):

Adding bin/script/gs-magick.pl

Sending bin/script/gsConvert.pl

Sending bin/script/pdfpstoimg.pl

Sending bin/script/pdftohtml.pl

Sending perllib/cgiactions/imageaction.pm

Sending perllib/convertutil.pm

Sending perllib/giget.pm

Sending perllib/plugins/HTMLImagePlugin.pm

Sending perllib/plugins/ImageConverter.pm

Sending perllib/plugins/StructuredHTMLPlugin.pm

Sending gli/src/org/greenstone/gatherer/Gatherer.java

Changed 8 years ago by ak19

Committed revision 24601

Dr Bainbridge suggested corrections to commits of revision 24600: 1. gs-magick.pl: close call on Pipe only if successfully opened. 2. Command_status always needs to be shifted and turned into its signed value for display in convertutil.pm. 3. giget calls to imagemagick more eficient: doesn't call identify twice, but just once since the exit code and output to STDOUT can both be inspected after just one call. Moreover, exit code needed to be tested for equality against 0, not whether it is greater than 0, so no shifting and converting to signed value required." perllib/ bin/script/

Sending bin/script/gs-magick.pl

Sending perllib/convertutil.pm

Sending perllib/giget.pm

Changed 8 years ago by ak19

Revision 24606 to bin\script\gs-magick.pl: env var GSDLARCH isn't compulsory on Windows (windows doesn't set this when setup.bat is run).

Dr Bainbridge and John Thompson worked out the complicated details of how to propagate the $? and $! from a program called by one script called by another script.

Changed 8 years ago by ak19

Commit 24610: setup.bash

setup.bash no longer sets imagemagick env vars. These are set in the new bin\script\gs-magick.pl script.

Note: See TracTickets for help on using tickets.