[arch-commits] Commit in fontforge/trunk (PKGBUILD pymem_free.patch)

Gaëtan Bisson bisson at archlinux.org
Mon Mar 20 08:10:49 UTC 2017


    Date: Monday, March 20, 2017 @ 08:10:47
  Author: bisson
Revision: 291094

fix FS#53370

Added:
  fontforge/trunk/pymem_free.patch
Modified:
  fontforge/trunk/PKGBUILD

------------------+
 PKGBUILD         |   13 +++-
 pymem_free.patch |  141 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 151 insertions(+), 3 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2017-03-19 16:15:04 UTC (rev 291093)
+++ PKGBUILD	2017-03-20 08:10:47 UTC (rev 291094)
@@ -5,7 +5,7 @@
 
 pkgname=fontforge
 pkgver=20161012
-pkgrel=3
+pkgrel=4
 pkgdesc='Outline and bitmap font editor'
 url='https://fontforge.github.io/'
 arch=('i686' 'x86_64')
@@ -15,10 +15,17 @@
          'pango' 'giflib' 'libtiff' 'libxml2' 'libspiro' 'libunicodenames' 'zeromq'
          'python' 'desktop-file-utils' 'gtk-update-icon-cache' 'hicolor-icon-theme')
 source=("https://github.com/fontforge/fontforge/archive/${pkgver}.tar.gz"
-        'https://fontforge.github.io/cidmaps.tgz')
+        'https://fontforge.github.io/cidmaps.tgz'
+        'pymem_free.patch')
 sha256sums=('a5f5c2974eb9109b607e24f06e57696d5861aaebb620fc2c132bdbac6e656351'
-            '1bf9c7eb8835e6ed94e62cb49f1141bc046c562849e52e6c3c7f1d7cfc95c7b3')
+            '1bf9c7eb8835e6ed94e62cb49f1141bc046c562849e52e6c3c7f1d7cfc95c7b3'
+            'fd6059fe263e12d02240466c23e773fcd7776ea37c90de52bafd3dc40f09a524')
 
