[alpine-aports] [PATCH] community/py-augeas: fix crash on mips*

alpine-mips-patches
Details
Message ID
<20190211133725.1F84F5A406@mx12.valuehost.ru>
Sender timestamp
1549891102
DKIM signature
missing
Download raw message
Patch: +38 -3
On mips* dynamically imported symbol (here 'free') must be looked
up in its explicitly dlopen()ed module (here 'None' which means
the standard C library in cffi world). This change does not break
x86_64 at least and actually follows the cffi docs at
cdef.html#ffi-dlopen-loading-libraries-in-abi-mode

---
 community/py-augeas/APKBUILD                  |  9 ++++--
 .../py-augeas/dlopen-libc-explicitly.patch    | 32 +++++++++++++++++++
 2 files changed, 38 insertions(+), 3 deletions(-)
 create mode 100644 community/py-augeas/dlopen-libc-explicitly.patch

diff --git a/community/py-augeas/APKBUILD b/community/py-augeas/APKBUILD
index 51ed80a623..ea105877a9 100644
--- a/community/py-augeas/APKBUILD
+++ b/community/py-augeas/APKBUILD
@@ -3,7 +3,7 @@
 pkgname=py-augeas
 _pkgname=python-augeas
 pkgver=1.0.3
-pkgrel=0
+pkgrel=1
 pkgdesc="Pure python bindings for augeas"
 url="https://pypi.python.org/pypi/python-augeas"
 arch="noarch"
@@ -11,7 +11,9 @@ license="GPL-2.1"
 depends="augeas-libs py-cffi"
 makedepends="python2-dev python3-dev py-setuptools"
 subpackages="py3-${pkgname/py-/}:_py3 py2-${pkgname/py-/}:_py2"
-source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
+source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz
+	dlopen-libc-explicitly.patch
+	"
 
 builddir="$srcdir"/$_pkgname-$pkgver
 
@@ -46,4 +48,5 @@ _py2() {
 _py3() {
 	_py python3
 }
-sha512sums="737b41e7bb438d80da75b55714c3f0b1706a4b2cacddd20fadf855bc3044e532f4079319b3775032e6f6009cf7f282af33fdf583332772b443a6c2d4925639fa  python-augeas-1.0.3.tar.gz"
+sha512sums="737b41e7bb438d80da75b55714c3f0b1706a4b2cacddd20fadf855bc3044e532f4079319b3775032e6f6009cf7f282af33fdf583332772b443a6c2d4925639fa  python-augeas-1.0.3.tar.gz
+938e1a28d70c8ffbf62fd2936a57276603487608fbb3e23bf3a59a4f655e7d875ad51e6506acbddf4eea27a433fe3c9c35da3e00be04c8c866a5a966cdf3b161  dlopen-libc-explicitly.patch"
diff --git a/community/py-augeas/dlopen-libc-explicitly.patch b/community/py-augeas/dlopen-libc-explicitly.patch
new file mode 100644
index 0000000000..c7aa05a2b8
--- /dev/null
+++ b/community/py-augeas/dlopen-libc-explicitly.patch
@@ -0,0 +1,32 @@
+--- a/augeas/__init__.py
+@@ -42,7 +42,7 @@
+ 
+ import cffi
+ import types
+-from augeas.ffi import ffi, lib
++from augeas.ffi import ffi, lib, c89
+ 
+ PY3 = _pyver >= (3,)
+ AUGENC = 'utf8'
+@@ -421,8 +421,8 @@
+                 # Create a python string and append it to our matches list
+                 item = ffi.string(array[i])
+                 matches.append(dec(item))
+-                lib.free(array[i])
+-        lib.free(array)
++                c89.free(array[i])
++        c89.free(array)
+         return matches
+ 
+     def span(self, path):
+--- a/augeas/ffi.py
+@@ -40,6 +40,7 @@
+ """)
+ 
+ lib = ffi.dlopen("augeas")
++c89 = ffi.dlopen(None)
+ 
+ if __name__ == "__main__":
+     ffi.compile(verbose=True)
-- 
2.20.1




---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---