Sync from SUSE:SLFO:Main libsoup2 revision b7e03545979d2003799f63066cdf8212

This commit is contained in:
Adrian Schröter 2024-07-22 17:39:29 +02:00
parent 103196f3f0
commit f870a251ca
5 changed files with 423 additions and 5 deletions

165
48b3b611.patch Normal file
View File

@ -0,0 +1,165 @@
From 48b3b61154389b377f6cd20ea72e57b62c9256e8 Mon Sep 17 00:00:00 2001
From: Philip Withnall <pwithnall@endlessos.org>
Date: Thu, 13 Apr 2023 12:32:04 +0100
Subject: [PATCH] lib: Add names to various GSources
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This helps in identifying whats attached to a `GMainContext` when
debugging runtime problems with libsoup.
The names added in `soup-misc.c` are fairly rough; if they turn out to
not be specific enough, those methods could be changed to accept a
`const gchar *name` argument so the caller can provide a more specific
name.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
---
libsoup/soup-message-io.c | 4 ++++
libsoup/soup-misc.c | 20 ++++++++++++++++++++
libsoup/soup-socket.c | 7 +++++++
libsoup/soup-websocket-connection.c | 20 ++++++++++++++++++++
4 files changed, 51 insertions(+)
diff --git a/libsoup/soup-message-io.c b/libsoup/soup-message-io.c
index c5412abb2..8d69f18d6 100644
--- a/libsoup/soup-message-io.c
+++ b/libsoup/soup-message-io.c
@@ -927,7 +927,11 @@ soup_message_io_get_source (SoupMessage *msg, GCancellable *cancellable,
source = g_source_new (&message_source_funcs,
sizeof (SoupMessageSource));
+#if GLIB_CHECK_VERSION(2, 70, 0)
+ g_source_set_static_name (source, "SoupMessageSource");
+#else
g_source_set_name (source, "SoupMessageSource");
+#endif
message_source = (SoupMessageSource *)source;
message_source->msg = g_object_ref (msg);
message_source->paused = io && io->paused;
diff --git a/libsoup/soup-misc.c b/libsoup/soup-misc.c
index 2cf6b0f6a..170fa15a2 100644
--- a/libsoup/soup-misc.c
+++ b/libsoup/soup-misc.c
@@ -83,6 +83,11 @@ soup_add_io_watch (GMainContext *async_context,
GIOFunc function, gpointer data)
{
GSource *watch = g_io_create_watch (chan, condition);
+#if GLIB_CHECK_VERSION(2, 70, 0)
+ g_source_set_static_name (watch, "SoupIOWatch");
+#else
+ g_source_set_name (watch, "SoupIOWatch");
+#endif
g_source_set_callback (watch, (GSourceFunc) function, data, NULL);
g_source_attach (watch, async_context);
g_source_unref (watch);
@@ -111,6 +116,11 @@ soup_add_idle (GMainContext *async_context,
GSourceFunc function, gpointer data)
{
GSource *source = g_idle_source_new ();
+#if GLIB_CHECK_VERSION(2, 70, 0)
+ g_source_set_static_name (source, "SoupIdle");
+#else
+ g_source_set_name (source, "SoupIdle");
+#endif
g_source_set_callback (source, function, data, NULL);
g_source_attach (source, async_context);
g_source_unref (source);
@@ -125,6 +135,11 @@ soup_add_completion_reffed (GMainContext *async_context,
{
GSource *source = g_idle_source_new ();
+#if GLIB_CHECK_VERSION(2, 70, 0)
+ g_source_set_static_name (source, "SoupCompletion");
+#else
+ g_source_set_name (source, "SoupCompletion");
+#endif
g_source_set_priority (source, G_PRIORITY_DEFAULT);
g_source_set_callback (source, function, data, dnotify);
g_source_attach (source, async_context);
@@ -178,6 +193,11 @@ soup_add_timeout (GMainContext *async_context,
GSourceFunc function, gpointer data)
{
GSource *source = g_timeout_source_new (interval);
+#if GLIB_CHECK_VERSION(2, 70, 0)
+ g_source_set_static_name (source, "SoupTimeout");
+#else
+ g_source_set_name (source, "SoupTimeout");
+#endif
g_source_set_callback (source, function, data, NULL);
g_source_attach (source, async_context);
g_source_unref (source);
diff --git a/libsoup/soup-socket.c b/libsoup/soup-socket.c
index 0ec451032..53b5c584b 100644
--- a/libsoup/soup-socket.c
+++ b/libsoup/soup-socket.c
@@ -1203,6 +1203,13 @@ soup_socket_create_watch (SoupSocketPrivate *priv, GIOCondition cond,
watch = g_pollable_input_stream_create_source (G_POLLABLE_INPUT_STREAM (priv->istream), cancellable);
else
watch = g_pollable_output_stream_create_source (G_POLLABLE_OUTPUT_STREAM (priv->ostream), cancellable);
+
+#if GLIB_CHECK_VERSION(2, 70, 0)
+ g_source_set_static_name (watch, "SoupSocket watch");
+#else
+ g_source_set_name (watch, "SoupSocket watch");
+#endif
+
g_source_set_callback (watch, (GSourceFunc)callback, user_data, NULL);
g_source_attach (watch, priv->async_context);
diff --git a/libsoup/soup-websocket-connection.c b/libsoup/soup-websocket-connection.c
index a4095e1c9..6d136d411 100644
--- a/libsoup/soup-websocket-connection.c
+++ b/libsoup/soup-websocket-connection.c
@@ -306,6 +306,11 @@ soup_websocket_connection_start_input_source (SoupWebsocketConnection *self)
return;
pv->input_source = g_pollable_input_stream_create_source (pv->input, NULL);
+#if GLIB_CHECK_VERSION(2, 70, 0)
+ g_source_set_static_name (pv->input_source, "SoupWebsocketConnection input");
+#else
+ g_source_set_name (pv->input_source, "SoupWebsocketConnection input");
+#endif
g_source_set_callback (pv->input_source, (GSourceFunc)on_web_socket_input, self, NULL);
g_source_attach (pv->input_source, pv->main_context);
}
@@ -332,6 +337,11 @@ soup_websocket_connection_start_output_source (SoupWebsocketConnection *self)
return;
pv->output_source = g_pollable_output_stream_create_source (pv->output, NULL);
+#if GLIB_CHECK_VERSION(2, 70, 0)
+ g_source_set_static_name (pv->output_source, "SoupWebsocketConnection output");
+#else
+ g_source_set_name (pv->output_source, "SoupWebsocketConnection output");
+#endif
g_source_set_callback (pv->output_source, (GSourceFunc)on_web_socket_output, self, NULL);
g_source_attach (pv->output_source, pv->main_context);
}
@@ -444,6 +454,11 @@ close_io_after_timeout (SoupWebsocketConnection *self)
g_debug ("waiting %d seconds for peer to close io", timeout);
pv->close_timeout = g_timeout_source_new_seconds (timeout);
+#if GLIB_CHECK_VERSION(2, 70, 0)
+ g_source_set_static_name (pv->close_timeout, "SoupWebsocketConnection close timeout");
+#else
+ g_source_set_name (pv->close_timeout, "SoupWebsocketConnection close timeout");
+#endif
g_source_set_callback (pv->close_timeout, on_timeout_close_io, self, NULL);
g_source_attach (pv->close_timeout, pv->main_context);
}
@@ -2207,6 +2222,11 @@ soup_websocket_connection_set_keepalive_interval (SoupWebsocketConnection *self,
if (interval > 0) {
pv->keepalive_timeout = g_timeout_source_new_seconds (interval);
+#if GLIB_CHECK_VERSION(2, 70, 0)
+ g_source_set_static_name (pv->keepalive_timeout, "SoupWebsocketConnection keepalive timeout");
+#else
+ g_source_set_name (pv->keepalive_timeout, "SoupWebsocketConnection keepalive timeout");
+#endif
g_source_set_callback (pv->keepalive_timeout, on_queue_ping, self, NULL);
g_source_attach (pv->keepalive_timeout, pv->main_context);
}
--
GitLab

191
4d12c3e5.patch Normal file
View File

@ -0,0 +1,191 @@
From 4d12c3e5769952ad0bfa318f4569d90a9d9a5085 Mon Sep 17 00:00:00 2001
From: Philip Withnall <pwithnall@endlessos.org>
Date: Thu, 13 Apr 2023 12:25:37 +0100
Subject: [PATCH] lib: Add g_task_set_source_tag() everywhere
This makes it easier to identify what a `GTask` instance is when
debugging a running process.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
---
libsoup/soup-address.c | 2 ++
libsoup/soup-client-input-stream.c | 1 +
libsoup/soup-connection.c | 2 ++
libsoup/soup-io-stream.c | 1 +
libsoup/soup-multipart-input-stream.c | 1 +
libsoup/soup-proxy-resolver-wrapper.c | 1 +
libsoup/soup-request-file.c | 1 +
libsoup/soup-request-http.c | 1 +
libsoup/soup-request.c | 1 +
libsoup/soup-session.c | 3 +++
libsoup/soup-socket.c | 2 ++
11 files changed, 16 insertions(+)
diff --git a/libsoup/soup-address.c b/libsoup/soup-address.c
index 574e982f2..bcd3e9e7f 100644
--- a/libsoup/soup-address.c
+++ b/libsoup/soup-address.c
@@ -1209,6 +1209,8 @@ soup_address_address_enumerator_next_async (GSocketAddressEnumerator *enumerato
GTask *task;
task = g_task_new (enumerator, cancellable, callback, user_data);
+ g_task_set_source_tag (task, soup_address_address_enumerator_next_async);
+
if (!priv->sockaddr) {
soup_address_resolve_async (addr_enum->addr,
g_main_context_get_thread_default (),
diff --git a/libsoup/soup-client-input-stream.c b/libsoup/soup-client-input-stream.c
index e73ec9e63..c5484501e 100644
--- a/libsoup/soup-client-input-stream.c
+++ b/libsoup/soup-client-input-stream.c
@@ -189,6 +189,7 @@ soup_client_input_stream_close_async (GInputStream *stream,
GSource *source;
task = g_task_new (stream, cancellable, callback, user_data);
+ g_task_set_source_tag (task, soup_client_input_stream_close_async);
g_task_set_priority (task, priority);
if (close_async_ready (cistream->priv->msg, task) == G_SOURCE_CONTINUE) {
diff --git a/libsoup/soup-connection.c b/libsoup/soup-connection.c
index 1b9a4fee8..8d4fee8d1 100644
--- a/libsoup/soup-connection.c
+++ b/libsoup/soup-connection.c
@@ -418,6 +418,7 @@ soup_connection_connect_async (SoupConnection *conn,
soup_socket_properties_push_async_context (priv->socket_props);
task = g_task_new (conn, cancellable, callback, user_data);
+ g_task_set_source_tag (task, soup_connection_connect_async);
soup_socket_connect_async_internal (priv->socket, cancellable,
socket_connect_complete, task);
@@ -546,6 +547,7 @@ soup_connection_start_ssl_async (SoupConnection *conn,
soup_socket_properties_push_async_context (priv->socket_props);
task = g_task_new (conn, cancellable, callback, user_data);
+ g_task_set_source_tag (task, soup_connection_start_ssl_async);
soup_socket_handshake_async (priv->socket, priv->remote_uri->host,
cancellable, start_ssl_completed, task);
diff --git a/libsoup/soup-io-stream.c b/libsoup/soup-io-stream.c
index 8daca38d6..3da1d614b 100644
--- a/libsoup/soup-io-stream.c
+++ b/libsoup/soup-io-stream.c
@@ -160,6 +160,7 @@ soup_io_stream_close_async (GIOStream *stream,
GTask *task;
task = g_task_new (stream, cancellable, callback, user_data);
+ g_task_set_source_tag (task, soup_io_stream_close_async);
g_io_stream_close_async (SOUP_IO_STREAM (stream)->priv->base_iostream,
io_priority, cancellable,
close_async_complete, task);
diff --git a/libsoup/soup-multipart-input-stream.c b/libsoup/soup-multipart-input-stream.c
index 535dd6ec4..209eb9a32 100644
--- a/libsoup/soup-multipart-input-stream.c
+++ b/libsoup/soup-multipart-input-stream.c
@@ -528,6 +528,7 @@ soup_multipart_input_stream_next_part_async (SoupMultipartInputStream *multipart
g_return_if_fail (SOUP_IS_MULTIPART_INPUT_STREAM (multipart));
task = g_task_new (multipart, cancellable, callback, data);
+ g_task_set_source_tag (task, soup_multipart_input_stream_next_part_async);
g_task_set_priority (task, io_priority);
if (!g_input_stream_set_pending (stream, &error)) {
diff --git a/libsoup/soup-proxy-resolver-wrapper.c b/libsoup/soup-proxy-resolver-wrapper.c
index e07664ca9..e787ff095 100644
--- a/libsoup/soup-proxy-resolver-wrapper.c
+++ b/libsoup/soup-proxy-resolver-wrapper.c
@@ -92,6 +92,7 @@ soup_proxy_resolver_wrapper_lookup_async (GProxyResolver *resolver,
SoupURI *source_uri;
task = g_task_new (resolver, cancellable, callback, user_data);
+ g_task_set_source_tag (task, soup_proxy_resolver_wrapper_lookup_async);
source_uri = soup_uri_new (uri);
g_task_set_task_data (task, source_uri, (GDestroyNotify) soup_uri_free);
diff --git a/libsoup/soup-request-file.c b/libsoup/soup-request-file.c
index c402a5b4c..6d3e9fa3b 100644
--- a/libsoup/soup-request-file.c
+++ b/libsoup/soup-request-file.c
@@ -301,6 +301,7 @@ soup_request_file_send_async (SoupRequest *request,
GError *error = NULL;
task = g_task_new (request, cancellable, callback, user_data);
+ g_task_set_source_tag (task, soup_request_file_send_async);
if (!soup_request_file_ensure_file (file, cancellable, &error)) {
g_task_return_error (task, error);
diff --git a/libsoup/soup-request-http.c b/libsoup/soup-request-http.c
index 285f59d7a..a608d3a2d 100644
--- a/libsoup/soup-request-http.c
+++ b/libsoup/soup-request-http.c
@@ -140,6 +140,7 @@ soup_request_http_send_async (SoupRequest *request,
g_return_if_fail (!SOUP_IS_SESSION_SYNC (session));
task = g_task_new (request, cancellable, callback, user_data);
+ g_task_set_source_tag (task, soup_request_http_send_async);
soup_session_send_async (session, http->priv->msg, cancellable,
http_input_stream_ready_cb, task);
}
diff --git a/libsoup/soup-request.c b/libsoup/soup-request.c
index 61980c78a..6c11c32c4 100644
--- a/libsoup/soup-request.c
+++ b/libsoup/soup-request.c
@@ -177,6 +177,7 @@ soup_request_default_send_async (SoupRequest *request,
GError *error = NULL;
task = g_task_new (request, cancellable, callback, user_data);
+ g_task_set_source_tag (task, soup_request_default_send_async);
stream = soup_request_send (request, cancellable, &error);
if (stream)
diff --git a/libsoup/soup-session.c b/libsoup/soup-session.c
index 83421ef9d..c74b1b886 100644
--- a/libsoup/soup-session.c
+++ b/libsoup/soup-session.c
@@ -4355,6 +4355,7 @@ soup_session_send_async (SoupSession *session,
item->new_api = TRUE;
item->task = g_task_new (session, item->cancellable, callback, user_data);
+ g_task_set_source_tag (item->task, soup_session_send_async);
g_task_set_task_data (item->task, item, (GDestroyNotify) soup_message_queue_item_unref);
/* Do not check for cancellations as we do not want to
@@ -4961,6 +4962,7 @@ soup_session_websocket_connect_async (SoupSession *session,
soup_message_set_flags (msg, flags | SOUP_MESSAGE_NEW_CONNECTION);
task = g_task_new (session, cancellable, callback, user_data);
+ g_task_set_source_tag (task, soup_session_websocket_connect_async);
item = soup_session_append_queue_item (session, msg, TRUE, FALSE,
websocket_connect_async_complete, task);
g_task_set_task_data (task, item, (GDestroyNotify) soup_message_queue_item_unref);
@@ -5108,6 +5110,7 @@ soup_session_connect_async (SoupSession *session,
g_return_if_fail (uri != NULL);
task = g_task_new (session, cancellable, callback, user_data);
+ g_task_set_source_tag (task, soup_session_connect_async);
msg = soup_message_new_from_uri (SOUP_METHOD_HEAD, uri);
soup_message_set_flags (msg, SOUP_MESSAGE_NEW_CONNECTION);
diff --git a/libsoup/soup-socket.c b/libsoup/soup-socket.c
index 7ad484308..0ec451032 100644
--- a/libsoup/soup-socket.c
+++ b/libsoup/soup-socket.c
@@ -970,6 +970,7 @@ soup_socket_connect_async_internal (SoupSocket *sock,
priv->connect_cancel = cancellable ? g_object_ref (cancellable) : g_cancellable_new ();
task = g_task_new (sock, priv->connect_cancel, callback, user_data);
+ g_task_set_source_tag (task, soup_socket_connect_async_internal);
client = new_socket_client (sock);
g_socket_client_connect_async (client,
@@ -1536,6 +1537,7 @@ soup_socket_handshake_async (SoupSocket *sock,
GError *error = NULL;
task = g_task_new (sock, cancellable, callback, user_data);
+ g_task_set_source_tag (task, soup_socket_handshake_async);
if (!soup_socket_setup_ssl (sock, ssl_host, cancellable, &error)) {
g_task_return_error (task, error);
--
GitLab

43
ced3c5d8.patch Normal file
View File

@ -0,0 +1,43 @@
From ced3c5d8cad0177b297666343f1561799dfefb0d Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 22 Nov 2023 18:49:10 -0800
Subject: [PATCH] Fix build with libxml2-2.12.0 and clang-17
Fixes build errors about missing function prototypes with clang-17
Fixes
| ../libsoup-2.74.3/libsoup/soup-xmlrpc-old.c:512:8: error: call to undeclared function 'xmlParseMemory'; ISO C99 and later do not support implicit function declarations
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
libsoup/soup-xmlrpc-old.c | 1 +
libsoup/soup-xmlrpc.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/libsoup/soup-xmlrpc-old.c b/libsoup/soup-xmlrpc-old.c
index c57086b6a..527e3b235 100644
--- a/libsoup/soup-xmlrpc-old.c
+++ b/libsoup/soup-xmlrpc-old.c
@@ -11,6 +11,7 @@
#include <string.h>
+#include <libxml/parser.h>
#include <libxml/tree.h>
#include "soup-xmlrpc-old.h"
diff --git a/libsoup/soup-xmlrpc.c b/libsoup/soup-xmlrpc.c
index 42dcda9c7..e991cbf01 100644
--- a/libsoup/soup-xmlrpc.c
+++ b/libsoup/soup-xmlrpc.c
@@ -17,6 +17,7 @@
#include <string.h>
#include <errno.h>
+#include <libxml/parser.h>
#include <libxml/tree.h>
#include "soup-xmlrpc.h"
#include "soup.h"
--
GitLab

View File

@ -1,3 +1,18 @@
-------------------------------------------------------------------
Thu Dec 14 12:42:08 UTC 2023 - Dominique Leuenberger <dimstar@opensuse.org>
- Add ced3c5d8.patch: Fix build with libxml2-2.12.0 and clang-17.
-------------------------------------------------------------------
Mon Jul 31 11:46:03 UTC 2023 - Bjørn Lie <bjorn.lie@gmail.com>
- Add upstream bug fixes:
+ 4d12c3e5.patch: lib: Add g_task_set_source_tag() everywhere
+ 48b3b611.patch: lib: Add names to various GSources
- Drop no longer valid translation-update-upstream BuildRequires
and macro.
- Use ldconfig_scriptlets macro for post(un) handling.
-------------------------------------------------------------------
Wed Oct 12 09:32:22 UTC 2022 - Bjørn Lie <bjorn.lie@gmail.com>

View File

@ -1,7 +1,7 @@
#
# spec file for package libsoup2
#
# Copyright (c) 2022 SUSE LLC
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -30,10 +30,16 @@ Source99: baselibs.conf
Patch1: libsoup-skip-tls_interaction-test.patch
# PATCH-FIX-UPSTREAM libsoup2-extend-test-cert.patch boo#1102840 -- Fix tests after 2027
Patch2: libsoup2-extend-test-cert.patch
# PATCH-FIX-UPSTREAM 4d12c3e5.patch -- lib: Add g_task_set_source_tag() everywhere
Patch3: https://gitlab.gnome.org/GNOME/libsoup/-/commit/4d12c3e5.patch
# PATCH-FIX-UPSTREAM 48b3b611.patch -- lib: Add names to various GSources
Patch4: https://gitlab.gnome.org/GNOME/libsoup/-/commit/48b3b611.patch
# PATCH-FIX-UPSTREAM ced3c5d8.patch -- Fix build with libxml2-2.12.0 and clang-17
Patch5: https://gitlab.gnome.org/GNOME/libsoup/-/commit/ced3c5d8.patch
BuildRequires: glib-networking
BuildRequires: meson >= 0.50
BuildRequires: pkgconfig
BuildRequires: translation-update-upstream
BuildRequires: pkgconfig(gio-2.0) >= 2.58.0
BuildRequires: pkgconfig(glib-2.0) >= 2.58.0
BuildRequires: pkgconfig(gobject-2.0) >= 2.58.0
@ -118,7 +124,6 @@ Features:
%prep
%autosetup -p1 -n %{_name}-%{version}
translation-update-upstream po libsoup
%build
%meson \
@ -140,8 +145,7 @@ export G_TLS_GNUTLS_PRIORITY=NORMAL
%meson_install
%find_lang %{_name} %{?no_lang_C}
%post -n %{_name}-2_4-1 -p /sbin/ldconfig
%postun -n %{_name}-2_4-1 -p /sbin/ldconfig
%ldconfig_scriptlets -n %{_name}-2_4-1
%files -n %{_name}-2_4-1
%license COPYING