diff options
author | Shiz <hi@shiz.me> | 2017-08-17 14:32:29 +0200 |
---|---|---|
committer | Shiz <hi@shiz.me> | 2017-08-17 14:32:29 +0200 |
commit | 0468bb139555cf879506ffaea3cb26bde14af8f1 (patch) | |
tree | 841eafd16ad98bef86ad5ec44c16c47258fba914 | |
parent | 0ae19bfa6e9631b6fe58ac64dce044e9b8cf195f (diff) | |
download | aports-0468bb139555cf879506ffaea3cb26bde14af8f1.tar.bz2 aports-0468bb139555cf879506ffaea3cb26bde14af8f1.tar.xz |
testing/py-ujson: fix stack usage issue and add tests
-rw-r--r-- | testing/py-ujson/APKBUILD | 21 | ||||
-rw-r--r-- | testing/py-ujson/lower-stack-usage.patch | 19 |
2 files changed, 33 insertions, 7 deletions
diff --git a/testing/py-ujson/APKBUILD b/testing/py-ujson/APKBUILD index 7596349de2..880cbd4075 100644 --- a/testing/py-ujson/APKBUILD +++ b/testing/py-ujson/APKBUILD @@ -3,20 +3,22 @@ pkgname=py-ujson _pkgname=ujson pkgver=1.35 -pkgrel=1 +pkgrel=2 pkgdesc="A fast Python JSON encoder and decoder" url="http://github.com/esnme/ultrajson" arch="all" license="BSD" makedepends="python2-dev py-setuptools python3-dev" +checkdepends="py3-tz py3-six" subpackages="py3-${pkgname/py-/}:_py3 py2-${pkgname/py-/}:_py2" -source="$_pkgname-$pkgver.tar.gz::https://github.com/esnme/ultrajson/archive/v$pkgver.tar.gz" +source="$_pkgname-$pkgver.tar.gz::https://github.com/esnme/ultrajson/archive/v$pkgver.tar.gz + lower-stack-usage.patch" builddir="$srcdir"/ultrajson-$pkgver build() { cd "$builddir" - python2 setup.py build || return 1 - python3 setup.py build || return 1 + python2 setup.py build + python3 setup.py build } package() { @@ -41,6 +43,11 @@ _py() { $python setup.py install --prefix=/usr --root="$subpkgdir" } -md5sums="e6377366fb45652f815c845b3e51bc59 ujson-1.35.tar.gz" -sha256sums="1e7761583065873bed8466a3692fa5539d4f15bebc7af1c8fcc63d322a46804f ujson-1.35.tar.gz" -sha512sums="cd5dc8d08e072cf703aec7d689070713f7073c22f13167d7e10a89219179248d6668894c1d742ca658672bb82e1dccbf72e3fd69e036d8cb2ee0ee799d10db11 ujson-1.35.tar.gz" +check() { + cd "$builddir" + ln -s ./build/lib.*/ujson.*.so ujson.so + PYTHONPATH=. python3 tests/tests.py +} + +sha512sums="cd5dc8d08e072cf703aec7d689070713f7073c22f13167d7e10a89219179248d6668894c1d742ca658672bb82e1dccbf72e3fd69e036d8cb2ee0ee799d10db11 ujson-1.35.tar.gz +e3755dea5845d735afc32c3fc6ee569f1a36d51203812409446c3cb62d207c1fea934935adaf1787b5ac549765e2dfdd18790f2eb0c15b28c5fec61a45874738 lower-stack-usage.patch" diff --git a/testing/py-ujson/lower-stack-usage.patch b/testing/py-ujson/lower-stack-usage.patch new file mode 100644 index 0000000000..de3258cfde --- /dev/null +++ b/testing/py-ujson/lower-stack-usage.patch @@ -0,0 +1,19 @@ +From: Shiz <hi@shiz.me> +Bug-Report: https://github.com/esnme/ultrajson/issues/254 + +musl default thread size is 80 kiB, so using 128 kiB by default will +overflow the stack and cause segmentation faults. + +Allocating 128 kiB on the stack is a rather bad idea anyway, so we'll +lower it to 8 kiB. +--- ultrajson-1.35/lib/ultrajson.h ++++ ultrajson-1.35-patched/lib/ultrajson.h +@@ -77,7 +77,7 @@ + /* + Dictates and limits how much stack space for buffers UltraJSON will use before resorting to provided heap functions */ + #ifndef JSON_MAX_STACK_BUFFER_SIZE +-#define JSON_MAX_STACK_BUFFER_SIZE 131072 ++#define JSON_MAX_STACK_BUFFER_SIZE 8192 + #endif + + #ifdef _WIN32 |