commit:     d505755847920dd39253b39636f03486e1f6a426
Author:     Alexey Sokolov <alexey+gentoo <AT> asokolov <DOT> org>
AuthorDate: Fri May 16 22:17:09 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri May 16 22:37:39 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d5057558

dev-cpp/sol2: fix build

Closes: https://bugs.gentoo.org/955999
Signed-off-by: Alexey Sokolov <alexey+gentoo <AT> asokolov.org>
Part-of: https://github.com/gentoo/gentoo/pull/42123
Closes: https://github.com/gentoo/gentoo/pull/42123
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-cpp/sol2/files/sol2-3.5.0-iterend.patch        | 58 ++++++++++++++++++++++
 .../{sol2-3.5.0.ebuild => sol2-3.5.0-r1.ebuild}    |  1 +
 2 files changed, 59 insertions(+)

diff --git a/dev-cpp/sol2/files/sol2-3.5.0-iterend.patch 
b/dev-cpp/sol2/files/sol2-3.5.0-iterend.patch
new file mode 100644
index 000000000000..b7e8a1c4fcbf
--- /dev/null
+++ b/dev-cpp/sol2/files/sol2-3.5.0-iterend.patch
@@ -0,0 +1,58 @@
+https://github.com/ThePhD/sol2/pull/1676
+https://bugs.gentoo.org/955999
+
+From 8f80cd79f60613b96c877cec2bba3efee2a78225 Mon Sep 17 00:00:00 2001
+From: martin nylin <[email protected]>
+Date: Tue, 11 Mar 2025 20:58:43 +0100
+Subject: [PATCH 1/2] Change end() to sen() in usertype_container.hpp
+
+---
+ include/sol/usertype_container.hpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include/sol/usertype_container.hpp 
b/include/sol/usertype_container.hpp
+index 6d25d2a8..3ff81724 100644
+--- a/include/sol/usertype_container.hpp
++++ b/include/sol/usertype_container.hpp
+@@ -1189,7 +1189,7 @@ namespace sol {
+                       static int next_associative(std::true_type, lua_State* 
L_) {
+                               iter& i = 
stack::unqualified_get<user<iter>>(L_, 1);
+                               auto& it = i.it();
+-                              auto& end = i.end();
++                              auto& end = i.sen();
+                               if (it == end) {
+                                       return stack::push(L_, lua_nil);
+                               }
+
+From a6872ef46b08704b9069ebf83161f4637459ce63 Mon Sep 17 00:00:00 2001
+From: martin nylin <[email protected]>
+Date: Tue, 11 Mar 2025 21:28:44 +0100
+Subject: [PATCH 2/2] Fix array index out of bounds in stack_field.hpp
+
+---
+ include/sol/stack_field.hpp | 12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/include/sol/stack_field.hpp b/include/sol/stack_field.hpp
+index 9dd66e2e..3b815225 100644
+--- a/include/sol/stack_field.hpp
++++ b/include/sol/stack_field.hpp
+@@ -113,7 +113,17 @@ namespace sol { namespace stack {
+                                               lua_getglobal(L, &key[0]);
+                                       }
+                                       else {
+-                                              lua_getfield(L, tableindex, 
&key[0]);
++                                              if constexpr 
(std::is_same_v<std::decay_t<Key>, const char*>) {
++                                                      // Handle const char* 
case
++                                                      if (key != nullptr) {
++                                                              lua_getfield(L, 
tableindex, key);
++                                                      } else {
++                                                              push(L, 
lua_nil);
++                                                      }
++                                              } else {
++                                                      // Handle std::string 
case
++                                                      lua_getfield(L, 
tableindex, key.c_str());
++                                              }
+                                       }
+                               }
+                               else if constexpr (std::is_same_v<T, 
meta_function>) {

diff --git a/dev-cpp/sol2/sol2-3.5.0.ebuild b/dev-cpp/sol2/sol2-3.5.0-r1.ebuild
similarity index 97%
rename from dev-cpp/sol2/sol2-3.5.0.ebuild
rename to dev-cpp/sol2/sol2-3.5.0-r1.ebuild
index 3d483db70d0e..131485c7116f 100644
--- a/dev-cpp/sol2/sol2-3.5.0.ebuild
+++ b/dev-cpp/sol2/sol2-3.5.0-r1.ebuild
@@ -32,6 +32,7 @@ PATCHES=(
        "${FILESDIR}"/sol2-3.5.0-luajit-pkgconf.patch
        "${FILESDIR}"/sol2-3.5.0-catch-depend.patch
        "${FILESDIR}"/sol2-3.3.0-dont-install-tests.patch
+       "${FILESDIR}"/sol2-3.5.0-iterend.patch
 )
 
 src_configure() {

Reply via email to