From 56115931923d0314ae87d499dda5dc8e52224ac63a4afef2bdc9737f95012316 Mon Sep 17 00:00:00 2001 From: "Dr. Werner Fink" Date: Wed, 1 Dec 2010 11:41:01 +0000 Subject: [PATCH 1/2] . OBS-URL: https://build.opensuse.org/package/show/graphics/xfig?expand=0&rev=13 --- xfig.3.2.5b-preview.dif | 39 +++++++++++++++++++++++++++++++++++---- xfig.changes | 8 ++++++++ 2 files changed, 43 insertions(+), 4 deletions(-) diff --git a/xfig.3.2.5b-preview.dif b/xfig.3.2.5b-preview.dif index fb3aaa7..d370b50 100644 --- a/xfig.3.2.5b-preview.dif +++ b/xfig.3.2.5b-preview.dif @@ -1,12 +1,43 @@ --- f_readeps.c -+++ f_readeps.c 2010-08-10 10:50:57.699132894 +0000 -@@ -318,8 +318,8 @@ bitmap_from_gs(file, filetype, pic, urx, - gscom[0] = '\0'; ++++ f_readeps.c 2010-12-01 11:26:52.786700258 +0000 +@@ -257,6 +257,7 @@ bitmap_from_gs(file, filetype, pic, urx, + char tmpfile[PATH_MAX], + pixnam[PATH_MAX], + errnam[PATH_MAX], ++ psnam[PATH_MAX], + gscom[2 * PATH_MAX]; + + wid = urx - llx; +@@ -307,19 +308,22 @@ bitmap_from_gs(file, filetype, pic, urx, + /* 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" gs after .locksafe */ ++ if (!realpath(tmpfile, psnam)) { ++ file_msg("Cannot canonicalize %s: %s\n", tmpfile, strerror(errno)); ++ return False; + } ++ /* From Language.htm of ghostscript 9.00 and higher: ++ * If Ghostscript is started with -dNOSAFER or -dDELAYSAFER, this operator can ++ * be used to enter SAFER mode with the current set of PermitFile... user ++ * parameters in effect. Since .setsafe sets the PermitFile... user parameters ++ * to empty arrays, a script or job server that needs to enable certain paths ++ * for file Reading, Writing and/or Control can use this operator to perform ++ * the locking needed to enter SAFER mode. ++ */ 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); -+ "%s -r72x72 -dNOSAFER -sDEVICE=%s -g%dx%d -sOutputFile=%s -c '<> setuserparams .locksafe' -q - > %s 2>&1", ++ "%s -r72x72 -sDEVICE=%s -g%dx%d -dDELAYSAFER -sOutputFile=%s -c '<> setuserparams .locksafe' -q - > %s 2>&1", + appres.ghostscript, driver, wid, ht, pixnam, psnam, errnam); if (appres.DEBUG) fprintf(stderr,"calling: %s\n",gscom); diff --git a/xfig.changes b/xfig.changes index 572d82b..e8bcce9 100644 --- a/xfig.changes +++ b/xfig.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Wed Dec 1 12:27:48 CET 2010 - werner@suse.de + +- Do canonicalize the eps files used with the previous fix + (thanks goes to Hans de Goede from RedHat) +- Make previous fix more clear by adding a command how the + used .locksafe operator works + ------------------------------------------------------------------- Tue Aug 10 13:00:25 CEST 2010 - werner@suse.de From 047586f694810be51ff530f0b8ae67906abefb787e89e4cce41785bc9048ceef Mon Sep 17 00:00:00 2001 From: "Dr. Werner Fink" Date: Wed, 1 Dec 2010 14:26:20 +0000 Subject: [PATCH 2/2] . OBS-URL: https://build.opensuse.org/package/show/graphics/xfig?expand=0&rev=14 --- xfig.3.2.5b-preview.dif | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/xfig.3.2.5b-preview.dif b/xfig.3.2.5b-preview.dif index d370b50..9f91efb 100644 --- a/xfig.3.2.5b-preview.dif +++ b/xfig.3.2.5b-preview.dif @@ -1,6 +1,12 @@ --- f_readeps.c -+++ f_readeps.c 2010-12-01 11:26:52.786700258 +0000 -@@ -257,6 +257,7 @@ bitmap_from_gs(file, filetype, pic, urx, ++++ f_readeps.c 2010-12-01 14:26:05.884195851 +0000 +@@ -252,11 +252,12 @@ bitmap_from_gs(file, filetype, pic, urx, + { + 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],