public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
To: git-commits@fedoraproject.org
Subject: [rpms/perl-Glib-Object-Introspection] f45: Fix a test crash with glib >= 2.89.0
Date: Mon, 07 Sep 2026 14:28:51 GMT	[thread overview]
Message-ID: <178879133157.1.11865496027648476987.rpms-perl-Glib-Object-Introspection-1f3031c29069@fedoraproject.org> (raw)

A new commit has been pushed.

Repo   : rpms/perl-Glib-Object-Introspection
Branch : f45
Commit : 1f3031c29069f930f46bbe77250ac1f539e8b6c8
Author : Petr Písař <ppisar@redhat.com>
Date   : 2026-09-07T16:26:23+02:00
Stats  : +100/-85 in 3 file(s)
URL    : https://src.fedoraproject.org/rpms/perl-Glib-Object-Introspection/c/1f3031c29069f930f46bbe77250ac1f539e8b6c8?branch=f45

Log:
Fix a test crash with glib >= 2.89.0

---
diff --git a/Glib-Object-Introspection-0.052-Handle-caller-allocated-scalar-outputs.patch b/Glib-Object-Introspection-0.052-Handle-caller-allocated-scalar-outputs.patch
new file mode 100644
index 0000000..795cbf3
--- /dev/null
+++ b/Glib-Object-Introspection-0.052-Handle-caller-allocated-scalar-outputs.patch
@@ -0,0 +1,94 @@
+From 22b1d2c8f3cdf9351f37791b27b36c139a145383 Mon Sep 17 00:00:00 2001
+From: Alessandro Astone <alessandro.astone@canonical.com>
+Date: Tue, 28 Jul 2026 16:41:41 +0200
+Subject: [PATCH] Handle caller-allocated scalar outputs
+
+Use the existing GIArgument storage for non-pointer basic scalar outputs,
+while preserving explicit allocation and ownership handling for compound
+types.
+
+Closes: https://gitlab.gnome.org/GNOME/perl-glib-object-introspection/-/work_items/8
+---
+ gperl-i11n-invoke-c.c | 38 +++++++++++++++++++++++++++++++++++---
+ 1 file changed, 35 insertions(+), 3 deletions(-)
+
+diff --git a/gperl-i11n-invoke-c.c b/gperl-i11n-invoke-c.c
+index 01d60f8..facb975 100644
+--- a/gperl-i11n-invoke-c.c
++++ b/gperl-i11n-invoke-c.c
+@@ -14,6 +14,7 @@ static void _handle_automatic_arg (guint pos,
+                                    GITypeInfo * arg_type,
+                                    GIArgument * arg,
+                                    GPerlI11nCInvocationInfo * invocation_info);
++static gboolean _is_basic_scalar (GITypeInfo *arg_type);
+ static gpointer _allocate_out_mem (GITypeInfo *arg_type);
+ 
+ static void
+@@ -114,7 +115,8 @@ invoke_c_code (GICallableInfo *info,
+ 			break;
+ 
+ 		    case GI_DIRECTION_OUT:
+-			if (g_arg_info_is_caller_allocates (arg_info)) {
++			if (g_arg_info_is_caller_allocates (arg_info) &&
++			    !_is_basic_scalar (arg_type)) {
+ 				iinfo.base.aux_args[i].v_pointer =
+ 					_allocate_out_mem (arg_type);
+ 				iinfo.out_args[i].v_pointer = &iinfo.base.aux_args[i];
+@@ -259,15 +261,19 @@ invoke_c_code (GICallableInfo *info,
+ 		    case GI_DIRECTION_OUT:
+ 		    case GI_DIRECTION_INOUT:
+ 		    {
++			GITypeInfo * arg_type;
+ 			GITransfer transfer;
+ 			SV *sv;
+ 			dwarn ("out/inout arg at pos %d\n", i);
++
++			arg_type = &(iinfo.base.arg_types[i]);
+ 			/* If we allocated the memory ourselves, we always own it. */
+-			transfer = g_arg_info_is_caller_allocates (arg_info)
++			transfer = g_arg_info_is_caller_allocates (arg_info) &&
++			           !_is_basic_scalar (arg_type)
+ 			         ? GI_TRANSFER_CONTAINER
+ 			         : g_arg_info_get_ownership_transfer (arg_info);
+ 			sv = SAVED_STACK_SV (arg_to_sv (iinfo.out_args[i].v_pointer,
+-			                                &(iinfo.base.arg_types[i]),
++			                                arg_type,
+ 			                                transfer,
+ 			                                GPERL_I11N_MEMORY_SCOPE_IRRELEVANT,
+ 			                                &iinfo.base));
+@@ -572,6 +578,32 @@ _handle_automatic_arg (guint pos,
+ 	ccroak ("Could not handle automatic arg %d", pos);
+ }
+ 
++static gboolean
++_is_basic_scalar (GITypeInfo *arg_type)
++{
++	if (g_type_info_is_pointer (arg_type))
++		return FALSE;
++
++	switch (g_type_info_get_tag (arg_type)) {
++	    case GI_TYPE_TAG_BOOLEAN:
++	    case GI_TYPE_TAG_INT8:
++	    case GI_TYPE_TAG_UINT8:
++	    case GI_TYPE_TAG_INT16:
++	    case GI_TYPE_TAG_UINT16:
++	    case GI_TYPE_TAG_INT32:
++	    case GI_TYPE_TAG_UINT32:
++	    case GI_TYPE_TAG_INT64:
++	    case GI_TYPE_TAG_UINT64:
++	    case GI_TYPE_TAG_FLOAT:
++	    case GI_TYPE_TAG_DOUBLE:
++	    case GI_TYPE_TAG_GTYPE:
++	    case GI_TYPE_TAG_UNICHAR:
++		return TRUE;
++	    default:
++		return FALSE;
++	}
++}
++
+ static gpointer
+ _allocate_out_mem (GITypeInfo *arg_type)
+ {
+-- 
+2.55.0
+

diff --git a/Glib-Object-Introspection-0.052-Skip-allocating-memory-if-an-output-argument-is-not-.patch b/Glib-Object-Introspection-0.052-Skip-allocating-memory-if-an-output-argument-is-not-.patch
deleted file mode 100644
index a38cc4f..0000000
--- a/Glib-Object-Introspection-0.052-Skip-allocating-memory-if-an-output-argument-is-not-.patch
+++ /dev/null
@@ -1,82 +0,0 @@
-From dd9df6251940addb92213e2c6c8c8bf966e7b9d2 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
-Date: Tue, 28 Jul 2026 14:29:20 +0200
-Subject: [PATCH] Skip allocating memory if an output argument is not an
- interface
-
-After upgrading glib from 2.88.1 to 2.89.0 45 t/arrays.t dies like this:
-
-    $ LD_LIBRARY_PATH=:build prove -v -b t/arrays.t
-    [...]
-    ok 87
-    ok 88
-    Bailout called.  Further testing stopped:  ERROR:gperl-i11n-invoke-c.c:584:_allocate_out_mem: assertion failed: (interface_info)
-    Bail out! ERROR:gperl-i11n-invoke-c.c:584:_allocate_out_mem: assertion failed: (interface_info)
-    **
-    ERROR:gperl-i11n-invoke-c.c:584:_allocate_out_mem: assertion failed: (interface_info)
-    Failed 4/92 subtests
-
-Minimal reproducer:
-
-    #!/usr/bin/perl
-    use Glib::Object::Introspection;
-    Glib::Object::Introspection->setup (
-      basename    => 'Gio',
-      version     => '2.0',
-      package     => 'Glib::IO');
-    Glib::IO::DBusMessage->new_signal ('/asdf/ghjk', 'de.asdf', 'ghjk')->to_blob ([]);
-
-A trigger was this glib commit:
-
-    commit aa2e66011585c029c98f6b7824a61a6aeb7dda04
-    Author: Philip Withnall <pwithnall@gnome.org>
-    Date:   Wed Mar 18 16:54:42 2026 +0000
-
-	gdbusmessage: Fix a few introspection annotations
-
-	Signed-off-by: Philip Withnall <pwithnall@gnome.org>
-    [...]
-     /**
-      * g_dbus_message_to_blob:
-      * @message: A #GDBusMessage.
-    - * @out_size: Return location for size of generated blob.
-    + * @out_size: (out caller-allocates): Return location for size of generated blob.
-      * @capabilities: A #GDBusCapabilityFlags describing what protocol features are supported.
-      * @error: Return location for error.
-      *
-
-That changed to_blob() definition in GIR for the "out_size" argument
-from caller-allocates="0" to caller-allocates="1" and that triggered
-the assert in _allocate_out_mem() because that argument is a pointer
-to primitive type rather than an GLib interface.
-
-This patch works around the assert by avoiding the branch in
-invoke_c_code() which calls _allocate_out_mem(), to use the same code
-path that was used with glib 2.88.1.
-
-Originally I tried to implement the allocation, but that only lead to
-a memory exhaustion. Probably these primitive types are supposed to be
-handled specially.
-
-https://gitlab.gnome.org/GNOME/perl-glib-object-introspection/-/work_items/8
-https://bugzilla.redhat.com/show_bug.cgi?id=2486187
----
- gperl-i11n-invoke-c.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/gperl-i11n-invoke-c.c b/gperl-i11n-invoke-c.c
-index 01d60f8..16493d7 100644
---- a/gperl-i11n-invoke-c.c
-+++ b/gperl-i11n-invoke-c.c
-@@ -114,7 +114,7 @@ invoke_c_code (GICallableInfo *info,
- 			break;
- 
- 		    case GI_DIRECTION_OUT:
--			if (g_arg_info_is_caller_allocates (arg_info)) {
-+			if (g_arg_info_is_caller_allocates (arg_info) && g_type_info_get_interface (arg_type)) {
- 				iinfo.base.aux_args[i].v_pointer =
- 					_allocate_out_mem (arg_type);
- 				iinfo.out_args[i].v_pointer = &iinfo.base.aux_args[i];
--- 
-2.55.0
-

diff --git a/perl-Glib-Object-Introspection.spec b/perl-Glib-Object-Introspection.spec
index 8491bb4..620fa61 100644
--- a/perl-Glib-Object-Introspection.spec
+++ b/perl-Glib-Object-Introspection.spec
@@ -1,6 +1,6 @@
 Name:           perl-Glib-Object-Introspection
 Version:        0.052
-Release:        5%{?dist}
+Release:        6%{?dist}
 Summary:        Dynamically create Perl language bindings
 License:        LGPL-2.1-or-later
 URL:            https://metacpan.org/release/Glib-Object-Introspection
@@ -9,9 +9,9 @@ Patch1:         perl-Glib-Object-Introspection_lib_pattern.patch
 # Use system-wide compiler flags when building test libraries. It silents
 # annocheck gating tests, CPAN RT#147466, proposed to the upstream.
 Patch2:         Glib-Object-Introspection-0.050-Use-CFLAGS-and-LDFLAGS-from-the-envirnoment-for-buil.patch
-# Work around a test crash with glib >= 2.89.0, bug #2486187, propsed upstream
+# Fix a test crash with glib >= 2.89.0, bug #2486187, in upstream after 0.052,
 # <https://gitlab.gnome.org/GNOME/perl-glib-object-introspection/-/work_items/8>
-Patch3:         Glib-Object-Introspection-0.052-Skip-allocating-memory-if-an-output-argument-is-not-.patch
+Patch3:         Glib-Object-Introspection-0.052-Handle-caller-allocated-scalar-outputs.patch
 BuildRequires:  coreutils
 BuildRequires:  findutils
 BuildRequires:  make
@@ -137,6 +137,9 @@ LANG=C.UTF-8 make test
 %{_libexecdir}/%{name}
 
 %changelog
+* Mon Sep 07 2026 Petr Pisar <ppisar@redhat.com> - 0.052-6
+- Fix a test crash with glib >= 2.89.0 (bug #2486187)
+
 * Tue Jul 28 2026 Petr Pisar <ppisar@redhat.com> - 0.052-5
 - Work around a test crash with glib >= 2.89.0 (bug #2486187)
 

                 reply	other threads:[~2026-09-07 14:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178879133157.1.11865496027648476987.rpms-perl-Glib-Object-Introspection-1f3031c29069@fedoraproject.org \
    --to=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox