summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2020-08-04 01:31:37 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2020-08-04 02:37:51 +0530
commitd6818329262ff099b52d7a3cb88bf5ace7a27e78 (patch)
treeff588cc52331b5c3f412741d535690db56fe0a13
parentfdf567656e8a4fb9b4891c9fa3d82873bc79baec (diff)
glib.recipe: Re-enable GResolver lookup by name and address
We only need to return an error when DNS record lookup is requested, which is rare. The most common usage is lookup by name and address, both of which work fine already. Part-of: <https://gitlab.freedesktop.org/gstreamer/cerbero/-/merge_requests/569>
-rw-r--r--recipes/glib.recipe4
-rw-r--r--recipes/glib/uwp/0001-gio-Disable-generic-DNS-record-lookup-on-UWP.patch57
-rw-r--r--recipes/glib/uwp/0018-gio-Disable-win32-API-and-modules-when-unavailable-o.patch63
3 files changed, 74 insertions, 50 deletions
diff --git a/recipes/glib.recipe b/recipes/glib.recipe
index 5d4f3a6d..463cd16b 100644
--- a/recipes/glib.recipe
+++ b/recipes/glib.recipe
@@ -137,10 +137,12 @@ class Recipe(recipe.Recipe):
self.files_bins.remove('gdbus')
self.files_bins_devel.remove('bin/gdbus.pdb')
self.patches += [
+ # https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1583
+ 'glib/uwp/0001-gio-Remove-broken-support-for-XP.patch',
# Ready to upstream
+ 'glib/uwp/0001-gio-Disable-generic-DNS-record-lookup-on-UWP.patch',
'glib/uwp/0001-glib-Never-use-MessageBox-on-UWP-apps.patch',
'glib/uwp/0001-gpoll-UWP-does-not-need-to-poll-a-msg_fd.patch',
- 'glib/uwp/0001-gio-Remove-broken-support-for-XP.patch',
'glib/uwp/0002-win_iconv-Use-LoadPackagedLibrary-when-building-UWP-.patch',
'glib/uwp/0003-glib-getpid-is-available-on-Win32-but-not-WinRT.patch',
'glib/uwp/0004-goption-Do-not-call-GetCommandlineW-on-UWP.patch',
diff --git a/recipes/glib/uwp/0001-gio-Disable-generic-DNS-record-lookup-on-UWP.patch b/recipes/glib/uwp/0001-gio-Disable-generic-DNS-record-lookup-on-UWP.patch
new file mode 100644
index 00000000..7a3fae7a
--- /dev/null
+++ b/recipes/glib/uwp/0001-gio-Disable-generic-DNS-record-lookup-on-UWP.patch
@@ -0,0 +1,57 @@
+From e89bf7275eedeaebf90989bb80abdfe84b89a539 Mon Sep 17 00:00:00 2001
+From: Nirbheek Chauhan <nirbheek@centricular.com>
+Date: Tue, 4 Aug 2020 01:25:42 +0530
+Subject: [PATCH] gio: Disable generic DNS record lookup on UWP
+
+`DnsQuery()` is not available when building for UWP, so return an
+error if DNS record lookup is requested. Lookup by name and by address
+still works.
+---
+ gio/gthreadedresolver.c | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/gio/gthreadedresolver.c b/gio/gthreadedresolver.c
+index 7691b91..a42d381 100644
+--- a/gio/gthreadedresolver.c
++++ b/gio/gthreadedresolver.c
+@@ -755,7 +755,7 @@ g_resolver_records_from_res_query (const gchar *rrname,
+ return records;
+ }
+
+-#elif defined(G_OS_WIN32)
++#elif defined(G_OS_WIN32) && !defined(G_WINAPI_ONLY_APP)
+
+ static GVariant *
+ parse_dns_srv (DNS_RECORD *rec)
+@@ -939,7 +939,7 @@ do_lookup_records (GTask *task,
+ GCancellable *cancellable)
+ {
+ LookupRecordsData *lrd = task_data;
+- GList *records;
++ GList *records = NULL;
+ GError *error = NULL;
+
+ #if defined(G_OS_UNIX)
+@@ -1007,7 +1007,7 @@ do_lookup_records (GTask *task,
+
+ #endif /* HAVE_RES_NQUERY */
+
+-#else
++#elif !defined(G_WINAPI_ONLY_APP)
+
+ DNS_STATUS status;
+ DNS_RECORD *results = NULL;
+@@ -1018,7 +1018,9 @@ do_lookup_records (GTask *task,
+ records = g_resolver_records_from_DnsQuery (lrd->rrname, dnstype, status, results, &error);
+ if (results != NULL)
+ DnsRecordListFree (results, DnsFreeRecordList);
+-
++#else
++ g_set_error_literal (&error, G_RESOLVER_ERROR, G_RESOLVER_ERROR_INTERNAL,
++ "DNS record lookup is not implemented for UWP");
+ #endif
+
+ if (records)
+--
+2.27.0.windows.1
+
diff --git a/recipes/glib/uwp/0018-gio-Disable-win32-API-and-modules-when-unavailable-o.patch b/recipes/glib/uwp/0018-gio-Disable-win32-API-and-modules-when-unavailable-o.patch
index 5097e0f6..75e6094f 100644
--- a/recipes/glib/uwp/0018-gio-Disable-win32-API-and-modules-when-unavailable-o.patch
+++ b/recipes/glib/uwp/0018-gio-Disable-win32-API-and-modules-when-unavailable-o.patch
@@ -1,4 +1,4 @@
-From 948ef6bb40150ab8776fa59c5d15fe9c85701fd7 Mon Sep 17 00:00:00 2001
+From 5b4acfb2b0038c000df54359b3ef733fd8e7da57 Mon Sep 17 00:00:00 2001
From: Nirbheek Chauhan <nirbheek@centricular.com>
Date: Fri, 16 Aug 2019 13:56:39 +0530
Subject: [PATCH 18/22] gio: Disable win32 API and modules when unavailable on
@@ -21,14 +21,12 @@ of runtime.
TODO: the following need to be ported to new WinRT APIs:
* gwin32networkmonitor (giomodule)
-* gthreadedresolver (API)
* gwin32appinfo.c (currently stubbed out)
---
gio/gappinfo.h | 5 +++++
gio/giomodule.c | 32 +++++++++++++++++---------------
- gio/gresolver.c | 7 +++++--
- gio/meson.build | 34 ++++++++++++++++++++--------------
- 4 files changed, 47 insertions(+), 31 deletions(-)
+ gio/meson.build | 31 +++++++++++++++++--------------
+ 3 files changed, 39 insertions(+), 29 deletions(-)
diff --git a/gio/gappinfo.h b/gio/gappinfo.h
index d26d048..b02a310 100644
@@ -144,38 +142,8 @@ index aacfa71..e8f4bf5 100644
#endif
}
-diff --git a/gio/gresolver.c b/gio/gresolver.c
-index 732d217..9c2dcec 100644
---- a/gio/gresolver.c
-+++ b/gio/gresolver.c
-@@ -198,20 +198,23 @@ static GResolver *default_resolver;
- * with it. #GResolver may use its reference count as a hint about how
- * many threads it should allocate for concurrent DNS resolutions.
- *
-- * Returns: (transfer full): the default #GResolver.
-+ * Returns: (allow-none) (transfer full): the default #GResolver.
- *
- * Since: 2.22
- */
- GResolver *
- g_resolver_get_default (void)
- {
-- GResolver *ret;
-+ GResolver *ret = NULL;
-
-+ /* FIXME: Implement the default threaded resolver for WinRT */
-+#ifndef G_WINAPI_ONLY_APP
- G_LOCK (default_resolver);
- if (!default_resolver)
- default_resolver = g_object_new (G_TYPE_THREADED_RESOLVER, NULL);
- ret = g_object_ref (default_resolver);
- G_UNLOCK (default_resolver);
-+#endif
-
- return ret;
- }
diff --git a/gio/meson.build b/gio/meson.build
-index a7dd536..0463dfd 100644
+index a7dd536..13ec7ff 100644
--- a/gio/meson.build
+++ b/gio/meson.build
@@ -281,7 +281,7 @@ settings_sources = files(
@@ -225,7 +193,15 @@ index a7dd536..0463dfd 100644
gio_win_rc = configure_file(
input: 'gio.rc.in',
output: 'gio.rc',
-@@ -568,8 +572,6 @@ gio_sources = files(
+@@ -549,6 +553,7 @@ gio_sources = files(
+ 'gsimpleiostream.c',
+ 'gsimplepermission.c',
+ 'gsimpleproxyresolver.c',
++ 'gthreadedresolver.c',
+ 'gsocket.c',
+ 'gsocketaddress.c',
+ 'gsocketaddressenumerator.c',
+@@ -568,8 +573,6 @@ gio_sources = files(
'gtcpwrapperconnection.c',
'gthemedicon.c',
'gthreadedsocketservice.c',
@@ -234,18 +210,7 @@ index a7dd536..0463dfd 100644
'gtlsbackend.c',
'gtlscertificate.c',
'gtlsclientconnection.c',
-@@ -592,6 +594,10 @@ gio_sources = files(
- 'gliststore.c',
- )
-
-+if not glib_conf.has('G_WINAPI_ONLY_APP')
-+ gio_sources += files('gthreadedresolver.c')
-+endif
-+
- gio_sources += appinfo_sources
- gio_sources += contenttype_sources
- gio_sources += gdbus_daemon_sources
-@@ -766,7 +772,7 @@ if have_func_kqueue and have_func_kevent
+@@ -766,7 +769,7 @@ if have_func_kqueue and have_func_kevent
internal_objects += [kqueue_lib.extract_all_objects()]
endif