Bugs finding coders relative to executable
Posted: 2011-11-09T09:04:36-07:00
Tested on ImageMagick 6.7.1, built on and for Intel 32-bit Ubuntu 10.04, but the code appears still to be incorrect on the SVN head.
The ImageMagick resources page states that ImageMagick will search "<client path>/../lib/ImageMagick-6.7.3/modules-Q16/coders/" for coders, however ImageMagick (specifically convert) wasn't finding coders in this location. Investigating the source code I found two reasons for this:
1. magick.c line 1277 (in version 6.7.1) correctly calls GetExecutionPath, but then, unless path is blank or null, ignores the result and uses path. path will normally be arg0 (the command used to start the application) when this is called. If arg0 isn't a full path name then line 1282 won't get a useful directory location. Proposed fix, reverse the logic of lines 1278 and 1279 so that is prefers the result of GetExecutionPath:
2. Modules.c line 753 is looking in a directory called "modules". It should be looking in a directory called "coders".
The ImageMagick resources page states that ImageMagick will search "<client path>/../lib/ImageMagick-6.7.3/modules-Q16/coders/" for coders, however ImageMagick (specifically convert) wasn't finding coders in this location. Investigating the source code I found two reasons for this:
1. magick.c line 1277 (in version 6.7.1) correctly calls GetExecutionPath, but then, unless path is blank or null, ignores the result and uses path. path will normally be arg0 (the command used to start the application) when this is called. If arg0 isn't a full path name then line 1282 won't get a useful directory location. Proposed fix, reverse the logic of lines 1278 and 1279 so that is prefers the result of GetExecutionPath:
Code: Select all
if ((execution_path == (const char *) NULL) || (execution_path == '\0'))
(void) CopyMagickString(execution_path,path,MaxTextExtent);