From 9fb73d645b3ff890003875929276180c0ba0de2b Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 9 May 2023 05:18:41 +0000 Subject: [PATCH] import libpmemobj-cpp-1.13.0-1.el9 --- .gitignore | 2 +- .libpmemobj-cpp.metadata | 2 +- ...r-Fix-undefined-behaviour-on-realloc.patch | 69 ------------------ ...r-fix-referencing-empty-array-rhel90.patch | 73 ------------------- SPECS/libpmemobj-cpp.spec | 17 ++--- 5 files changed, 10 insertions(+), 153 deletions(-) delete mode 100644 SOURCES/0001-vector-Fix-undefined-behaviour-on-realloc.patch delete mode 100644 SOURCES/0002-vector-fix-referencing-empty-array-rhel90.patch diff --git a/.gitignore b/.gitignore index 7348547..3dc18ea 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/libpmemobj-cpp-1.12.tar.gz +SOURCES/libpmemobj-cpp-1.13.0.tar.gz diff --git a/.libpmemobj-cpp.metadata b/.libpmemobj-cpp.metadata index 058fac8..18c8e18 100644 --- a/.libpmemobj-cpp.metadata +++ b/.libpmemobj-cpp.metadata @@ -1 +1 @@ -35d4c04f961caad179651464ce9dd0c54f36f0ac SOURCES/libpmemobj-cpp-1.12.tar.gz +25d601e0140f3d8db94edb19902826a6b91286e4 SOURCES/libpmemobj-cpp-1.13.0.tar.gz diff --git a/SOURCES/0001-vector-Fix-undefined-behaviour-on-realloc.patch b/SOURCES/0001-vector-Fix-undefined-behaviour-on-realloc.patch deleted file mode 100644 index fedc4bb..0000000 --- a/SOURCES/0001-vector-Fix-undefined-behaviour-on-realloc.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 41ddc88a80160050b0ac1a51cb258f8918edf9aa Mon Sep 17 00:00:00 2001 -From: "Lucas A. M. Magalhaes" -Date: Wed, 23 Jun 2021 15:05:50 -0300 -Subject: [PATCH] vector: Fix undefined behaviour on realloc -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -On tests listed bellow the reserve method is being called before any -allocation on the object therefore realloc being called without -any previous allocation. Inside realloc _data is being used with the -operator '[]', as it is nullptr at that moment it's an undefined -behaviour. - -This patch simply returns a call to alloc if _data is nullptr. - -This tests fails on PowerPC with Segmentation Fault because of this -issue: -segment_vector_array_expsize_assign_exceptions_oom_0_none -segment_vector_array_expsize_assign_exceptions_oom_0_memcheck -segment_vector_array_expsize_capacity_exceptions_oom_0_none -segment_vector_array_expsize_capacity_exceptions_oom_0_memcheck -segment_vector_array_expsize_modifiers_exceptions_oom_0_none -segment_vector_array_expsize_modifiers_exceptions_oom_0_memcheck -segment_vector_vector_expsize_assign_exceptions_oom_0_none -segment_vector_vector_expsize_assign_exceptions_oom_0_memcheck -segment_vector_vector_expsize_capacity_exceptions_oom_0_none -segment_vector_vector_expsize_capacity_exceptions_oom_0_memcheck -segment_vector_vector_expsize_modifiers_exceptions_oom_0_none -segment_vector_vector_expsize_modifiers_exceptions_oom_0_memcheck -segment_vector_vector_fixedsize_assign_exceptions_oom_0_none -segment_vector_vector_fixedsize_assign_exceptions_oom_0_memcheck - -Signed-off-by: Lucas A. M. Magalhães lamm@linux.ibm.com ---- - include/libpmemobj++/container/vector.hpp | 10 +++++++++- - 1 file changed, 9 insertions(+), 1 deletion(-) - -diff --git a/include/libpmemobj++/container/vector.hpp b/include/libpmemobj++/container/vector.hpp -index f430ed50..9810220b 100644 ---- a/include/libpmemobj++/container/vector.hpp -+++ b/include/libpmemobj++/container/vector.hpp -@@ -2362,7 +2362,8 @@ vector::internal_insert(size_type idx, InputIt first, InputIt last) - * Private helper function. Must be called during transaction. Allocates new - * memory for capacity_new number of elements and copies or moves old elements - * to new memory area. If the current size is greater than capacity_new, the -- * container is reduced to its first capacity_new elements. -+ * container is reduced to its first capacity_new elements. If was never -+ * allocated behaves as an alloc call. - * - * param[in] capacity_new new capacity. - * -@@ -2381,6 +2382,13 @@ vector::realloc(size_type capacity_new) - { - assert(pmemobj_tx_stage() == TX_STAGE_WORK); - -+ /* -+ * If _data == nullptr this object has never allocated any memory -+ * so we need to behave as alloc instead. -+ */ -+ if (_data == nullptr) -+ return alloc(capacity_new); -+ - /* - * XXX: future optimization: we don't have to snapshot data - * which we will not overwrite --- -2.27.0 - diff --git a/SOURCES/0002-vector-fix-referencing-empty-array-rhel90.patch b/SOURCES/0002-vector-fix-referencing-empty-array-rhel90.patch deleted file mode 100644 index 103aee0..0000000 --- a/SOURCES/0002-vector-fix-referencing-empty-array-rhel90.patch +++ /dev/null @@ -1,73 +0,0 @@ -diff --git a/include/libpmemobj++/container/vector.hpp b/include/libpmemobj++/container/vector.hpp ---- a/include/libpmemobj++/container/vector.hpp -+++ b/include/libpmemobj++/container/vector.hpp -@@ -668,7 +668,7 @@ vector::assign(size_type count, const_reference value) - add_data_to_tx(0, size_old); - - std::fill_n( -- &_data[0], -+ _data.get(), - (std::min)(count, - static_cast(size_old)), - value); -@@ -1600,7 +1600,7 @@ vector::insert(const_iterator pos, size_type count, const value_type &value) - single_element_iterator(&value, count)); - }); - -- return iterator(&_data[static_cast(idx)]); -+ return iterator(_data.get() + static_cast(idx)); - } - - /** -@@ -1843,7 +1843,7 @@ typename vector::iterator - vector::erase(const_iterator first, const_iterator last) - { - size_type idx = static_cast( -- std::distance(const_iterator(&_data[0]), first)); -+ std::distance(const_iterator(_data.get()), first)); - size_type count = static_cast(std::distance(first, last)); - - if (count == 0) -@@ -2306,10 +2306,11 @@ vector::internal_insert(size_type idx, InputIt first, InputIt last) - auto count = static_cast(std::distance(first, last)); - - if (_capacity >= size() + count) { -- pointer dest = -- &_data[static_cast(size() + count)]; -- pointer begin = &_data[static_cast(idx)]; -- pointer end = &_data[static_cast(size())]; -+ pointer dest = _data.get() + -+ static_cast(size() + count); -+ pointer begin = _data.get() + static_cast(idx); -+ pointer end = -+ _data.get() + static_cast(size()); - - add_data_to_tx(idx, size() - idx + count); - -@@ -2327,9 +2328,11 @@ vector::internal_insert(size_type idx, InputIt first, InputIt last) - - auto old_data = _data; - auto old_size = _size; -- pointer old_begin = &_data[0]; -- pointer old_mid = &_data[static_cast(idx)]; -- pointer old_end = &_data[static_cast(size())]; -+ pointer old_begin = _data.get(); -+ pointer old_mid = -+ _data.get() + static_cast(idx); -+ pointer old_end = -+ _data.get() + static_cast(size()); - - _data = nullptr; - _size = _capacity = 0; -@@ -2397,7 +2400,7 @@ vector::realloc(size_type capacity_new) - - auto old_data = _data; - auto old_size = _size; -- pointer old_begin = &_data[0]; -+ pointer old_begin = _data.get(); - pointer old_end = capacity_new < _size - ? &_data[static_cast(capacity_new)] - : &_data[static_cast(size())]; --- -2.27.0 - diff --git a/SPECS/libpmemobj-cpp.spec b/SPECS/libpmemobj-cpp.spec index ae871c7..5e10977 100644 --- a/SPECS/libpmemobj-cpp.spec +++ b/SPECS/libpmemobj-cpp.spec @@ -1,10 +1,10 @@ %global __cmake_in_source_build 1 %global min_libpmemobj_ver 1.9 -%global upstreamversion 1.12 +%global upstreamversion 1.13.0 Name: libpmemobj-cpp -Version: 1.12 -Release: 8%{?dist} +Version: 1.13.0 +Release: 1%{?dist} Summary: C++ bindings for libpmemobj # Note: tests/external/libcxx is dual licensed using University of Illinois "BSD-Like" license and the MIT license. It's used only during development/testing and is NOT part of the binary RPM. License: BSD @@ -12,9 +12,6 @@ URL: http://pmem.io/pmdk/cpp_obj/ Source0: https://github.com/pmem/%{name}/archive/%{upstreamversion}.tar.gz#/%{name}-%{upstreamversion}.tar.gz -Patch0: 0001-vector-Fix-undefined-behaviour-on-realloc.patch -Patch1: 0002-vector-fix-referencing-empty-array-rhel90.patch - BuildRequires: libpmemobj-devel >= %{min_libpmemobj_ver} BuildRequires: cmake >= 3.3 BuildRequires: glibc-devel @@ -100,14 +97,12 @@ HTML documentation for libpmemobj++. %prep %setup -q -n libpmemobj-cpp-%{upstreamversion} -%patch0 -p1 -%patch1 -p1 %build mkdir build cd build # CXX_STANDARD=17 matters only for tests, it can be safely disabled in distros without c++17-compliant compiler -%cmake .. -DCMAKE_INSTALL_DOCDIR=%{_docdir}/libpmemobj++ -DBUILD_TESTS=off -DCXX_STANDARD=17 +%cmake .. -DCMAKE_INSTALL_DOCDIR=%{_docdir}/libpmemobj++ -DBUILD_TESTS=off -DCXX_STANDARD=17 -DTESTS_USE_VALGRIND=OFF %make_build %install @@ -115,6 +110,10 @@ cd build %make_install %changelog +* Mon Oct 31 2022 Bryan Gurney - 1.13.0-1 +- Update to version 1.13.0 +- Resolves: rhbz#2136803 + * Mon Feb 28 2022 Bryan Gurney - 1.12-8 - Apply patch to fix undefined behavior on realloc - Also add and apply patch to fix referencing empty array