correctly load plugins (#1247187)
This commit is contained in:
parent
0043c8dfc7
commit
a583201fd2
109
pstoedit-pkglibdir.patch
Normal file
109
pstoedit-pkglibdir.patch
Normal file
@ -0,0 +1,109 @@
|
||||
Fix for pstoedit search for plugins.
|
||||
|
||||
By default, pstoedit "make install" installs to PSTOEDITLIBDIR, so if
|
||||
nobody moves them to another location, then it is sufficient to search in
|
||||
PSTOEDITLIBDIR.
|
||||
|
||||
|
||||
But the way how pstoedit searches for plugins is broken:
|
||||
|
||||
If pstoedit.reg does not exist or does not contain common/plugindir, then
|
||||
it tries $exepath/../lib/pstoedit, always sets pluginsloaded, and never
|
||||
tries PSTOEDITLIBDIR.
|
||||
|
||||
If pstoedit.reg contains common/plugindir, then it tries that path,
|
||||
always sets pluginsloaded, and never tries PSTOEDITLIBDIR.
|
||||
|
||||
=> The default installation directory is never tried, if it is not equal
|
||||
to one of above.
|
||||
|
||||
|
||||
The implementation has just another problem:
|
||||
|
||||
If pstoedit.reg contains common/plugindir, and the directory defined
|
||||
there is equal to $pkglibdir, but the string is not literally
|
||||
"{expansion_of_bindir}/../lib/pstoedit", then plugins are loaded twice.
|
||||
So the check as it is makes only a little sense, because nobody would
|
||||
create ~/.pstoedit.reg containing:
|
||||
|
||||
common/plugindir=/usr/bin/../lib/pstoedit
|
||||
|
||||
|
||||
The new implementation does things differently:
|
||||
|
||||
If common/plugindir is defined, it checks only that directory.
|
||||
|
||||
It swaps the check order: First checks whether PSTOEDITLIBDIR exists. If
|
||||
it exists, it skips blind attempts to find plugins.
|
||||
|
||||
As PSTOEDITLIBDIR is always defined by makefile, the blind fallback will
|
||||
be attempted only in obscure environments.
|
||||
|
||||
|
||||
Index: pstoedit-3.70/src/pstoedit.cpp
|
||||
===================================================================
|
||||
--- pstoedit-3.70.orig/src/pstoedit.cpp
|
||||
+++ pstoedit-3.70/src/pstoedit.cpp
|
||||
@@ -30,6 +30,7 @@
|
||||
#include I_string_h
|
||||
|
||||
#include <assert.h>
|
||||
+#include <sys/stat.h>
|
||||
|
||||
#include "pstoeditoptions.h"
|
||||
|
||||
@@ -261,33 +262,33 @@ static void loadpstoeditplugins(const ch
|
||||
loadPlugInDrivers(plugindir.c_str(), errstream, verbose); // load the driver plugins
|
||||
pluginsloaded = true;
|
||||
}
|
||||
- // also look in the directory where the pstoedit .exe/dll was found
|
||||
- char szExePath[1000];
|
||||
- szExePath[0] = '\0';
|
||||
- const unsigned long r = P_GetPathToMyself(progname, szExePath, sizeof(szExePath));
|
||||
- if (verbose) errstream << "pstoedit : path to myself:" << progname << " " << r << " " << szExePath<< endl;
|
||||
- char *p = 0;
|
||||
- if (r && (p = strrchr(szExePath, directoryDelimiter)) != 0) {
|
||||
- *p = '\0';
|
||||
- if (!strequal(szExePath, plugindir.c_str())) {
|
||||
- loadPlugInDrivers(szExePath, errstream,verbose);
|
||||
- pluginsloaded = true;
|
||||
- }
|
||||
- }
|
||||
- // now try also $exepath/../lib/pstoedit
|
||||
- strcat_s(szExePath,1000,"/../lib/pstoedit");
|
||||
- if (!strequal(szExePath, plugindir.c_str())) {
|
||||
- loadPlugInDrivers(szExePath, errstream,verbose);
|
||||
- pluginsloaded = true;
|
||||
- }
|
||||
-
|
||||
#ifdef PSTOEDITLIBDIR
|
||||
- if (!pluginsloaded) {
|
||||
+ struct stat s;
|
||||
+ if (!pluginsloaded &&
|
||||
+ !stat(PSTOEDITLIBDIR, &s) &&
|
||||
+ S_ISDIR(s.st_mode)) {
|
||||
// also try to load drivers from the PSTOEDITLIBDIR
|
||||
loadPlugInDrivers(PSTOEDITLIBDIR, errstream,verbose);
|
||||
pluginsloaded = true;
|
||||
}
|
||||
#endif
|
||||
+ // If the above failed, also look in the directory where the pstoedit .exe/dll was found
|
||||
+ if (!pluginsloaded) {
|
||||
+ char szExePath[1000];
|
||||
+ szExePath[0] = '\0';
|
||||
+ const unsigned long r = P_GetPathToMyself(progname, szExePath, sizeof(szExePath));
|
||||
+ if (verbose) errstream << "pstoedit : path to myself:" << progname << " " << r << " " << szExePath<< endl;
|
||||
+ char *p = 0;
|
||||
+ if (r && (p = strrchr(szExePath, directoryDelimiter)) != 0) {
|
||||
+ *p = '\0';
|
||||
+ loadPlugInDrivers(szExePath, errstream,verbose);
|
||||
+ }
|
||||
+ // now try also $exepath/../lib/pstoedit
|
||||
+ strcat_s(szExePath,1000,"/../lib/pstoedit");
|
||||
+ if (!strequal(szExePath, plugindir.c_str())) {
|
||||
+ loadPlugInDrivers(szExePath, errstream,verbose);
|
||||
+ }
|
||||
+ }
|
||||
|
||||
// delete[]plugindir;
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
Name: pstoedit
|
||||
Version: 3.70
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
Summary: Translates PostScript and PDF graphics into other vector formats
|
||||
|
||||
Group: Applications/Productivity
|
||||
@ -8,6 +8,8 @@ License: GPLv2+
|
||||
URL: http://www.pstoedit.net/
|
||||
Source0: http://downloads.sourceforge.net/pstoedit/pstoedit-%{version}.tar.gz
|
||||
|
||||
Patch0: pstoedit-pkglibdir.patch
|
||||
|
||||
Requires: ghostscript
|
||||
BuildRequires: gd-devel
|
||||
BuildRequires: libpng-devel
|
||||
@ -39,6 +41,9 @@ applications
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
# correctly load plugins (#1247187)
|
||||
%patch0 -p1 -b .pkglibdir
|
||||
|
||||
dos2unix doc/*.htm doc/readme.txt
|
||||
|
||||
|
||||
@ -84,6 +89,9 @@ find $RPM_BUILD_ROOT -type f -name "*.la" -exec rm -f {} ';'
|
||||
|
||||
|
||||
%changelog
|
||||
* Mon Jul 27 2015 Jiri Popelka <jpopelka@redhat.com> - 3.70-2
|
||||
- correctly load plugins (#1247187)
|
||||
|
||||
* Mon Jan 05 2015 Jiri Popelka <jpopelka@redhat.com> - 3.70-1
|
||||
- 3.70
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user