From ae5d4f653ef7e71fab08ff17c6b8f362f1be7e7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= Date: Fri, 3 Apr 2015 20:19:12 +0200 Subject: [PATCH] Add Patch3 to fix segfaults of Python-wrappers when generating code with `-buildin -modern -modernargs`-flags --- swig-3.0.5_fix-python-modern-buildin.patch | 23 ++++++++++++++++++++++ swig.spec | 10 +++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 swig-3.0.5_fix-python-modern-buildin.patch diff --git a/swig-3.0.5_fix-python-modern-buildin.patch b/swig-3.0.5_fix-python-modern-buildin.patch new file mode 100644 index 0000000..13e7fa2 --- /dev/null +++ b/swig-3.0.5_fix-python-modern-buildin.patch @@ -0,0 +1,23 @@ +From e06906bda0ea06f6b5fc15dfa8f55a2251a1bbef Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= +Date: Fri, 3 Apr 2015 18:48:08 +0200 +Subject: [PATCH] Python: fix using `-builtin -modern -modernargs` results in + segfaulting code (#256) + +--- + Source/Modules/python.cxx | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx +index 0e4a402..b2c429d 100644 +--- a/Source/Modules/python.cxx ++++ b/Source/Modules/python.cxx +@@ -2718,7 +2718,7 @@ class PYTHON:public Language { + Printf(parse_args, "if (!SWIG_Python_UnpackTuple(args,\"%s\",%d,%d,0)) SWIG_fail;\n", iname, num_fixed_arguments, tuple_arguments); + } + } +- } else { ++ } else if (tuple_arguments > 0) { + Printf(parse_args, "if(!PyArg_UnpackTuple(args,(char *)\"%s\",%d,%d", iname, num_fixed_arguments, tuple_arguments); + Printv(parse_args, arglist, ")) SWIG_fail;\n", NIL); + } diff --git a/swig.spec b/swig.spec index d3740b3..72ef301 100644 --- a/swig.spec +++ b/swig.spec @@ -32,7 +32,7 @@ Summary: Connects C/C++/Objective C to some high-level programming languages Name: swig Version: 3.0.5 -Release: 3%{?dist} +Release: 4%{?dist} License: GPLv3+ and BSD URL: http://swig.sourceforge.net/ Source0: http://downloads.sourceforge.net/project/swig/swig/swig-%{version}/swig-%{version}.tar.gz @@ -41,6 +41,9 @@ Source1: description.h2m Patch1: swig207-setools.patch # Fix the failure on arch x390 during testing Patch2: swig-2.0.10-Fix-x390-build.patch +# Fix segfaults of Python-wrappers when generating code with +# `-buildin -modern -modernargs`. Patch is upstreamed, see patch-url. +Patch3: https://github.com/swig/swig/pull/372.patch#/swig-3.0.5_fix-python-modern-buildin.patch BuildRequires: perl, python2-devel, pcre-devel BuildRequires: autoconf, automake, gawk, dos2unix @@ -96,6 +99,7 @@ This package contains documentation for SWIG and useful examples %patch1 -p1 -b .setools %patch2 -p1 -b .x390 +%patch3 -p1 -b .python for all in CHANGES README; do iconv -f ISO88591 -t UTF8 < $all > $all.new @@ -193,6 +197,10 @@ ln -fs ../../bin/ccache-swig %{buildroot}%{_libdir}/ccache/swig %doc Doc Examples LICENSE LICENSE-GPL LICENSE-UNIVERSITIES COPYRIGHT %changelog +* Fri Apr 03 2015 Björn Esser - 3.0.5-4 +- Add Patch3 to fix segfaults of Python-wrappers when generating + code with `-buildin -modern -modernargs`-flags + * Thu Feb 19 2015 Orion Poplawski - 3.0.5-3 - Rebuild for gcc 5 C++11 ABI