Gentoo Archives: gentoo-commits

From: Mike Gilbert <floppym@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-cpp/gtest/files/, dev-cpp/gtest/
Date: Tue, 09 Jan 2018 16:12:45
Message-Id: 1515514206.b6ff87f01454fa2c2525917e7d2ff2b0089ade02.floppym@gentoo
1 commit: b6ff87f01454fa2c2525917e7d2ff2b0089ade02
2 Author: Peter Levine <plevine457 <AT> gmail <DOT> com>
3 AuthorDate: Mon Jan 8 02:48:58 2018 +0000
4 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org>
5 CommitDate: Tue Jan 9 16:10:06 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b6ff87f0
7
8 dev-cpp/gtest: Fix double free error
9
10 Bug: https://bugs.gentoo.org/631698
11 Closes: https://github.com/gentoo/gentoo/pull/5605
12 Package-Manager: Portage-2.3.16, Repoman-2.3.6
13
14 .../gtest/files/gtest-1.8.0-fix-doublefree.patch | 98 ++++++++++++++++++++++
15 dev-cpp/gtest/gtest-1.7.0-r1.ebuild | 2 +-
16 .../{gtest-1.8.0.ebuild => gtest-1.8.0-r1.ebuild} | 3 +-
17 dev-cpp/gtest/gtest-1.8.0.ebuild | 2 +-
18 dev-cpp/gtest/gtest-9999.ebuild | 1 +
19 5 files changed, 103 insertions(+), 3 deletions(-)
20
21 diff --git a/dev-cpp/gtest/files/gtest-1.8.0-fix-doublefree.patch b/dev-cpp/gtest/files/gtest-1.8.0-fix-doublefree.patch
22 new file mode 100644
23 index 00000000000..40fa1f6668b
24 --- /dev/null
25 +++ b/dev-cpp/gtest/files/gtest-1.8.0-fix-doublefree.patch
26 @@ -0,0 +1,98 @@
27 +Bug: https://bugs.gentoo.org/631698
28 +Upstream PR: https://github.com/google/googletest/pull/1339
29 +
30 +From 0663ce9024c9b78ddf6eb3fc1ceb45361ed91767 Mon Sep 17 00:00:00 2001
31 +From: Romain Geissler <romain.geissler@×××××.com>
32 +Date: Sat, 2 Dec 2017 22:47:20 +0100
33 +Subject: [PATCH] Fix double free when building Gtest/GMock in shared libraries
34 + and linking a test executable with both.
35 +
36 +---
37 + googlemock/CMakeLists.txt | 63 ++++++++++++++++++++++++++++++-----------------
38 + 1 file changed, 40 insertions(+), 23 deletions(-)
39 +
40 +diff --git a/googlemock/CMakeLists.txt b/googlemock/CMakeLists.txt
41 +index 724fdd5f0..f7bad8afc 100644
42 +--- a/googlemock/CMakeLists.txt
43 ++++ b/googlemock/CMakeLists.txt
44 +@@ -86,16 +86,23 @@ endif()
45 + # Google Mock libraries. We build them using more strict warnings than what
46 + # are used for other targets, to ensure that Google Mock can be compiled by
47 + # a user aggressive about warnings.
48 +-cxx_library(gmock
49 +- "${cxx_strict}"
50 +- "${gtest_dir}/src/gtest-all.cc"
51 +- src/gmock-all.cc)
52 +-
53 +-cxx_library(gmock_main
54 +- "${cxx_strict}"
55 +- "${gtest_dir}/src/gtest-all.cc"
56 +- src/gmock-all.cc
57 +- src/gmock_main.cc)
58 ++if (MSVC)
59 ++ cxx_library(gmock
60 ++ "${cxx_strict}"
61 ++ "${gtest_dir}/src/gtest-all.cc"
62 ++ src/gmock-all.cc)
63 ++
64 ++ cxx_library(gmock_main
65 ++ "${cxx_strict}"
66 ++ "${gtest_dir}/src/gtest-all.cc"
67 ++ src/gmock-all.cc
68 ++ src/gmock_main.cc)
69 ++else()
70 ++ cxx_library(gmock "${cxx_strict}" src/gmock-all.cc)
71 ++ target_link_libraries(gmock gtest)
72 ++ cxx_library(gmock_main "${cxx_strict}" src/gmock_main.cc)
73 ++ target_link_libraries(gmock_main gmock)
74 ++endif()
75 +
76 + # If the CMake version supports it, attach header directory information
77 + # to the targets for when we are part of a parent build (ie being pulled
78 +@@ -175,23 +182,33 @@ if (gmock_build_tests)
79 + ############################################################
80 + # C++ tests built with non-standard compiler flags.
81 +
82 +- cxx_library(gmock_main_no_exception "${cxx_no_exception}"
83 +- "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc)
84 +-
85 +- cxx_library(gmock_main_no_rtti "${cxx_no_rtti}"
86 +- "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc)
87 ++ if (MSVC)
88 ++ cxx_library(gmock_main_no_exception "${cxx_no_exception}"
89 ++ "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc)
90 +
91 +- if (NOT MSVC OR MSVC_VERSION LESS 1600) # 1600 is Visual Studio 2010.
92 +- # Visual Studio 2010, 2012, and 2013 define symbols in std::tr1 that
93 +- # conflict with our own definitions. Therefore using our own tuple does not
94 +- # work on those compilers.
95 +- cxx_library(gmock_main_use_own_tuple "${cxx_use_own_tuple}"
96 ++ cxx_library(gmock_main_no_rtti "${cxx_no_rtti}"
97 + "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc)
98 +
99 +- cxx_test_with_flags(gmock_use_own_tuple_test "${cxx_use_own_tuple}"
100 +- gmock_main_use_own_tuple test/gmock-spec-builders_test.cc)
101 ++ if (MSVC_VERSION LESS 1600) # 1600 is Visual Studio 2010.
102 ++ # Visual Studio 2010, 2012, and 2013 define symbols in std::tr1 that
103 ++ # conflict with our own definitions. Therefore using our own tuple does not
104 ++ # work on those compilers.
105 ++ cxx_library(gmock_main_use_own_tuple "${cxx_use_own_tuple}"
106 ++ "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc)
107 ++
108 ++ cxx_test_with_flags(gmock_use_own_tuple_test "${cxx_use_own_tuple}"
109 ++ gmock_main_use_own_tuple test/gmock-spec-builders_test.cc)
110 ++ endif()
111 ++ else()
112 ++ cxx_library(gmock_main_no_exception "${cxx_no_exception}" src/gmock_main.cc)
113 ++ target_link_libraries(gmock_main_no_exception gmock)
114 ++
115 ++ cxx_library(gmock_main_no_rtti "${cxx_no_rtti}" src/gmock_main.cc)
116 ++ target_link_libraries(gmock_main_no_rtti gmock)
117 ++
118 ++ cxx_library(gmock_main_use_own_tuple "${cxx_use_own_tuple}" src/gmock_main.cc)
119 ++ target_link_libraries(gmock_main_use_own_tuple gmock)
120 + endif()
121 +-
122 + cxx_test_with_flags(gmock-more-actions_no_exception_test "${cxx_no_exception}"
123 + gmock_main_no_exception test/gmock-more-actions_test.cc)
124 +
125
126 diff --git a/dev-cpp/gtest/gtest-1.7.0-r1.ebuild b/dev-cpp/gtest/gtest-1.7.0-r1.ebuild
127 index ee90d10ca58..f1185b2db0c 100644
128 --- a/dev-cpp/gtest/gtest-1.7.0-r1.ebuild
129 +++ b/dev-cpp/gtest/gtest-1.7.0-r1.ebuild
130 @@ -1,4 +1,4 @@
131 -# Copyright 1999-2017 Gentoo Foundation
132 +# Copyright 1999-2018 Gentoo Foundation
133 # Distributed under the terms of the GNU General Public License v2
134
135 EAPI="5"
136
137 diff --git a/dev-cpp/gtest/gtest-1.8.0.ebuild b/dev-cpp/gtest/gtest-1.8.0-r1.ebuild
138 similarity index 94%
139 copy from dev-cpp/gtest/gtest-1.8.0.ebuild
140 copy to dev-cpp/gtest/gtest-1.8.0-r1.ebuild
141 index 1091001188e..e824453822e 100644
142 --- a/dev-cpp/gtest/gtest-1.8.0.ebuild
143 +++ b/dev-cpp/gtest/gtest-1.8.0-r1.ebuild
144 @@ -1,4 +1,4 @@
145 -# Copyright 1999-2017 Gentoo Foundation
146 +# Copyright 1999-2018 Gentoo Foundation
147 # Distributed under the terms of the GNU General Public License v2
148
149 EAPI=6
150 @@ -25,6 +25,7 @@ PATCHES=(
151 "${FILESDIR}"/${PN}-9999-fix-gcc6-undefined-behavior.patch
152 "${FILESDIR}"/${PN}-1.8.0-multilib-strict.patch
153 "${FILESDIR}"/${PN}-1.8.0-increase-clone-stack-size.patch
154 + "${FILESDIR}"/${PN}-1.8.0-fix-doublefree.patch
155 )
156
157 S="${WORKDIR}"/googletest-release-${PV}
158
159 diff --git a/dev-cpp/gtest/gtest-1.8.0.ebuild b/dev-cpp/gtest/gtest-1.8.0.ebuild
160 index 1091001188e..3dbd8e1a06d 100644
161 --- a/dev-cpp/gtest/gtest-1.8.0.ebuild
162 +++ b/dev-cpp/gtest/gtest-1.8.0.ebuild
163 @@ -1,4 +1,4 @@
164 -# Copyright 1999-2017 Gentoo Foundation
165 +# Copyright 1999-2018 Gentoo Foundation
166 # Distributed under the terms of the GNU General Public License v2
167
168 EAPI=6
169
170 diff --git a/dev-cpp/gtest/gtest-9999.ebuild b/dev-cpp/gtest/gtest-9999.ebuild
171 index a2c14fe23fd..06c94dbd49a 100644
172 --- a/dev-cpp/gtest/gtest-9999.ebuild
173 +++ b/dev-cpp/gtest/gtest-9999.ebuild
174 @@ -30,6 +30,7 @@ RDEPEND="!dev-cpp/gmock"
175 PATCHES=(
176 "${FILESDIR}"/${PN}-9999-fix-gcc6-undefined-behavior.patch
177 "${FILESDIR}"/${PN}-1.8.0-increase-clone-stack-size.patch
178 + "${FILESDIR}"/${PN}-1.8.0-fix-doublefree.patch
179 )
180
181 pkg_setup() {