Jelle van der Waa pushed to branch main at Arch Linux / Packaging / Packages / 
libcomps


Commits:
d69f5001 by Jelle van der Waa at 2025-01-11T19:33:02+01:00
Fix segfault when resolving packages

Fixes: #1

- - - - -


3 changed files:

- .SRCINFO
- PKGBUILD
- + return-self-from-iter.patch


Changes:

=====================================
.SRCINFO
=====================================
@@ -1,7 +1,7 @@
 pkgbase = libcomps
        pkgdesc = Comps XML file manipulation library
        pkgver = 0.1.21
-       pkgrel = 3
+       pkgrel = 4
        url = https://github.com/rpm-software-management/libcomps
        arch = x86_64
        license = GPL2
@@ -16,6 +16,8 @@ pkgbase = libcomps
        depends = zlib
        optdepends = python: for python bindings
        source = 
https://github.com/rpm-software-management/libcomps/archive/0.1.21/libcomps-0.1.21.tar.gz
+       source = return-self-from-iter.patch
        sha256sums = 
84d7555ed795458f3799d57cceccb096634c38461c3db7cb1739d42c038b2785
+       sha256sums = 
191b72df5dae46f63e97a1d05f30e099059012d40351c837f2180f6990484042
 
 pkgname = libcomps


=====================================
PKGBUILD
=====================================
@@ -3,7 +3,7 @@
 
 pkgname=libcomps
 pkgver=0.1.21
-pkgrel=3
+pkgrel=4
 pkgdesc="Comps XML file manipulation library"
 arch=('x86_64')
 url="https://github.com/rpm-software-management/$pkgname";
@@ -12,8 +12,15 @@ depends=('expat' 'libxml2' 'zlib')
 makedepends=('cmake' 'python' 'python-setuptools' 'doxygen' 'python-sphinx')
 checkdepends=('check')
 optdepends=('python: for python bindings')
-source=("$url/archive/$pkgver/$pkgname-$pkgver.tar.gz")
-sha256sums=('84d7555ed795458f3799d57cceccb096634c38461c3db7cb1739d42c038b2785')
+source=("$url/archive/$pkgver/$pkgname-$pkgver.tar.gz" 
"return-self-from-iter.patch")
+sha256sums=('84d7555ed795458f3799d57cceccb096634c38461c3db7cb1739d42c038b2785'
+            '191b72df5dae46f63e97a1d05f30e099059012d40351c837f2180f6990484042')
+
+prepare() {
+  cd "$pkgname-$pkgver"
+  # 
https://github.com/rpm-software-management/libcomps/commit/c37f570dc25704525f0ca85e9b7edd681464888a
+  patch -Np1 -i ${srcdir}/return-self-from-iter.patch
+}
 
 build() {
   cd "$pkgname-$pkgver"


=====================================
return-self-from-iter.patch
=====================================
@@ -0,0 +1,57 @@
+From c37f570dc25704525f0ca85e9b7edd681464888a Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <[email protected]>
+Date: Wed, 11 Dec 2024 12:16:11 +0100
+Subject: [PATCH] Return self from iter(iterator)
+
+Fixes https://bugzilla.redhat.com/2331665
+---
+ libcomps/src/python/src/pycomps_sequence.c |  2 +-
+ libcomps/src/python/tests/test_libcomps.py | 22 ++++++++++++++++++++++
+ 2 files changed, 23 insertions(+), 1 deletion(-)
+
+diff --git a/libcomps/src/python/src/pycomps_sequence.c 
b/libcomps/src/python/src/pycomps_sequence.c
+index 9b42341..17f8f72 100644
+--- a/libcomps/src/python/src/pycomps_sequence.c
++++ b/libcomps/src/python/src/pycomps_sequence.c
+@@ -754,7 +754,7 @@ PyTypeObject PyCOMPS_SeqIterType = {
+     0,                          /* tp_clear */
+     0,                          /* tp_richcompare */
+     0,                          /* tp_weaklistoffset */
+-    PyCOMPSSeq_getiter,         /* tp_iter */
++    PyObject_SelfIter,          /* tp_iter */
+     PyCOMPSSeq_iternext,         /* tp_iternext */
+     PyCOMPSSeqIter_methods,         /* tp_methods */
+     PyCOMPSSeqIter_members,         /* tp_members */
+diff --git a/libcomps/src/python/tests/test_libcomps.py 
b/libcomps/src/python/tests/test_libcomps.py
+index 64c2b59..b645567 100755
+--- a/libcomps/src/python/tests/test_libcomps.py
++++ b/libcomps/src/python/tests/test_libcomps.py
+@@ -139,6 +139,28 @@ def test_iter_environments(self):
+         self.comps.xml_str()
+         self.comps.xml_f(self.tmp_file)
+ 
++    def test_iter_iter_environments(self):
++        it1 = iter(self.comps.environments)
++        it2 = iter(it1)
++        it3 = iter(it1)
++        it4 = iter(it2)
++        self.assertIs(it1, it2)
++        self.assertIs(it1, it3)
++        self.assertIs(it1, it4)
++        del it1
++        next(it2)
++
++    def test_iter_iter_langpacks(self):
++        it1 = iter(self.comps.langpacks)
++        it2 = iter(it1)
++        it3 = iter(it1)
++        it4 = iter(it2)
++        self.assertIs(it1, it2)
++        self.assertIs(it1, it3)
++        self.assertIs(it1, it4)
++        del it1
++        next(it2)
++
+     def test_duplicate_groups(self):
+         self.comps = libcomps.Comps()
+ 



View it on GitLab: 
https://gitlab.archlinux.org/archlinux/packaging/packages/libcomps/-/commit/d69f5001100d436bfb3a457b3aa347ee5b9bccd0

-- 
View it on GitLab: 
https://gitlab.archlinux.org/archlinux/packaging/packages/libcomps/-/commit/d69f5001100d436bfb3a457b3aa347ee5b9bccd0
You're receiving this email because of your account on gitlab.archlinux.org.


Reply via email to