Gentoo Archives: gentoo-commits

From: Andreas Sturmlechner <asturm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-util/mdds/, dev-util/mdds/files/
Date: Thu, 17 Jun 2021 12:47:34
Message-Id: 1623934037.39c12693d5372029f54a3b853179bf4c7fada1c3.asturm@gentoo
1 commit: 39c12693d5372029f54a3b853179bf4c7fada1c3
2 Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
3 AuthorDate: Thu Jun 17 12:45:37 2021 +0000
4 Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
5 CommitDate: Thu Jun 17 12:47:17 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=39c12693
7
8 dev-util/mdds: Fix rtree_test
9
10 See also: https://gitlab.com/mdds/mdds/-/issues/66
11 Upstream commit 7ab81002fe127d16602b85b391c1d1b0422a9afd
12
13 Thanks-to: Paul Mulders <justinkb <AT> gmail.com>
14 Closes: https://bugs.gentoo.org/775056
15 Package-Manager: Portage-3.0.20, Repoman-3.0.3
16 Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
17
18 dev-util/mdds/files/mdds-1.7.0-rtree_test.patch | 52 +++++++++++++++++++++++++
19 dev-util/mdds/mdds-1.7.0.ebuild | 3 +-
20 2 files changed, 54 insertions(+), 1 deletion(-)
21
22 diff --git a/dev-util/mdds/files/mdds-1.7.0-rtree_test.patch b/dev-util/mdds/files/mdds-1.7.0-rtree_test.patch
23 new file mode 100644
24 index 00000000000..391f8979891
25 --- /dev/null
26 +++ b/dev-util/mdds/files/mdds-1.7.0-rtree_test.patch
27 @@ -0,0 +1,52 @@
28 +From 7ab81002fe127d16602b85b391c1d1b0422a9afd Mon Sep 17 00:00:00 2001
29 +From: Kohei Yoshida <kohei.yoshida@×××××.com>
30 +Date: Mon, 14 Jun 2021 22:52:14 -0400
31 +Subject: [PATCH] std::deque::erase invalidates all elements if the erased
32 + element ...
33 +
34 +... is not the first or the last element. My previous assumption (
35 +that only the elements that occur after the erased element become
36 +invalid) was in fact wrong.
37 +
38 +This should resolve #66.
39 +---
40 + include/mdds/rtree_def.inl | 21 ++++++++++++---------
41 + 1 file changed, 12 insertions(+), 9 deletions(-)
42 +
43 +diff --git a/include/mdds/rtree_def.inl b/include/mdds/rtree_def.inl
44 +index ed0e9be..84f0673 100644
45 +--- a/include/mdds/rtree_def.inl
46 ++++ b/include/mdds/rtree_def.inl
47 +@@ -836,17 +836,20 @@ bool rtree<_Key,_Value,_Trait>::directory_node::erase(const node_store* ns)
48 + if (it == children.end())
49 + return false;
50 +
51 +- it = children.erase(it);
52 ++ // NB: std::deque::erase invalidates all elements when the erased element
53 ++ // is somwhere in the middle. But if the erased element is either the
54 ++ // first or the last element, only the erased element becomes invalidated.
55 +
56 +- // All nodes that occur after the erased node have their memory addresses
57 +- // shifted.
58 ++ std::size_t pos = std::distance(children.begin(), it);
59 ++ bool all_valid = pos == 0 || pos == children.size() - 1;
60 +
61 +- std::for_each(it, children.end(),
62 +- [](node_store& this_ns)
63 +- {
64 +- this_ns.valid_pointer = false;
65 +- }
66 +- );
67 ++ it = children.erase(it);
68 ++
69 ++ if (!all_valid)
70 ++ {
71 ++ for (node_store& ns : children)
72 ++ ns.valid_pointer = false;
73 ++ }
74 +
75 + return true;
76 + }
77 +--
78 +GitLab
79 +
80
81 diff --git a/dev-util/mdds/mdds-1.7.0.ebuild b/dev-util/mdds/mdds-1.7.0.ebuild
82 index 6bd8e95ff76..62a57426b64 100644
83 --- a/dev-util/mdds/mdds-1.7.0.ebuild
84 +++ b/dev-util/mdds/mdds-1.7.0.ebuild
85 @@ -1,4 +1,4 @@
86 -# Copyright 1999-2020 Gentoo Authors
87 +# Copyright 1999-2021 Gentoo Authors
88 # Distributed under the terms of the GNU General Public License v2
89
90 EAPI=7
91 @@ -33,6 +33,7 @@ RDEPEND="${DEPEND}"
92 PATCHES=(
93 "${FILESDIR}/${PN}-1.5.0-buildsystem.patch"
94 "${FILESDIR}/${P}-bashism.patch" # bug 723094
95 + "${FILESDIR}/${P}-rtree_test.patch" # bug 775056
96 )
97
98 pkg_pretend() {