summaryrefslogtreecommitdiff
path: root/dev-db/mysql-connector-c/files/mysql-connector-c-8.0.27-res_n.patch
diff options
context:
space:
mode:
authorbrahmajit das <brahmajit.xyz@gmail.com>2022-07-15 11:22:59 +0530
committerSam James <sam@gentoo.org>2022-07-15 08:10:07 +0100
commit0f7808b289d1eb16cef25c2de6411cc580b97c5c (patch)
tree6ebab792f12b1ac7dcd21105894a25aa84b64ee8 /dev-db/mysql-connector-c/files/mysql-connector-c-8.0.27-res_n.patch
parentff91f85cc312e803e57c96be3ddd1e5988d0f464 (diff)
downloadgentoo-0f7808b289d1eb16cef25c2de6411cc580b97c5c.tar.gz
gentoo-0f7808b289d1eb16cef25c2de6411cc580b97c5c.tar.bz2
gentoo-0f7808b289d1eb16cef25c2de6411cc580b97c5c.zip
dev-db/mysql-connector-c: Use res_n* functions only on GLIBC
The issue occurs because the package tries to use the res_n* functions (specifically res_ninit, res_nsearch and res_nclose) from resolv.h which do not exist when using musl. So we are falling back to non-thread-safe functions from resolv.h Closes: https://bugs.gentoo.org/761352 Signed-off-by: brahmajit das <brahmajit.xyz@gmail.com> Closes: https://github.com/gentoo/gentoo/pull/26353 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-db/mysql-connector-c/files/mysql-connector-c-8.0.27-res_n.patch')
-rw-r--r--dev-db/mysql-connector-c/files/mysql-connector-c-8.0.27-res_n.patch49
1 files changed, 49 insertions, 0 deletions
diff --git a/dev-db/mysql-connector-c/files/mysql-connector-c-8.0.27-res_n.patch b/dev-db/mysql-connector-c/files/mysql-connector-c-8.0.27-res_n.patch
new file mode 100644
index 000000000000..34961b8ad9e2
--- /dev/null
+++ b/dev-db/mysql-connector-c/files/mysql-connector-c-8.0.27-res_n.patch
@@ -0,0 +1,49 @@
+# Musl doesn't have res_n* functions so we are falling back to the not
+# thread safe ones. Patch made with help from developer Fabian Groffen
+# <grobian@gentoo.org>.
+#
+# Closes: https://bugs.gentoo.org/761352
+# See also: https://github.com/mysql/mysql-server/pull/385
+# See also: https://bugs.mysql.com/bug.php?id=106034
+--- a/libmysql/CMakeLists.txt
++++ b/libmysql/CMakeLists.txt
+@@ -423,6 +423,19 @@ IF(HAS_WARN_FLAG)
+ )
+ ENDIF()
+
++check_symbol_exists(res_ninit "resolv.h" HAVE_RES_NINIT_FUNCTION)
++check_symbol_exists(res_nsearch "resolv.h" HAVE_RES_NSEARCH_FUNCTION)
++check_symbol_exists(res_nclose "resolv.h" HAVE_RES_NCLOSE_FUNCTION)
++IF (HAVE_RES_NINIT_FUNCTION)
++ add_compile_definitions(HAVE_RES_NINIT)
++ENDIF(HAVE_RES_NINIT_FUNCTION)
++IF (HAVE_RES_NSEARCH_FUNCTION)
++ add_compile_definitions(HAVE_RES_NSEARCH)
++ENDIF(HAVE_RES_NSEARCH_FUNCTION)
++IF (HAVE_RES_NCLOSE_FUNCTION)
++ add_compile_definitions(HAVE_RES_NCLOSE)
++ENDIF(HAVE_RES_NCLOSE_FUNCTION)
++
+ # Verify that libmysql_api_test runs OK
+ ADD_CUSTOM_COMMAND(TARGET libmysql_api_test POST_BUILD
+ COMMAND libmysql_api_test
+--- a/libmysql/dns_srv.cc
++++ b/libmysql/dns_srv.cc
+@@ -37,6 +37,17 @@
+ #include <netdb.h>
+ #include <resolv.h>
+
++/* we don't have anything else but the non-thread-safe variants */
++#if !defined(HAVE_RES_NINIT)
++#define res_ninit(X) (void)X
++#endif
++#if !defined(HAVE_RES_NSEARCH)
++#define res_nsearch(X,D,I,S,B,L) res_search(D,I,S,B,L)
++#endif
++#if !defined(HAVE_RES_NCLOSE)
++#define res_nclose(X) (void)X
++#endif
++
+ // POSIX version
+
+ static bool get_dns_srv(Dns_srv_data &data, const char *dnsname, int &error) {