Accepting request 1112311 from Publishing

- Update to fig2dev version 3.2.9 (Aug 2023)
  o Write utf8-encoded postscript and tex-outputs.
    Ticket numbers refer to https://sourceforge.net/p/mcj/tickets/#.
  o Include sys/wait.h to build on some bsds.
  o Process crafted input files, tickets #142, #145, #146, #147, #148,
    and #152.
  o Correctly scale dxf output, ticket #91.
  o Correct a typo causing incorrect eps import, ticket #137.
  o Regression, pass driver names to driver, ticket #139.
- Port and rename patch transfig-3.2.8.dif which is now transfig-3.2.9.dif
- Port patches
  * fig2dev-3.2.6-fig2mpdf.patch
  * transfig-fix-afl.patch
- Remove patches now upstream
  * 0001-Make-ModDate-and-CreationDate-in-PDF-reproducible.patch
  * 1b09a8.patch

OBS-URL: https://build.opensuse.org/request/show/1112311
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/transfig?expand=0&rev=56
This commit is contained in:
Ana Guerrero 2023-09-21 20:13:18 +00:00 committed by Git OBS Bridge
commit 173df1b9fa
10 changed files with 165 additions and 302 deletions

View File

@ -1,123 +0,0 @@
From e72a9d017742366cba636d783ea121279bfb7d6c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Thu, 9 Mar 2023 19:19:51 +0100
Subject: [PATCH] Make ModDate and CreationDate in PDF reproducible
Ghostscript ignores the date in the preamble and uses the current
time instead. This notably breaks the SOURCE_DATE_EPOCH support
for reproducible builds.
Passing the creation time as DOCINFO pdfmark forces gs to use the
specified date/time. Although ghostscript still adds the unreproducible
DocumentUUID and trailer ID, it is sufficient when including the PDF
figure with pdflatex.
Reuse the SOURCE_DATE_EPOCH code from creation_date for determining
the wanted timestamp, and return the formatted time via the new
`creation_date_pdfmark` function.
---
fig2dev/creationdate.c | 38 +++++++++++++++++++++++++++++++++-----
fig2dev/creationdate.h | 1 +
fig2dev/dev/genps.c | 8 ++++++++
3 files changed, 42 insertions(+), 5 deletions(-)
diff --git a/fig2dev/creationdate.c b/fig2dev/creationdate.c
index a51bfd4..de914a5 100644
--- a/fig2dev/creationdate.c
+++ b/fig2dev/creationdate.c
@@ -36,8 +36,8 @@
#include "creationdate.h"
-int
-creation_date(char *buf)
+static struct tm*
+parse_time()
{
time_t now;
@@ -70,15 +70,43 @@ creation_date(char *buf)
} else {
/* no errors, epoch is valid */
now = epoch;
- strftime(buf, CREATION_TIME_LEN, "%F %H:%M:%S", gmtime(&now));
- return true;
+ return gmtime(&now);
}
}
#endif
/* fall trough on errors or !source_date_epoch */
time(&now);
- if (strftime(buf, CREATION_TIME_LEN, "%F %H:%M:%S", localtime(&now)))
+ return localtime(&now);
+}
+
+static struct tm*
+get_time()
+{
+ static struct tm time = { 0 };
+ static int initialized = 0;
+ if (!initialized) {
+ time = *parse_time();
+ initialized = 1;
+ }
+ return &time;
+}
+
+int
+creation_date(char *buf)
+{
+ if (strftime(buf, CREATION_TIME_LEN, "%F %H:%M:%S", get_time()))
+ return true;
+ else
+ return false;
+}
+
+int
+creation_date_pdfmark(char *buf)
+{
+ // Pdfmark format should be D:YYYYMMDDHHmmSSOHHmm.
+ // Timezone offset (O...) may be omitted
+ if (strftime(buf, CREATION_TIME_LEN, "D:%Y%m%d%H%M%S", get_time()))
return true;
else
return false;
diff --git a/fig2dev/creationdate.h b/fig2dev/creationdate.h
index 048508a..199d985 100644
--- a/fig2dev/creationdate.h
+++ b/fig2dev/creationdate.h
@@ -21,3 +21,4 @@
#define CREATION_TIME_LEN 36
extern int creation_date(char *buf);
+extern int creation_date_pdfmark(char *buf);
diff --git a/fig2dev/dev/genps.c b/fig2dev/dev/genps.c
index 5bea35c..48e05a6 100644
--- a/fig2dev/dev/genps.c
+++ b/fig2dev/dev/genps.c
@@ -1181,6 +1181,7 @@ genps_end(void)
const int h = pageheight, w = pagewidth;
int epslen, tiflen;
struct stat fstat;
+ char date_buf[CREATION_TIME_LEN];
/* for multipage, translate and output objects for each page */
if (multi_page) {
@@ -1368,6 +1369,13 @@ genps_end(void)
/* final DSC comment for eps output (EOF = end of document) */
fputs("%EOF\n", tfp);
+ if (pdfflag) {
+ if (creation_date_pdfmark(date_buf))
+ fprintf(tfp,
+ "[ /ModDate (%s)\n /CreationDate (%s)\n /DOCINFO pdfmark\n",
+ date_buf, date_buf);
+ }
+
/* all ok */
return 0;
}
--
2.39.2

View File

@ -1,25 +0,0 @@
From 1b09a885a8f0309bf1170ddcf07673801c79f895 Mon Sep 17 00:00:00 2001
From: Thomas Loimer <thomas.loimer@tuwien.ac.at>
Date: Tue, 28 Sep 2021 21:58:41 +0200
Subject: [PATCH] Correct a typo causing incorrect eps import, #137
---
fig2dev/dev/readeps.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git fig2dev/dev/readeps.c fig2dev/dev/readeps.c
index a7d6008..efeb33e 100644
--- fig2dev/dev/readeps.c
+++ fig2dev/dev/readeps.c
@@ -346,7 +346,7 @@ read_eps(F_pic *pic, struct xfig_stream *restrict pic_stream, int *llx,int *lly)
}
*llx = floor(rllx);
*lly = floor(rlly);
- pic->bit_size.x = (int)(rurx - rlly);
+ pic->bit_size.x = (int)(rurx - rllx);
pic->bit_size.y = (int)(rury - rlly);
break;
}
--
2.28.0

