[xfig/f14/master] - Fix importing of eps files (#657290)

Hans de Goede jwrdegoede at fedoraproject.org
Thu Nov 25 16:04:33 UTC 2010


commit 6de36c8ca7efcc59ed2719c84b2d695fc9c03ad8
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Thu Nov 25 17:03:30 2010 +0100

    - Fix importing of eps files (#657290)

 xfig-3.2.5b-fix-eps-reading.patch |   46 +++++++++++++++++++++++++++++++++++++
 xfig.spec                         |    7 +++++-
 2 files changed, 52 insertions(+), 1 deletions(-)
---
diff --git a/xfig-3.2.5b-fix-eps-reading.patch b/xfig-3.2.5b-fix-eps-reading.patch
new file mode 100644
index 0000000..7601d20
--- /dev/null
+++ b/xfig-3.2.5b-fix-eps-reading.patch
@@ -0,0 +1,46 @@
+diff -ur xfig.3.2.5b/f_readeps.c xfig.3.2.5b.new/f_readeps.c
+--- xfig.3.2.5b/f_readeps.c	2009-03-30 17:52:18.000000000 +0200
++++ xfig.3.2.5b.new/f_readeps.c	2010-11-25 16:53:54.328247928 +0100
+@@ -252,12 +252,13 @@
+ {
+     char        buf[300];
+     FILE       *tmpfp, *pixfile, *gsfile;
+-    char       *psnam, *driver;
++    char       *driver;
+     int         status, wid, ht, nbitmap, fd;
+     char        tmpfile[PATH_MAX],
+ 		pixnam[PATH_MAX],
+ 		errnam[PATH_MAX],
+-		gscom[2 * PATH_MAX];
++		gscom[2 * PATH_MAX],
++		psnam[PATH_MAX];
+ 
+     wid = urx - llx;
+     ht = ury - lly;
+@@ -307,19 +308,14 @@
+ 	/* for color, use pcx */
+ 	driver = "pcx256";
+     }
+-    /* avoid absolute paths (for Cygwin with gswin32) by changing directory */
+-    if (tmpfile[0] == '/') {
+-	psnam = strrchr(tmpfile, '/');
+-	*psnam = 0;
+-	sprintf(gscom, "cd \"%s/\";", tmpfile);
+-	*psnam++ = '/';		/* Restore name for unlink() below */
+-    } else {
+-	psnam = tmpfile;
+-	gscom[0] = '\0';
++    /* Canonicalize the eps file filename, needed to "defeat" -dSAFER */
++    if (!realpath(tmpfile, psnam)) {
++	file_msg("Cannot canonicalize %s: %s\n", tmpfile, strerror(errno));
++	return False;
+     }
+-    sprintf(&gscom[strlen(gscom)],
+-	    "%s -r72x72 -dSAFER -sDEVICE=%s -g%dx%d -sOutputFile=%s -q - > %s 2>&1",
+-	    appres.ghostscript, driver, wid, ht, pixnam, errnam);
++    sprintf(gscom,
++	    "%s -r72x72 -sDEVICE=%s -g%dx%d -sOutputFile=%s -dDELAYSAFER -c '<< /PermitFileReading [ (%s)] >> setuserparams .locksafe' -dSAFER -q - > %s 2>&1",
++	    appres.ghostscript, driver, wid, ht, pixnam, psnam, errnam);
+     if (appres.DEBUG)
+ 	fprintf(stderr,"calling: %s\n",gscom);
+     if ((gsfile = popen(gscom, "w")) == 0) {
diff --git a/xfig.spec b/xfig.spec
index a044659..b23766b 100644
--- a/xfig.spec
+++ b/xfig.spec
@@ -3,7 +3,7 @@
 Summary: An X Window System tool for drawing basic vector graphics
 Name: xfig
 Version: 3.2.5
-Release: 23.b%{?dist}
+Release: 24.b%{?dist}
 License: MIT
 Group: Applications/Multimedia
 URL: http://www.xfig.org/
@@ -19,6 +19,7 @@ Patch9: xfig.3.2.5-Xaw3d.patch
 Patch10: xfig-3.2.5-enable-Xaw3d.patch
 Patch13: xfig-3.2.5-urwfonts.patch
 Patch19: xfig-3.2.5-debian.patch
+Patch20: xfig-3.2.5b-fix-eps-reading.patch
 
 BuildRequires: libjpeg-devel
 BuildRequires: libpng-devel
@@ -92,6 +93,7 @@ Files common to both the plain Xaw and the Xaw3d version of xfig.
 %patch10 -p1 -b .no-Xaw3d
 %patch13 -p1 -b .urw
 %patch19 -p1
+%patch20 -p1
 iconv -f ISO-8859-1 -t UTF8 CHANGES > tmp; touch -r CHANGES tmp; mv tmp CHANGES
 rm Doc/html/images/sav1a0.tmp
 chmod -x `find -type f`
@@ -184,6 +186,9 @@ fi
 
 
 %changelog
+* Thu Nov 25 2010 Hans de Goede <hdegoede at redhat.com> 3.2.5-24.b
+- Fix importing of eps files (#657290)
+
 * Wed Sep 30 2009 Hans de Goede <hdegoede at redhat.com> 3.2.5-23.b
 - New upstream 3.2.5b release
 - Drop many merged patches


More information about the scm-commits mailing list