+prepare() {
+	cd "${srcdir}/${pkgname}-${pkgver}"
+	patch -p1 -i ../pymem_free.patch
+}
+
 build() {
 	cd "${srcdir}/${pkgname}-${pkgver}"
 	export LIBZMQ_LIBS=-lzmq

Added: pymem_free.patch
===================================================================
--- pymem_free.patch	                        (rev 0)
+++ pymem_free.patch	2017-03-20 08:10:47 UTC (rev 291094)
@@ -0,0 +1,141 @@
+From b5a057f004d2686f5ae47d3f892c63b531c7da13 Mon Sep 17 00:00:00 2001
+From: Parag A Nemade <pnemade at fedoraproject.org>
+Date: Fri, 10 Mar 2017 08:41:24 +0530
+Subject: [PATCH] Fix many of the free() calls to PyMem_Free() for the
+ python3.6 requirement This is also based on the discussion happened in
+ upstream issue https://github.com/fontforge/fontforge/issues/2992
+
+This commit is a fix for the reported two problems in issue
+https://github.com/fontforge/fontforge/issues/3042
+
+The upstream documentation says
+PyArg_ParseTuple() will allocate a buffer of the needed size, copy the
+encoded data into this buffer and adjust *buffer to reference the newly
+allocated storage. The caller is responsible for calling PyMem_Free()
+to free the allocated buffer after use.
+---
+ fontforge/python.c | 27 ++++++++++++++-------------
+ 1 file changed, 14 insertions(+), 13 deletions(-)
+
+diff --git a/fontforge/python.c b/fontforge/python.c
+index faa7485..758422a 100644
+--- a/fontforge/python.c
++++ b/fontforge/python.c
+@@ -1045,7 +1045,7 @@ static PyObject *PyFF_OpenFont(PyObject *UNUSED(self), PyObject *args) {
+     if ( !PyArg_ParseTuple(args,"es|i", "UTF-8", &filename, &openflags ))
+ return( NULL );
+     locfilename = utf82def_copy(filename);
+-    free(filename);
++    PyMem_Free(filename);
+ 
+     /* The actual filename opened may be different from the one passed
+      * to LoadSplineFont, so we can't report the filename on an
+@@ -1072,7 +1072,7 @@ static PyObject *PyFF_FontsInFile(PyObject *UNUSED(self), PyObject *args) {
+     if ( !PyArg_ParseTuple(args,"es","UTF-8",&filename) )
+ return( NULL );
+     locfilename = utf82def_copy(filename);
+-    free(filename);
++    PyMem_Free(filename);
+     ret = GetFontNames(locfilename, 1);
+     free(locfilename);
+     cnt = 0;
+@@ -4128,7 +4128,7 @@ static PyObject *PyFFLayer_export(PyFF_Layer *self, PyObject *args) {
+     if ( !PyArg_ParseTuple(args,"es","UTF-8",&filename) )
+ return( NULL );
+     locfilename = utf82def_copy(filename);
+-    free(filename);
++    PyMem_Free(filename);
+ 
+     pt = strrchr(locfilename,'.');
+     if ( pt==NULL ) pt=locfilename;
+@@ -7785,7 +7785,7 @@ static PyObject *PyFFGlyph_import(PyObject *self, PyObject *args) {
+     if ( !PyArg_ParseTuple(args,"es|O","UTF-8",&filename, &flags) )
+ return( NULL );
+     locfilename = utf82def_copy(filename);
+-    free(filename);
++    PyMem_Free(filename);
+ 
+     /* Check if the file exists and is readable */
+     if ( access(locfilename,R_OK)!=0 ) {
+@@ -7854,7 +7854,7 @@ static PyObject *PyFFGlyph_export(PyObject *self, PyObject *args) {
+     if ( !PyArg_ParseTuple(args,"es|OO","UTF-8",&filename,&foo,&bar) )
+ return( NULL );
+     locfilename = utf82def_copy(filename);
+-    free(filename);
++    PyMem_Free(filename);
+ 
+     pt = strrchr(locfilename,'.');
+     if ( pt==NULL ) pt=locfilename;
+@@ -13549,7 +13549,7 @@ return (NULL);
+ 	    &to_background) )
+ return( NULL );
+     locfilename = utf82def_copy(filename);
+-    free(filename);
++    PyMem_Free(filename);
+ 
+     ext = strrchr(locfilename,'.');
+     if ( ext==NULL ) {
+@@ -13623,7 +13623,7 @@ return (NULL);
+     if ( !PyArg_ParseTuple(args,"OesO", &other, "UTF-8", &filename, &flagstuple ))
+ return( NULL );
+     locfilename = utf82def_copy(filename);
+-    free(filename);
++    PyMem_Free(filename);
+ 
+     if ( !PyType_IsSubtype(&PyFF_FontType, Py_TYPE(other)) ) {
+ 	PyErr_Format(PyExc_TypeError,"First argument must be a fontforge font");
+@@ -15690,7 +15690,7 @@ return( NULL );
+ 	}
+     }
+     locfilename = utf82def_copy(filename);
+-    free(filename);
++    PyMem_Free(filename);
+     if ( !GenerateScript(fv->sf,locfilename,bitmaptype,iflags,resolution,subfontdirectory,
+ 	    NULL,fv->normal==NULL?fv->map:fv->normal,rename_to,layer) ) {
+ 	PyErr_Format(PyExc_EnvironmentError, "Font generation failed");
+@@ -15846,7 +15846,7 @@ return( NULL );
+     }
+ 
+     locfilename = utf82def_copy(filename);
+-    free(filename);
++    PyMem_Free(filename);
+ 
+     if ( !WriteTTC(locfilename,head,ff_ttc,bf,iflags,layer,ittcflags)) {
+ 	PyErr_Format(PyExc_EnvironmentError, "Font generation failed");
+@@ -15874,7 +15874,7 @@ return (NULL);
+     if ( !PyArg_ParseTuple(args,"es|s","UTF-8",&filename,&lookup_name) )
+ return( NULL );
+     locfilename = utf82def_copy(filename);
+-    free(filename);
++    PyMem_Free(filename);
+ 
+     if ( lookup_name!=NULL ) {
+ 	otl = SFFindLookup(fv->sf,lookup_name);
+@@ -15914,7 +15914,8 @@ return (NULL);
+     if ( !PyArg_ParseTuple(args,"es","UTF-8",&filename) )
+ return( NULL );
+     locfilename = utf82def_copy(filename);
+-    free(filename);
++    PyMem_Free(filename);
++
+     if ( !LoadKerningDataFromMetricsFile(fv->sf,locfilename,fv->map)) {
+ 	PyErr_Format(PyExc_EnvironmentError, "No metrics data found");
+ return( NULL );
+@@ -15938,7 +15939,7 @@ return (NULL);
+ 	    &preserveCrossFontKerning, &openflags) )
+ return( NULL );
+     locfilename = utf82def_copy(filename);
+-    free(filename);
++    PyMem_Free(filename);
+     sf = LoadSplineFont(locfilename,openflags);
+     if ( sf==NULL ) {
+ 	PyErr_Format(PyExc_EnvironmentError, "No font found in file \"%s\"", locfilename);
+@@ -15966,7 +15967,7 @@ return (NULL);
+     if ( !PyArg_ParseTuple(args,"des|i",&fraction,"UTF-8",&filename, &openflags) )
+ return( NULL );
+     locfilename = utf82def_copy(filename);
+-    free(filename);
++    PyMem_Free(filename);
+     sf = LoadSplineFont(locfilename,openflags);
+     if ( sf==NULL ) {
+ 	PyErr_Format(PyExc_EnvironmentError, "No font found in file \"%s\"", locfilename);



More information about the arch-commits mailing list