svn commit: r501973 - in head/net/qt5-network: . files
Gleb Popov
arrowd at FreeBSD.org
Sat May 18 16:23:57 UTC 2019
Author: arrowd
Date: Sat May 18 16:23:55 2019
New Revision: 501973
URL: https://svnweb.freebsd.org/changeset/ports/501973
Log:
net/qt5-network: Add patch from Qt upstream fixing QDnsLookup.
This should fix bug in net-im/psi, when connecting to some servers was failing.
Reviewed by: tcberner (mentor)
Added:
head/net/qt5-network/files/patch-qdnslookup (contents, props changed)
Modified:
head/net/qt5-network/Makefile
Modified: head/net/qt5-network/Makefile
==============================================================================
--- head/net/qt5-network/Makefile Sat May 18 16:11:02 2019 (r501972)
+++ head/net/qt5-network/Makefile Sat May 18 16:23:55 2019 (r501973)
@@ -2,6 +2,7 @@
PORTNAME= network
DISTVERSION= ${QT5_VERSION}
+PORTREVISION= 1
CATEGORIES= net ipv6
PKGNAMEPREFIX= qt5-
Added: head/net/qt5-network/files/patch-qdnslookup
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/net/qt5-network/files/patch-qdnslookup Sat May 18 16:23:55 2019 (r501973)
@@ -0,0 +1,109 @@
+QDnsLookup: fix "Resolver functions not found" error on FreeBSD
+
+The current code only tries to load the required functions from
+LIBRESOLV_SO (if defined) and resolv, but on FreeBSD they are in libc:
+https://www.freebsd.org/cgi/man.cgi?query=res_query&sektion=3&apropos=0&manpath=freebsd
+
+This commit changes the code so that, after failing to load the
+non-existent libraries, it attempts to load the functions with dlsym()
+using the special handle RTLD_DEFAULT, which searches for the specified
+symbol in the loaded libraries.
+
+Task-number: QTBUG-74844
+
+diff --git a/src/network/kernel/kernel.pri b/src/network/kernel/kernel.pri
+index 11b80d59d5e..d7a92a12ebe 100644
+--- src/network/kernel/kernel.pri
++++ src/network/kernel/kernel.pri
+@@ -38,7 +38,11 @@ qtConfig(dnslookup) {
+ }
+
+ unix {
+- !integrity:qtConfig(dnslookup): SOURCES += kernel/qdnslookup_unix.cpp
++ !integrity:qtConfig(dnslookup) {
++ SOURCES += kernel/qdnslookup_unix.cpp
++ qtConfig(dlopen): QMAKE_USE_PRIVATE += libdl
++ }
++
+ SOURCES += kernel/qhostinfo_unix.cpp
+
+ qtConfig(linux-netlink): SOURCES += kernel/qnetworkinterface_linux.cpp
+diff --git a/src/network/kernel/qdnslookup_unix.cpp b/src/network/kernel/qdnslookup_unix.cpp
+index ce1ec6442a6..ee7484ab35f 100644
+--- src/network/kernel/qdnslookup_unix.cpp
++++ src/network/kernel/qdnslookup_unix.cpp
+@@ -59,6 +59,10 @@
+ # include <gnu/lib-names.h>
+ #endif
+
++#if defined(Q_OS_FREEBSD) || QT_CONFIG(dlopen)
++# include <dlfcn.h>
++#endif
++
+ #include <cstring>
+
+ QT_BEGIN_NAMESPACE
+@@ -87,6 +91,18 @@ struct QDnsLookupStateDeleter
+ }
+ };
+
++static QFunctionPointer resolveSymbol(QLibrary &lib, const char *sym)
++{
++ if (lib.isLoaded())
++ return lib.resolve(sym);
++
++#if defined(RTLD_DEFAULT) && (defined(Q_OS_FREEBSD) || QT_CONFIG(dlopen))
++ return reinterpret_cast<QFunctionPointer>(dlsym(RTLD_DEFAULT, sym));
++#else
++ return nullptr;
++#endif
++}
++
+ static bool resolveLibraryInternal()
+ {
+ QLibrary lib;
+@@ -96,31 +112,30 @@ static bool resolveLibraryInternal()
+ #endif
+ {
+ lib.setFileName(QLatin1String("resolv"));
+- if (!lib.load())
+- return false;
++ lib.load();
+ }
+
+- local_dn_expand = dn_expand_proto(lib.resolve("__dn_expand"));
++ local_dn_expand = dn_expand_proto(resolveSymbol(lib, "__dn_expand"));
+ if (!local_dn_expand)
+- local_dn_expand = dn_expand_proto(lib.resolve("dn_expand"));
++ local_dn_expand = dn_expand_proto(resolveSymbol(lib, "dn_expand"));
+
+- local_res_nclose = res_nclose_proto(lib.resolve("__res_nclose"));
++ local_res_nclose = res_nclose_proto(resolveSymbol(lib, "__res_nclose"));
+ if (!local_res_nclose)
+- local_res_nclose = res_nclose_proto(lib.resolve("res_9_nclose"));
++ local_res_nclose = res_nclose_proto(resolveSymbol(lib, "res_9_nclose"));
+ if (!local_res_nclose)
+- local_res_nclose = res_nclose_proto(lib.resolve("res_nclose"));
++ local_res_nclose = res_nclose_proto(resolveSymbol(lib, "res_nclose"));
+
+- local_res_ninit = res_ninit_proto(lib.resolve("__res_ninit"));
++ local_res_ninit = res_ninit_proto(resolveSymbol(lib, "__res_ninit"));
+ if (!local_res_ninit)
+- local_res_ninit = res_ninit_proto(lib.resolve("res_9_ninit"));
++ local_res_ninit = res_ninit_proto(resolveSymbol(lib, "res_9_ninit"));
+ if (!local_res_ninit)
+- local_res_ninit = res_ninit_proto(lib.resolve("res_ninit"));
++ local_res_ninit = res_ninit_proto(resolveSymbol(lib, "res_ninit"));
+
+- local_res_nquery = res_nquery_proto(lib.resolve("__res_nquery"));
++ local_res_nquery = res_nquery_proto(resolveSymbol(lib, "__res_nquery"));
+ if (!local_res_nquery)
+- local_res_nquery = res_nquery_proto(lib.resolve("res_9_nquery"));
++ local_res_nquery = res_nquery_proto(resolveSymbol(lib, "res_9_nquery"));
+ if (!local_res_nquery)
+- local_res_nquery = res_nquery_proto(lib.resolve("res_nquery"));
++ local_res_nquery = res_nquery_proto(resolveSymbol(lib, "res_nquery"));
+
+ return true;
+ }
+
More information about the svn-ports-head
mailing list