From nobody Tue Sep 9 19:00:38 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 173799797523965.55002968668828; Mon, 27 Jan 2025 09:12:55 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id B2BF0175A; Mon, 27 Jan 2025 12:12:54 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 3B294177F; Mon, 27 Jan 2025 12:12:23 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 2567F1729; Mon, 27 Jan 2025 12:12:19 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 65F2A1717 for ; Mon, 27 Jan 2025 12:12:18 -0500 (EST) Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-295-HTR0WGjAOrisQwByf4wfYw-1; Mon, 27 Jan 2025 12:12:15 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 959811801F19 for ; Mon, 27 Jan 2025 17:12:13 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.2]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B408318008D4 for ; Mon, 27 Jan 2025 17:12:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1737997938; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Q019kzw8vPbLC+ImA5msvTuTbzUX5hXq7oktw0y87mM=; b=b2hCqm/wlsEm7sLU9u84QsEDmE2YerwHb1G1zymW8X7idsRxBXl8V0NpxIdY7HIZfD1ef1 OP2np+UQoTa9ad6seNWOKVsvbyrezlJvV7Ev6hc6yJMaaUagCNtY+3EqiTbXeMaQvI3tQH KTbJxAv28o9DYW3GVA7RXJnO8N9MhXE= X-MC-Unique: HTR0WGjAOrisQwByf4wfYw-1 X-Mimecast-MFC-AGG-ID: HTR0WGjAOrisQwByf4wfYw From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH] build: Bump minimul glib2 version to 2.66.0 Date: Mon, 27 Jan 2025 18:12:10 +0100 Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: BGBYmXdnxirnADb0bvy6n9mcB_9kdZj5sAxT1IAN5FA_1737997933 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 4ITNRGUCUEFWNMDNXM2C45VYSFV53Y2R X-Message-ID-Hash: 4ITNRGUCUEFWNMDNXM2C45VYSFV53Y2R X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1737997976524019000 Content-Type: text/plain; charset="utf-8" Per our supported platforms the minimum available versions are: CentOS Stream 9: 2.68.4 Debian 11: 2.66.8 Fedora 39: 2.78.6 openSUSE Leap 15.6: 2.78.6 Ubuntu 24.04: 2.72.4 FreeBSD: 2.80.5 Bump to 2.66 which is limited by Debian 11. While ideally we'd bump to 2.68 which would give us 'g_strv_builder' and friends 2.66 is enough for g_ptr_array_steal() which can be used to emulate the former with almost no extra code. Signed-off-by: Peter Krempa Reviewed-by: Pavel Hrdina --- libvirt.spec.in | 2 +- meson.build | 2 +- src/libvirt_private.syms | 4 -- src/qemu/qemu_agent.c | 2 +- src/qemu/qemu_monitor.c | 2 +- src/util/glibcompat.c | 94 ---------------------------------------- src/util/glibcompat.h | 18 -------- src/util/vireventglib.c | 12 ++--- 8 files changed, 10 insertions(+), 126 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index f397b95b79..c5585a72c0 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -357,7 +357,7 @@ BuildRequires: gcc %if %{with_libxl} BuildRequires: xen-devel %endif -BuildRequires: glib2-devel >=3D 2.58 +BuildRequires: glib2-devel >=3D 2.66 BuildRequires: libxml2-devel BuildRequires: readline-devel BuildRequires: pkgconfig(bash-completion) >=3D 2.0 diff --git a/meson.build b/meson.build index 1b0b717901..52fef8c0fb 100644 --- a/meson.build +++ b/meson.build @@ -1004,7 +1004,7 @@ else endif endif -glib_version =3D '2.58.0' +glib_version =3D '2.66.0' glib_dep =3D dependency('glib-2.0', version: '>=3D' + glib_version) gobject_dep =3D dependency('gobject-2.0', version: '>=3D' + glib_version) if host_machine.system() =3D=3D 'windows' diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index ee90fb2b84..2fe0a07944 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1879,10 +1879,6 @@ virStorageSourceUpdatePhysicalSize; # util/glibcompat.h -vir_g_fsync; -vir_g_source_unref; -vir_g_strdup_printf; -vir_g_strdup_vprintf; vir_g_string_replace; diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c index 22359f8518..43fca86f10 100644 --- a/src/qemu/qemu_agent.c +++ b/src/qemu/qemu_agent.c @@ -448,7 +448,7 @@ qemuAgentUnregister(qemuAgent *agent) { if (agent->watch) { g_source_destroy(agent->watch); - vir_g_source_unref(agent->watch, agent->context); + g_source_unref(agent->watch); agent->watch =3D NULL; } } diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index ec2f166785..e0b1bf1d37 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -745,7 +745,7 @@ qemuMonitorUnregister(qemuMonitor *mon) { if (mon->watch) { g_source_destroy(mon->watch); - vir_g_source_unref(mon->watch, mon->context); + g_source_unref(mon->watch); mon->watch =3D NULL; } } diff --git a/src/util/glibcompat.c b/src/util/glibcompat.c index 98dcfab389..bcb666992a 100644 --- a/src/util/glibcompat.c +++ b/src/util/glibcompat.c @@ -63,100 +63,6 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#undef g_fsync -#undef g_strdup_printf -#undef g_strdup_vprintf - - -/* Drop when min glib >=3D 2.63.0 */ -gint -vir_g_fsync(gint fd) -{ -#ifdef G_OS_WIN32 - return _commit(fd); -#else - return fsync(fd); -#endif -} - - -/* Due to a bug in glib, g_strdup_printf() nor g_strdup_vprintf() - * abort on OOM. It's fixed in glib's upstream. Provide our own - * implementation until the fix gets distributed. */ -char * -vir_g_strdup_printf(const char *msg, ...) -{ - va_list args; - char *ret; - va_start(args, msg); - ret =3D g_strdup_vprintf(msg, args); - if (!ret) - abort(); - va_end(args); - return ret; -} - - -char * -vir_g_strdup_vprintf(const char *msg, va_list args) -{ - char *ret; - ret =3D g_strdup_vprintf(msg, args); - if (!ret) - abort(); - return ret; -} - - -/* - * If the last reference to a GSource is released in a non-main - * thread we're exposed to a race condition that causes a - * crash: - * - * https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1358 - * - * Thus we're using an idle func to release our ref... - * - * ...but this imposes a significant performance penalty on - * I/O intensive workloads which are sensitive to the iterations - * of the event loop, so avoid the workaround if we know we have - * new enough glib. - * - * The function below is used from a header file definition. - * - * Drop when min glib >=3D 2.64.0 - */ -#if GLIB_CHECK_VERSION(2, 64, 0) -void vir_g_source_unref(GSource *src, GMainContext *ctx G_GNUC_UNUSED) -{ - g_source_unref(src); -} -#else - -static gboolean -virEventGLibSourceUnrefIdle(gpointer data) -{ - GSource *src =3D data; - - g_source_unref(src); - - return FALSE; -} - -void vir_g_source_unref(GSource *src, GMainContext *ctx) -{ - GSource *idle =3D g_idle_source_new(); - - g_source_set_callback(idle, virEventGLibSourceUnrefIdle, src, NULL); - - g_source_attach(idle, ctx); - - g_source_unref(idle); -} - -#endif - - /** * Adapted (to pass syntax check) from 'g_string_replace' from * glib-2.81.1. Drop once minimum glib is bumped to 2.68. diff --git a/src/util/glibcompat.h b/src/util/glibcompat.h index 474ff95bc5..a3d01089e6 100644 --- a/src/util/glibcompat.h +++ b/src/util/glibcompat.h @@ -42,24 +42,6 @@ #endif /* GLib < 2.67.0 */ - -gint vir_g_fsync(gint fd); -char *vir_g_strdup_printf(const char *msg, ...) - G_GNUC_PRINTF(1, 2); -char *vir_g_strdup_vprintf(const char *msg, va_list args) - G_GNUC_PRINTF(1, 0); - -#if !GLIB_CHECK_VERSION(2, 64, 0) -# define g_strdup_printf vir_g_strdup_printf -# define g_strdup_vprintf vir_g_strdup_vprintf -#endif - -#undef g_fsync -#define g_fsync vir_g_fsync - -void vir_g_source_unref(GSource *src, GMainContext *ctx); - - /* Drop once we require glib-2.68 at minimum */ guint vir_g_string_replace(GString *string, diff --git a/src/util/vireventglib.c b/src/util/vireventglib.c index 023dc37445..6c54f62123 100644 --- a/src/util/vireventglib.c +++ b/src/util/vireventglib.c @@ -213,7 +213,7 @@ virEventGLibHandleUpdate(int watch, if (data->source !=3D NULL) { VIR_DEBUG("Removed old handle source=3D%p", data->source); g_source_destroy(data->source); - vir_g_source_unref(data->source, NULL); + g_source_unref(data->source); } data->source =3D virEventGLibAddSocketWatch( @@ -227,7 +227,7 @@ virEventGLibHandleUpdate(int watch, VIR_DEBUG("Removed old handle source=3D%p", data->source); g_source_destroy(data->source); - vir_g_source_unref(data->source, NULL); + g_source_unref(data->source); data->source =3D NULL; data->events =3D 0; } @@ -276,7 +276,7 @@ virEventGLibHandleRemove(int watch) if (data->source !=3D NULL) { g_source_destroy(data->source); - vir_g_source_unref(data->source, NULL); + g_source_unref(data->source); data->source =3D NULL; data->events =3D 0; } @@ -409,7 +409,7 @@ virEventGLibTimeoutUpdate(int timer, if (interval >=3D 0) { if (data->source !=3D NULL) { g_source_destroy(data->source); - vir_g_source_unref(data->source, NULL); + g_source_unref(data->source); } data->interval =3D interval; @@ -419,7 +419,7 @@ virEventGLibTimeoutUpdate(int timer, goto cleanup; g_source_destroy(data->source); - vir_g_source_unref(data->source, NULL); + g_source_unref(data->source); data->source =3D NULL; } @@ -468,7 +468,7 @@ virEventGLibTimeoutRemove(int timer) if (data->source !=3D NULL) { g_source_destroy(data->source); - vir_g_source_unref(data->source, NULL); + g_source_unref(data->source); data->source =3D NULL; } --=20 2.48.1