Accepting request 986485 from home:adkorte:branches:devel:languages:python

- 0002-reader-make-PY_SSIZE_T_CLEAN.patch added to fix boo#1200686
  reader: make PY_SSIZE_T_CLEAN

OBS-URL: https://build.opensuse.org/request/show/986485
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-systemd?expand=0&rev=20
This commit is contained in:
Matej Cepl 2022-07-03 21:02:04 +00:00 committed by Git OBS Bridge
parent e64f2ce9cc
commit eb5b220f0b
3 changed files with 55 additions and 3 deletions

View File

@ -0,0 +1,46 @@
From ab9f2797127b374665c37c06b02121f5dcf7d61c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Thu, 12 Nov 2020 16:55:56 +0100
Subject: [PATCH 2/2] reader: make PY_SSIZE_T_CLEAN
---
systemd/_reader.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/systemd/_reader.c b/systemd/_reader.c
index 8de7f6a963..3b6a4d0bbc 100644
--- a/systemd/_reader.c
+++ b/systemd/_reader.c
@@ -18,7 +18,12 @@
along with python-systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#define PY_SSIZE_T_CLEAN
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wredundant-decls"
#include <Python.h>
+#pragma GCC diagnostic pop
+
#include <structmember.h>
#include <datetime.h>
#include <time.h>
@@ -710,11 +715,17 @@ PyDoc_STRVAR(Reader_add_match__doc__,
"Match is a string of the form \"FIELD=value\".");
static PyObject* Reader_add_match(Reader *self, PyObject *args, PyObject *keywds) {
char *match;
- int match_len, r;
+ Py_ssize_t match_len;
+ int r;
if (!PyArg_ParseTuple(args, "s#:add_match", &match, &match_len))
return NULL;
- r = sd_journal_add_match(self->j, match, match_len);
+ if (match_len > INT_MAX) {
+ set_error(-ENOBUFS, NULL, NULL);
+ return NULL;
+ }
+
+ r = sd_journal_add_match(self->j, match, (int) match_len);
if (set_error(r, NULL, "Invalid match") < 0)
return NULL;

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Sun Jul 3 18:00:37 UTC 2022 - Arjen de Korte <suse+build@de-korte.org>
- 0002-reader-make-PY_SSIZE_T_CLEAN.patch added to fix boo#1200686
reader: make PY_SSIZE_T_CLEAN
-------------------------------------------------------------------
Sun Feb 2 14:05:14 UTC 2020 - Dominique Leuenberger <dimstar@opensuse.org>

View File

@ -30,6 +30,8 @@ Source: https://github.com/systemd/%{name}/archive/v%{version}.tar.gz#/%
Patch1: iso-c-90.patch
# PATCH-FIX-OPENSUSE exclude-tests-on-obs.patch removes a test when running tests at OBS. Should be removed as soon as OBS is fixed
Patch100: exclude-tests-on-obs.patch
# PATCH-FIX-UPSTREAM reader: make PY_SSIZE_T_CLEAN
Patch101: 0002-reader-make-PY_SSIZE_T_CLEAN.patch
BuildRequires: %{python_module devel}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
@ -53,9 +55,7 @@ Python module for native access to the systemd facilities. Functionality is sepe
* systemd.login wraps parts of libsystemd used to query logged in users and available seats and machines.
%prep
%setup -q
%patch1 -p1
%patch100 -p1
%autosetup -p1
%build
%python_build