Gentoo Archives: gentoo-commits

From: Arthur Zamarin <arthurzam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/sabyenc/, dev-python/sabyenc/files/
Date: Sat, 18 Sep 2021 18:15:10
Message-Id: 1631988885.57ea44b8b8fdc2c57c3f8e0e328d12d2cecb3add.arthurzam@gentoo
1 commit: 57ea44b8b8fdc2c57c3f8e0e328d12d2cecb3add
2 Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
3 AuthorDate: Sat Sep 18 18:14:45 2021 +0000
4 Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
5 CommitDate: Sat Sep 18 18:14:45 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=57ea44b8
7
8 dev-python/sabyenc: fix segfault, enable py3.10
9
10 Closes: https://bugs.gentoo.org/736224
11 Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
12
13 .../sabyenc/files/sabyenc-4.0.2-fix-segfault.patch | 28 ++++++++++++++++++++++
14 dev-python/sabyenc/sabyenc-4.0.2.ebuild | 17 +++++++------
15 2 files changed, 38 insertions(+), 7 deletions(-)
16
17 diff --git a/dev-python/sabyenc/files/sabyenc-4.0.2-fix-segfault.patch b/dev-python/sabyenc/files/sabyenc-4.0.2-fix-segfault.patch
18 new file mode 100644
19 index 00000000000..1a80d5f13da
20 --- /dev/null
21 +++ b/dev-python/sabyenc/files/sabyenc-4.0.2-fix-segfault.patch
22 @@ -0,0 +1,28 @@
23 +From: Arthur Zamarin <arthurzam@×××××.com>
24 +Date: Sat, 18 Sep 2021 21:07:45 +0300
25 +Subject: Fix Segfault during testing
26 +
27 +decode_usenet_chunks might receive it argument as bytesarray, or
28 +as bytes object, but the C code expects only bytesarray.
29 +Add code, to apply variant for each case, and fail using assert when
30 +both don't apply.
31 +
32 +Signed-off-by: Arthur Zamarin <arthurzam@×××××.com>
33 +
34 +--- a/src/sabyenc3.c
35 ++++ b/src/sabyenc3.c
36 +@@ -593,7 +593,13 @@ PyObject* decode_usenet_chunks(PyObject* self, PyObject* args) {
37 + num_bytes_reserved = 0;
38 + lp_max = (int)PyList_Size(Py_input_list);
39 + for(lp = 0; lp < lp_max; lp++) {
40 +- num_bytes_reserved += (int)PyByteArray_GET_SIZE(PyList_GetItem(Py_input_list, lp));
41 ++ PyObject *temp = PyList_GetItem(Py_input_list, lp);
42 ++ if (PyByteArray_Check(temp))
43 ++ num_bytes_reserved += (int)PyByteArray_GET_SIZE(temp);
44 ++ else if (PyBytes_Check(temp))
45 ++ num_bytes_reserved += (int)PyBytes_GET_SIZE(temp);
46 ++ else
47 ++ assert(PyByteArray_Check(temp) || PyBytes_Check(temp));
48 + }
49 + }
50 +
51
52 diff --git a/dev-python/sabyenc/sabyenc-4.0.2.ebuild b/dev-python/sabyenc/sabyenc-4.0.2.ebuild
53 index f777975da68..d9536017b50 100644
54 --- a/dev-python/sabyenc/sabyenc-4.0.2.ebuild
55 +++ b/dev-python/sabyenc/sabyenc-4.0.2.ebuild
56 @@ -1,8 +1,9 @@
57 # Copyright 1999-2021 Gentoo Authors
58 # Distributed under the terms of the GNU General Public License v2
59
60 -EAPI="7"
61 -PYTHON_COMPAT=( python3_{7,8,9} )
62 +EAPI=7
63 +
64 +PYTHON_COMPAT=( python3_{8..10} )
65
66 inherit distutils-r1
67
68 @@ -13,13 +14,15 @@ SRC_URI="https://github.com/sabnzbd/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
69 LICENSE="LGPL-3"
70 SLOT="0"
71 KEYWORDS="amd64 ~x86"
72 -IUSE="test"
73 -RESTRICT="!test? ( test )"
74 -
75 -DOCS=( CHANGES.md README.md doc/yenc-draft.1.3.txt )
76
77 -DEPEND="test? (
78 +BDEPEND="test? (
79 dev-python/chardet[${PYTHON_USEDEP}]
80 )"
81
82 +DOCS=( CHANGES.md README.md doc/yenc-draft.1.3.txt )
83 +
84 +PATCHES=(
85 + "${FILESDIR}/${P}-fix-segfault.patch"
86 +)
87 +
88 distutils_enable_tests pytest