Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package libcuckoo for openSUSE:Factory checked in at 2023-01-17 17:36:04 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libcuckoo (Old) and /work/SRC/openSUSE:Factory/.libcuckoo.new.32243 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libcuckoo" Tue Jan 17 17:36:04 2023 rev:2 rq:1058972 version:0.3.1 Changes: -------- --- /work/SRC/openSUSE:Factory/libcuckoo/libcuckoo.changes 2022-02-21 17:48:56.491635842 +0100 +++ /work/SRC/openSUSE:Factory/.libcuckoo.new.32243/libcuckoo.changes 2023-01-17 17:36:19.221525732 +0100 @@ -1,0 +2,11 @@ +Thu Dec 29 23:00:34 UTC 2022 - Dirk Müller <[email protected]> + +- update to 0.3.1: + * Fix bug with copying deallocated bucket_container. + * Fix test_resize so that it works for 32-bit architectures. + * Fix UBSAN warning about unaligned access + * Add libcuckoo:: namespace + * Basic fix for std::is_pod deprecation in C++20 +- drop fix-tests-for-32-bit.patch (upstream) + +------------------------------------------------------------------- Old: ---- fix-tests-for-32-bit.patch libcuckoo-0.3.tar.gz New: ---- libcuckoo-0.3.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libcuckoo.spec ++++++ --- /var/tmp/diff_new_pack.ij0TkV/_old 2023-01-17 17:36:22.401543663 +0100 +++ /var/tmp/diff_new_pack.ij0TkV/_new 2023-01-17 17:36:22.409543708 +0100 @@ -1,7 +1,7 @@ # # spec file for package libcuckoo # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %{!?make_build:%global make_build make %{?_smp_mflags}} Name: libcuckoo -Version: 0.3 +Version: 0.3.1 Release: 0 Summary: A high-performance, concurrent hash table License: Apache-2.0 @@ -26,7 +26,6 @@ Source: https://github.com/efficient/%{name}/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz BuildRequires: cmake BuildRequires: gcc-c++ -Patch0: fix-tests-for-32-bit.patch %description Libcuckoo is a high-performance, concurrent hash table. ++++++ libcuckoo-0.3.tar.gz -> libcuckoo-0.3.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcuckoo-0.3/CMakeLists.txt new/libcuckoo-0.3.1/CMakeLists.txt --- old/libcuckoo-0.3/CMakeLists.txt 2020-03-25 15:39:43.000000000 +0100 +++ new/libcuckoo-0.3.1/CMakeLists.txt 2022-07-04 01:13:16.000000000 +0200 @@ -1,9 +1,7 @@ cmake_minimum_required(VERSION 3.1.0) -project(libcuckoo LANGUAGES C CXX) - -set(libcuckoo_VERSION_MAJOR 0) -set(libcuckoo_VERSION_MINOR 3) -set(libcuckoo_VERSION_PATCH 0) +project(libcuckoo + VERSION 0.3.1 + LANGUAGES C CXX) # put these in the cache so they show up in ccmake option (BUILD_EXAMPLES "build example libcuckoo programs") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcuckoo-0.3/libcuckoo/CMakeLists.txt new/libcuckoo-0.3.1/libcuckoo/CMakeLists.txt --- old/libcuckoo-0.3/libcuckoo/CMakeLists.txt 2020-03-25 15:39:43.000000000 +0100 +++ new/libcuckoo-0.3.1/libcuckoo/CMakeLists.txt 2022-07-04 01:13:16.000000000 +0200 @@ -11,6 +11,7 @@ # libcuckoo is an interface (all headers) library target add_library(libcuckoo INTERFACE) +add_library(libcuckoo::libcuckoo ALIAS libcuckoo) # tag libcuckoo target with a c++11 feature so that libcuckoo users # will have c++11 turned on in their compile when they use this target. @@ -19,7 +20,7 @@ # Include relative to the base directory target_include_directories(libcuckoo INTERFACE - $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}> + $<BUILD_INTERFACE:${libcuckoo_SOURCE_DIR}> $<INSTALL_INTERFACE:include> ) @@ -35,6 +36,7 @@ install(TARGETS libcuckoo EXPORT libcuckoo-targets) install(EXPORT libcuckoo-targets + NAMESPACE libcuckoo:: DESTINATION ${libcuckoo_pkgloc} FILE "libcuckoo-targets.cmake") install(FILES libcuckoo-config.cmake diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcuckoo-0.3/libcuckoo/bucket_container.hh new/libcuckoo-0.3.1/libcuckoo/bucket_container.hh --- old/libcuckoo-0.3/libcuckoo/bucket_container.hh 2020-03-25 15:39:43.000000000 +0100 +++ new/libcuckoo-0.3.1/libcuckoo/bucket_container.hh 2022-07-04 01:13:16.000000000 +0200 @@ -244,6 +244,14 @@ destroy_buckets(); } + // Returns true if the bucket container memory has been deallocated, or false + // if it still owns any memory. If true, the member-wise getter/setter + // operations cannot be called safely. Object-level members (such as + // hashpower and size) will remain valid after deallocation. + bool is_deallocated() const noexcept { + return buckets_ == nullptr; + } + private: using bucket_traits_ = typename traits_::template rebind_traits<bucket>; using bucket_pointer = typename bucket_traits_::pointer; @@ -284,7 +292,7 @@ } void destroy_buckets() noexcept { - if (buckets_ == nullptr) { + if (is_deallocated()) { return; } // The bucket default constructor is nothrow, so we don't have to @@ -321,6 +329,9 @@ const bucket_container &>::type src, std::integral_constant<bool, B> move) { assert(dst_hp >= src.hashpower()); + if (src.is_deallocated()) { + return nullptr; + } bucket_container dst(dst_hp, get_allocator()); // Move/copy all occupied slots of the source buckets for (size_t i = 0; i < src.size(); ++i) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcuckoo-0.3/libcuckoo/cuckoohash_map.hh new/libcuckoo-0.3.1/libcuckoo/cuckoohash_map.hh --- old/libcuckoo-0.3/libcuckoo/cuckoohash_map.hh 2020-03-25 15:39:43.000000000 +0100 +++ new/libcuckoo-0.3.1/libcuckoo/cuckoohash_map.hh 2022-07-04 01:13:16.000000000 +0200 @@ -112,8 +112,8 @@ minimum_load_factor_(DEFAULT_MINIMUM_LOAD_FACTOR), maximum_hashpower_(NO_MAXIMUM_HASHPOWER), max_num_worker_threads_(0) { - all_locks_.emplace_back(std::min(bucket_count(), size_type(kMaxNumLocks)), - spinlock(), get_allocator()); + all_locks_.emplace_back(get_allocator()); + all_locks_.back().resize(std::min(bucket_count(), size_type(kMaxNumLocks))); } /** @@ -695,7 +695,8 @@ void add_locks_from_other(const cuckoohash_map &other) { locks_t &other_locks = other.get_current_locks(); - all_locks_.emplace_back(other_locks.size(), spinlock(), get_allocator()); + all_locks_.emplace_back(get_allocator()); + all_locks_.back().resize(other_locks.size()); std::copy(other_locks.begin(), other_locks.end(), get_current_locks().begin()); } @@ -705,7 +706,9 @@ // true if the key is small and simple, which means using partial keys for // lookup would probably slow us down static constexpr bool is_simple() { - return std::is_pod<key_type>::value && sizeof(key_type) <= 8; + return std::is_standard_layout<key_type>::value && + std::is_trivial<key_type>::value && + sizeof(key_type) <= 8; } // Whether or not the data is nothrow-move-constructible. @@ -792,7 +795,7 @@ // under this lock. One can compute the size of the table by summing the // elem_counter over all locks. // - // - is_migrated: When resizing with cuckoo_fast_doulbe, we do not + // - is_migrated: When resizing with cuckoo_fast_double, we do not // immediately rehash elements from the old buckets array to the new one. // Instead, we'll mark all of the locks as not migrated. So anybody trying to // acquire the lock must also migrate the corresponding buckets if @@ -1820,8 +1823,8 @@ return; } - locks_t new_locks(std::min(size_type(kMaxNumLocks), new_bucket_count), - spinlock(), get_allocator()); + locks_t new_locks(get_allocator()); + new_locks.resize(std::min(size_type(kMaxNumLocks), new_bucket_count)); assert(new_locks.size() > current_locks.size()); std::copy(current_locks.begin(), current_locks.end(), new_locks.begin()); for (spinlock &lock : new_locks) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcuckoo-0.3/tests/unit-tests/test_bucket_container.cc new/libcuckoo-0.3.1/tests/unit-tests/test_bucket_container.cc --- old/libcuckoo-0.3/tests/unit-tests/test_bucket_container.cc 2020-03-25 15:39:43.000000000 +0100 +++ new/libcuckoo-0.3.1/tests/unit-tests/test_bucket_container.cc 2022-07-04 01:13:16.000000000 +0200 @@ -327,3 +327,16 @@ REQUIRE_THROWS_AS(other = container, std::runtime_error); ExceptionInt::do_throw = false; } + +TEST_CASE("copy destroyed buckets container", "[bucket container]") { + std::allocator<value_type> a; + TestingContainer<decltype(a)> bc(2, a); + REQUIRE(!bc.is_deallocated()); + bc.clear_and_deallocate(); + REQUIRE(bc.is_deallocated()); + auto bc2 = bc; + REQUIRE(bc.is_deallocated()); + REQUIRE(bc2.is_deallocated()); + REQUIRE(bc.size() == bc2.size()); + REQUIRE(bc.get_allocator() == bc2.get_allocator()); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcuckoo-0.3/tests/unit-tests/test_resize.cc new/libcuckoo-0.3.1/tests/unit-tests/test_resize.cc --- old/libcuckoo-0.3/tests/unit-tests/test_resize.cc 2020-03-25 15:39:43.000000000 +0100 +++ new/libcuckoo-0.3.1/tests/unit-tests/test_resize.cc 2022-07-04 01:13:16.000000000 +0200 @@ -1,4 +1,5 @@ #include <array> +#include <limits> #include <catch.hpp> @@ -45,15 +46,27 @@ REQUIRE(UnitTestInternalAccess::reserve_calc<IntIntTable>( 2500000 * slot_per_bucket) == 22); - REQUIRE(UnitTestInternalAccess::reserve_calc<IntIntTable>( - (1ULL << 31) * slot_per_bucket) == 31); - REQUIRE(UnitTestInternalAccess::reserve_calc<IntIntTable>( - ((1ULL << 31) + 1) * slot_per_bucket) == 32); - - REQUIRE(UnitTestInternalAccess::reserve_calc<IntIntTable>( - (1ULL << 61) * slot_per_bucket) == 61); - REQUIRE(UnitTestInternalAccess::reserve_calc<IntIntTable>( - ((1ULL << 61) + 1) * slot_per_bucket) == 62); + // The maximum number of elements we can ask to reserve without incurring + // rounding error when computing a number of buckets is + // SIZE_T_MAX-slot_per_bucket(), which will come out to int_div(SIZE_T_MAX - + // 1, slot_per_bucket()) buckets. + const size_t max_buckets = ( + std::numeric_limits<size_t>::max() - 1)/slot_per_bucket; + // Since the table is always sized in powers of two, our maximum hashpower + // comes out to max_hashpower = floor(log2(max_buckets)). We compute this in + // a numerically-stable fashion. + size_t max_hashpower = 0; + for (; (static_cast<size_t>(1) << (max_hashpower + 1)) <= max_buckets; ++max_hashpower); + // Test the boundary between max_hashpower-1 and max_hashpower. + const size_t max_elems_before_max_hashpower = ( + static_cast<size_t>(1) << (max_hashpower - 1)) * slot_per_bucket; + REQUIRE(UnitTestInternalAccess::reserve_calc<IntIntTable>( + max_elems_before_max_hashpower) == (max_hashpower - 1)); + REQUIRE(UnitTestInternalAccess::reserve_calc<IntIntTable>( + max_elems_before_max_hashpower + 1) == max_hashpower); + // Test the maximum number of elements. + const size_t max_elems = (static_cast<size_t>(1) << max_hashpower) * slot_per_bucket; + REQUIRE(UnitTestInternalAccess::reserve_calc<IntIntTable>(max_elems) == max_hashpower); } struct my_type {