View File

@ -25,7 +25,7 @@ diff --git a/fig2dev/dev/genpstex.c b/fig2dev/dev/genpstex.c
extern double rad2deg;
@@ -78,6 +81,308 @@ extern void genps_grid(float major, floa
@@ -74,6 +78,308 @@ extern void genps_grid(float major, floa
static char pstex_file[1000] = "";
@ -334,7 +334,7 @@ diff --git a/fig2dev/dev/genpstex.c b/fig2dev/dev/genpstex.c
void
genpstex_t_option(char opt, char *optarg)
{
@@ -127,6 +432,32 @@ genpstex_option(char opt, char *optarg)
@@ -123,6 +429,32 @@ genpstex_option(char opt, char *optarg)
genlatex_option(opt, optarg);
}
@ -400,7 +400,7 @@ diff --git a/fig2dev/drivers.h b/fig2dev/drivers.h
diff --git a/fig2dev/fig2dev.c b/fig2dev/fig2dev.c
--- a/fig2dev/fig2dev.c
+++ b/fig2dev/fig2dev.c
@@ -844,6 +844,23 @@ help_msg(void)
@@ -829,6 +829,23 @@ help_msg(void)
);
}
@ -424,7 +424,7 @@ diff --git a/fig2dev/fig2dev.c b/fig2dev/fig2dev.c
if (dev == NULL || !strcmp(lang, "shape")) {
puts(
"SHAPE (ShapePar driver) Options:\n"
@@ -991,6 +1008,12 @@ static int compound_dump(F_compound *com
@@ -974,6 +991,12 @@ static int compound_dump(F_compound *com
static int
rec_comp(struct obj_rec *r1, struct obj_rec *r2)
{
@ -1349,7 +1349,7 @@ diff --git a/man/fig2dev.1.in b/man/fig2dev.1.in
shape (LaTeX shaped paragraphs), sld (AutoCad slide format), svg,
textyl, tiff, tikz, tk (tcl/tk), tpic, xbm and xpm\fR.
@@ -1178,6 +1178,61 @@ text flagged as "TeX Text".
@@ -1145,6 +1145,61 @@ text flagged as "TeX Text".
The pstex and pdftex drivers accept the same options that the EPS driver
accepts.
@ -1411,7 +1411,7 @@ diff --git a/man/fig2dev.1.in b/man/fig2dev.1.in
.TP
.B \-n name
Set the Title part of the PostScript output to
@@ -1601,6 +1656,12 @@ The string \fIfont\fR can be one of
@@ -1551,6 +1606,12 @@ The string \fIfont\fR can be one of
.SH BUGS and RESTRICTIONS
@ -1424,7 +1424,7 @@ diff --git a/man/fig2dev.1.in b/man/fig2dev.1.in
Please send bug reports, fixes, new features etc. to:
.br
\&@PACKAGE_BUGREPORT@
@@ -1690,3 +1751,7 @@ Michael Schrick (m_schrick@hotmail.com)
@@ -1640,3 +1701,7 @@ Michael Schrick (m_schrick@hotmail.com)
The GBX (Gerber) driver was written by
.br
Edward Grace (ej.grace@imperial.ac.uk).

BIN
fig2dev-3.2.8b.tar.xz (Stored with Git LFS)

Binary file not shown.

3
fig2dev-3.2.9.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:15e246c8d13cc72de25e08314038ad50ce7d2defa9cf1afc172fd7f5932090b1
size 529892

View File

@ -1,115 +0,0 @@
---
configure | 2 +-
fig2dev/dev/genps.c | 32 ++++++++++++++++++++++----------
fig2dev/dev/genpstex.c | 8 ++++++--
fig2dev/fig2ps2tex.csh | 2 +-
fig2dev/lib/getopt.c | 9 +++++++++
transfig/transfig.c | 2 ++
6 files changed, 41 insertions(+), 14 deletions(-)
--- configure
+++ configure 2021-02-12 08:54:37.958704809 +0000
@@ -2341,7 +2341,7 @@ ac_c_conftest_c99_main='
int dynamic_array[ni.number];
dynamic_array[0] = argv[0][0];
dynamic_array[ni.number - 1] = 543;
-
+ free(ia);
// work around unused variable warnings
ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\''
|| dynamic_array[ni.number - 1] != 543);
--- fig2dev/dev/genps.c
+++ fig2dev/dev/genps.c 2021-02-12 09:13:56.896176342 +0000
@@ -56,6 +56,7 @@
#include <pwd.h>
#endif
#include <locale.h>
+#include <langinfo.h>
#include "fig2dev.h" /* includes bool.h and object.h */
//#include "object.h" /* NUMSHADES, NUMTINTS */
@@ -958,9 +959,10 @@ genps_start(F_compound *objects)
fprintf(tfp, "%s\n", SPLINE_PS);
#ifdef I18N
if (support_i18n && iso_text_exist(objects)) {
- char *libdir, *locale;
- char localefile_buf[128];
- char *localefile = localefile_buf;
+ char *libdir, *locale, *codeset;
+ char *localefile = NULL;
+ size_t llen;
+ int ret;
FILE *fp;
libdir = getenv("FIG2DEV_LIBDIR");
#ifdef I18N_DATADIR
@@ -968,19 +970,30 @@ genps_start(F_compound *objects)
libdir = I18N_DATADIR;
#endif
locale = setlocale(LC_CTYPE, NULL);
+ llen = strcspn(locale, ".@");
+ codeset = nl_langinfo(CODESET);
if (locale == NULL) {
fprintf(stderr,
"fig2dev: LANG not defined; assuming C locale\n");
locale = "C";
}
- if (strlen(libdir) + strlen(locale) + 5 > sizeof localefile_buf)
- localefile = malloc(strlen(libdir) + strlen(locale) + 5);
- if (localefile != NULL) {
- sprintf(localefile, "%s/%s.ps", libdir, locale);
+ retry:
+ ret = asprintf(&localefile, "%s/%s.ps", libdir, locale);
+ if (ret > 0) {
/* get filename like
``/usr/local/lib/fig2dev/japanese.ps'' */
fp = fopen(localefile, "rb");
if (fp == NULL) {
+ if (strlen(locale) != llen) {
+ free(localefile);
+ locale[llen] = '\0';
+ goto retry;
+ }
+ if (codeset && locale != codeset) {
+ free(localefile);
+ locale = codeset;
+ goto retry;
+ }
fprintf(stderr, "fig2dev: can not open file: %s\n",
localefile);
} else {
@@ -998,11 +1011,10 @@ genps_start(F_compound *objects)
"The output might be broken.\n",
localefile);
}
- fclose(fp);
+ fclose(fp);
}
- }
- if (localefile != localefile_buf)
free(localefile);
+ }
}
#endif /* I18N */
--- fig2dev/fig2ps2tex.csh
+++ fig2dev/fig2ps2tex.csh 2021-02-12 08:54:37.954704887 +0000
@@ -22,7 +22,7 @@
# 2016-07-07 Thomas Loimer
# * use here-document, instead of echo
#
-
+set echo_style = bsd
set bbox = `grep "^%%BoundingBox:" $1`
set xsp = `echo "3k $bbox[4] $bbox[2] - 72 / p" | dc`
--- transfig/transfig.c
+++ transfig/transfig.c 2021-02-12 08:54:37.954704887 +0000
@@ -26,6 +26,8 @@
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
#include "transfig.h"
extern void sysmv(char *file); /* sys.c */

110
transfig-3.2.9.dif Normal file
View File

@ -0,0 +1,110 @@
---
configure | 2 +-
fig2dev/dev/genps.c | 34 ++++++++++++++++++++++------------
fig2dev/fig2ps2tex.csh | 2 +-
transfig/transfig.c | 2 ++
4 files changed, 26 insertions(+), 14 deletions(-)
--- configure
+++ configure 2023-09-15 07:11:23.442594968 +0000
@@ -2340,7 +2340,7 @@ ac_c_conftest_c99_main='
int dynamic_array[ni.number];
dynamic_array[0] = argv[0][0];
dynamic_array[ni.number - 1] = 543;
-
+ free(ia);
// work around unused variable warnings
ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\''
|| dynamic_array[ni.number - 1] != 543);
--- fig2dev/dev/genps.c
+++ fig2dev/dev/genps.c 2023-09-15 07:31:46.828409272 +0000
@@ -53,6 +53,7 @@
#include <ctype.h> /* tolower() */
#include <sys/stat.h> /* struct stat */
#include <locale.h>
+#include <langinfo.h>
#include "fig2dev.h" /* includes bool.h and object.h */
//#include "object.h" /* NUMSHADES, NUMTINTS */
@@ -1363,10 +1364,10 @@ append(const char *restrict infilename,
static bool
append_find_composite(FILE *restrict out)
{
- char *libdir, *locale;
- char localefile_buf[128];
- char *localefile = localefile_buf;
+ char *libdir, *locale, *codeset;
+ char *localefile = NULL;
FILE *in;
+ int ret;
libdir = getenv("FIG2DEV_LIBDIR");
#ifdef I18N_DATADIR
@@ -1378,18 +1379,28 @@ append_find_composite(FILE *restrict out
fputs(COMPOSITE_ERRMSG, stderr);
return false;
}
- if (strlen(libdir) + strlen(locale) + 5 > sizeof localefile_buf &&
- !(localefile = malloc(strlen(libdir) + strlen(locale) + 5))) {
- put_msg(Err_mem);
+ codeset = nl_langinfo(CODESET);
+retry:
+ ret = asprintf(&localefile, "%s/%s.ps", libdir, locale);
+ if (ret < 0) {
+ err_msg("Unable to open postscript prologue file %s");
return false;
}
-
- sprintf(localefile, "%s/%s.ps", libdir, locale);
/* get filename like /usr/local/lib/fig2dev/japanese.ps */
if (!(in = fopen(localefile, "rb"))) {
- err_msg("Unable to open postscript prologue file %s");
- if (localefile != localefile_buf)
+ size_t llen = strcspn(locale, ".@");
+ if (strlen(locale) != llen) {
+ free(localefile);
+ locale[llen] = '\0';
+ goto retry;
+ }
+ if (codeset && locale != codeset) {
free(localefile);
+ locale = codeset;
+ goto retry;
+ }
+ err_msg("Unable to open postscript prologue file %s");
+ free(localefile);
return false;
}
@@ -1443,8 +1454,7 @@ append_find_composite(FILE *restrict out
put_msg("The output might be broken.");
}
- if (localefile != localefile_buf)
- free(localefile);
+ free(localefile);
return found;
}
--- fig2dev/fig2ps2tex.csh
+++ fig2dev/fig2ps2tex.csh 2023-09-15 07:11:23.442594968 +0000
@@ -22,7 +22,7 @@
# 2016-07-07 Thomas Loimer
# * use here-document, instead of echo
#
-
+set echo_style = bsd
set bbox = `grep "^%%BoundingBox:" $1`
set xsp = `echo "3k $bbox[4] $bbox[2] - 72 / p" | dc`
--- transfig/transfig.c
+++ transfig/transfig.c 2023-09-15 07:11:23.442594968 +0000
@@ -26,6 +26,8 @@
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
#include "transfig.h"
extern void sysmv(char *file); /* sys.c */

View File

@ -1,32 +1,32 @@
---
fig2dev-3.2.8/fig2dev/alloc.h | 20 ++++++++++----------
fig2dev-3.2.9/fig2dev/alloc.h | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
--- fig2dev-3.2.8/fig2dev/alloc.h
+++ fig2dev-3.2.8/fig2dev/alloc.h 2021-02-12 09:43:47.313357380 +0000
--- fig2dev-3.2.9/fig2dev/alloc.h
+++ fig2dev-3.2.9/fig2dev/alloc.h 2023-09-15 06:57:41.669499853 +0000
@@ -19,15 +19,15 @@
#ifndef ALLOC_H
#define ALLOC_H
-#define Line_malloc(z) z = malloc(LINOBJ_SIZE)
-#define Pic_malloc(z) z = malloc(PIC_SIZE)
-#define Spline_malloc(z) z = malloc(SPLOBJ_SIZE)
-#define Ellipse_malloc(z) z = malloc(ELLOBJ_SIZE)
-#define Arc_malloc(z) z = malloc(ARCOBJ_SIZE)
-#define Compound_malloc(z) z = malloc(COMOBJ_SIZE)
-#define Text_malloc(z) z = malloc(TEXOBJ_SIZE)
-#define Point_malloc(z) z = malloc(POINT_SIZE)
-#define Control_malloc(z) z = malloc(CONTROL_SIZE)
-#define Arrow_malloc(z) z = malloc(ARROW_SIZE)
+#define Line_malloc(z) z = calloc(LINOBJ_SIZE,1)
+#define Pic_malloc(z) z = calloc(PIC_SIZE,1)
+#define Spline_malloc(z) z = calloc(SPLOBJ_SIZE,1)
+#define Ellipse_malloc(z) z = calloc(ELLOBJ_SIZE,1)
+#define Arc_malloc(z) z = calloc(ARCOBJ_SIZE,1)
+#define Compound_malloc(z) z = calloc(COMOBJ_SIZE,1)
+#define Text_malloc(z) z = calloc(TEXOBJ_SIZE,1)
+#define Point_malloc(z) z = calloc(POINT_SIZE,1)
+#define Control_malloc(z) z = calloc(CONTROL_SIZE,1)
+#define Arrow_malloc(z) z = calloc(ARROW_SIZE,1)
-#define Line_malloc(z) ((z) = malloc(LINOBJ_SIZE))
-#define Pic_malloc(z) ((z) = malloc(PIC_SIZE))
-#define Spline_malloc(z) ((z) = malloc(SPLOBJ_SIZE))
-#define Ellipse_malloc(z) ((z) = malloc(ELLOBJ_SIZE))
-#define Arc_malloc(z) ((z) = malloc(ARCOBJ_SIZE))
-#define Compound_malloc(z) ((z) = malloc(COMOBJ_SIZE))
-#define Text_malloc(z) ((z) = malloc(TEXOBJ_SIZE))
-#define Point_malloc(z) ((z) = malloc(POINT_SIZE))
-#define Control_malloc(z) ((z) = malloc(CONTROL_SIZE))
-#define Arrow_malloc(z) ((z) = malloc(ARROW_SIZE))
+#define Line_malloc(z) ((z) = calloc(LINOBJ_SIZE,1))
+#define Pic_malloc(z) ((z) = calloc(PIC_SIZE,1))
+#define Spline_malloc(z) ((z) = calloc(SPLOBJ_SIZE,1))
+#define Ellipse_malloc(z) ((z) = calloc(ELLOBJ_SIZE,1))
+#define Arc_malloc(z) ((z) = calloc(ARCOBJ_SIZE,1))
+#define Compound_malloc(z) ((z) = calloc(COMOBJ_SIZE,1))
+#define Text_malloc(z) ((z) = calloc(TEXOBJ_SIZE,1))
+#define Point_malloc(z) ((z) = calloc(POINT_SIZE,1))
+#define Control_malloc(z) ((z) = calloc(CONTROL_SIZE,1))
+#define Arrow_malloc(z) ((z) = calloc(ARROW_SIZE,1))
#endif /* ALLOC_H */

View File

@ -1,3 +1,23 @@
-------------------------------------------------------------------
Fri Sep 15 07:41:38 UTC 2023 - Dr. Werner Fink <werner@suse.de>
- Update to fig2dev version 3.2.9 (Aug 2023)
o Write utf8-encoded postscript and tex-outputs.
Ticket numbers refer to https://sourceforge.net/p/mcj/tickets/#.
o Include sys/wait.h to build on some bsds.
o Process crafted input files, tickets #142, #145, #146, #147, #148,
and #152.
o Correctly scale dxf output, ticket #91.
o Correct a typo causing incorrect eps import, ticket #137.
o Regression, pass driver names to driver, ticket #139.
- Port and rename patch transfig-3.2.8.dif which is now transfig-3.2.9.dif
- Port patches
* fig2dev-3.2.6-fig2mpdf.patch
* transfig-fix-afl.patch
- Remove patches now upstream
* 0001-Make-ModDate-and-CreationDate-in-PDF-reproducible.patch
* 1b09a8.patch
-------------------------------------------------------------------
Sat Mar 18 04:27:12 UTC 2023 - Stefan Brüns <stefan.bruens@rwth-aachen.de>

View File

@ -17,7 +17,7 @@
Name: transfig
Version: 3.2.8b
Version: 3.2.9
Release: 0
Summary: Graphic Converter
# www.xfig.org is dead
@ -26,12 +26,10 @@ License: MIT
Group: Productivity/Graphics/Convertors
#Source: http://sourceforge.net/projects/mcj/files/fig2dev-%%{version}.tar.xz/download#/fig2dev-%%{version}.tar.xz
Source: fig2dev-%{version}.tar.xz
Patch0: transfig-3.2.8.dif
Patch1: 1b09a8.patch
Patch0: transfig-3.2.9.dif
Patch4: transfig-fix-afl.patch
Patch43: fig2dev-3.2.6-fig2mpdf.patch
Patch44: fig2dev-3.2.6-fig2mpdf-doc.patch
Patch46: 0001-Make-ModDate-and-CreationDate-in-PDF-reproducible.patch
Patch47: 0001-Use-native-fig2dev-pdf-output-instead-of-epstopdf.patch
BuildRequires: fdupes
BuildRequires: libjpeg-devel
@ -70,11 +68,9 @@ releases, this command was implemented as a shell script.
%setup -q -n fig2dev-%{version}
find -type f -exec chmod a-x,go-w '{}' \;
%patch0 -p0 -b .0
%patch1 -p0 -b .1
%patch4 -p1 -b .afl
%patch43 -p1 -b .mpdf
%patch44 -p1 -b .mpdfdoc
%patch46 -p1 -b .pdfmark
%patch47 -p1 -b .epstopdf
# remove obsolete libc fallback implementations
rm fig2dev/lib/*.c