diff options
Diffstat (limited to 'meta/recipes-devtools')
| -rw-r--r-- | meta/recipes-devtools/libdnf/libdnf/0001-Fix-a-segfault-in-iterator-of-a-ConfigParser-section.patch | 84 | ||||
| -rw-r--r-- | meta/recipes-devtools/libdnf/libdnf_0.73.4.bb | 1 |
2 files changed, 85 insertions, 0 deletions
diff --git a/meta/recipes-devtools/libdnf/libdnf/0001-Fix-a-segfault-in-iterator-of-a-ConfigParser-section.patch b/meta/recipes-devtools/libdnf/libdnf/0001-Fix-a-segfault-in-iterator-of-a-ConfigParser-section.patch new file mode 100644 index 0000000000..1c62d02455 --- /dev/null +++ b/meta/recipes-devtools/libdnf/libdnf/0001-Fix-a-segfault-in-iterator-of-a-ConfigParser-section.patch | |||
| @@ -0,0 +1,84 @@ | |||
| 1 | From f3302a865b230e021e9defbcea978ed1290a9b2f Mon Sep 17 00:00:00 2001 | ||
| 2 | From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz> | ||
| 3 | Date: Fri, 6 Dec 2024 18:01:16 +0100 | ||
| 4 | Subject: [PATCH] Fix a segfault in iterator of a ConfigParser section | ||
| 5 | |||
| 6 | An iterator should return self on __iter__. | ||
| 7 | |||
| 8 | So that this works: | ||
| 9 | |||
| 10 | >>> it1 = iter(sectObj) | ||
| 11 | >>> it2 = iter(it1) | ||
| 12 | >>> it1 is it2 | ||
| 13 | True | ||
| 14 | |||
| 15 | Previously, this iterator did not return self on __iter__, it was like this: | ||
| 16 | |||
| 17 | class PreserveOrderMapStringStringIterator(object): | ||
| 18 | ... | ||
| 19 | def __iter__(self): | ||
| 20 | return _common_types.PreserveOrderMapStringStringIterator___iter__(self) | ||
| 21 | |||
| 22 | And that returned a new Python object. | ||
| 23 | |||
| 24 | This fixes https://bugzilla.redhat.com/2330562 by avoiding a second iterator object. | ||
| 25 | |||
| 26 | My SWIG skills are close to zero, | ||
| 27 | perhaps this is not the best way to return self, but it seems to work. | ||
| 28 | |||
| 29 | Upstream-Status: Backport | ||
| 30 | (https://github.com/rpm-software-management/libdnf/commit/f3302a865b) | ||
| 31 | |||
| 32 | Backport so that it works properly with Python 3.13.1. | ||
| 33 | |||
| 34 | Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> | ||
| 35 | |||
| 36 | --- | ||
| 37 | bindings/swig/common_types.i | 11 +++++++---- | ||
| 38 | bindings/swig/conf.i | 4 ---- | ||
| 39 | 2 files changed, 7 insertions(+), 8 deletions(-) | ||
| 40 | |||
| 41 | diff --git a/bindings/swig/common_types.i b/bindings/swig/common_types.i | ||
| 42 | index c9ae798a..a1f90d9e 100644 | ||
| 43 | --- a/bindings/swig/common_types.i | ||
| 44 | +++ b/bindings/swig/common_types.i | ||
| 45 | @@ -63,10 +63,6 @@ template<class T> | ||
| 46 | class Iterator { | ||
| 47 | public: | ||
| 48 | Iterator(typename T::iterator _cur, typename T::iterator _end) : cur(_cur), end(_end) {} | ||
| 49 | - Iterator* __iter__() | ||
| 50 | - { | ||
| 51 | - return this; | ||
| 52 | - } | ||
| 53 | |||
| 54 | typename T::iterator cur; | ||
| 55 | typename T::iterator end; | ||
| 56 | @@ -165,3 +161,10 @@ EXTEND_TEMPLATE_PreserveOrderMapIterator(std::string, std::string) | ||
| 57 | EXTEND_TEMPLATE_PreserveOrderMapIterator(std::string, libdnf::PreserveOrderMap<std::string, std::string>) | ||
| 58 | |||
| 59 | %exception; // beware this resets all exception handlers if you import this file after defining any | ||
| 60 | + | ||
| 61 | +%pythoncode %{ | ||
| 62 | +def PreserveOrderMapStringStringIterator___iter__(self): | ||
| 63 | + return self | ||
| 64 | +PreserveOrderMapStringStringIterator.__iter__ = PreserveOrderMapStringStringIterator___iter__ | ||
| 65 | +del PreserveOrderMapStringStringIterator___iter__ | ||
| 66 | +%} | ||
| 67 | diff --git a/bindings/swig/conf.i b/bindings/swig/conf.i | ||
| 68 | index b6a0ce88..2f77003f 100644 | ||
| 69 | --- a/bindings/swig/conf.i | ||
| 70 | +++ b/bindings/swig/conf.i | ||
| 71 | @@ -71,10 +71,6 @@ template<class T> | ||
| 72 | class Iterator { | ||
| 73 | public: | ||
| 74 | Iterator(typename T::iterator _cur, typename T::iterator _end) : cur(_cur), end(_end) {} | ||
| 75 | - Iterator* __iter__() | ||
| 76 | - { | ||
| 77 | - return this; | ||
| 78 | - } | ||
| 79 | |||
| 80 | typename T::iterator cur; | ||
| 81 | typename T::iterator end; | ||
| 82 | -- | ||
| 83 | 2.39.5 | ||
| 84 | |||
diff --git a/meta/recipes-devtools/libdnf/libdnf_0.73.4.bb b/meta/recipes-devtools/libdnf/libdnf_0.73.4.bb index 0817da7ca6..5b9e734e82 100644 --- a/meta/recipes-devtools/libdnf/libdnf_0.73.4.bb +++ b/meta/recipes-devtools/libdnf/libdnf_0.73.4.bb | |||
| @@ -11,6 +11,7 @@ SRC_URI = "git://github.com/rpm-software-management/libdnf;branch=dnf-4-master;p | |||
| 11 | file://enable_test_data_dir_set.patch \ | 11 | file://enable_test_data_dir_set.patch \ |
| 12 | file://0001-drop-FindPythonInstDir.cmake.patch \ | 12 | file://0001-drop-FindPythonInstDir.cmake.patch \ |
| 13 | file://armarch.patch \ | 13 | file://armarch.patch \ |
| 14 | file://0001-Fix-a-segfault-in-iterator-of-a-ConfigParser-section.patch \ | ||
| 14 | " | 15 | " |
| 15 | 16 | ||
| 16 | SRCREV = "79ed383cd5a822e6d8d9d549835383f5c5106204" | 17 | SRCREV = "79ed383cd5a822e6d8d9d549835383f5c5106204" |
