tags 879956 + patch fixed-upstream
thanks

Hi,

a patch for this can be found [here] (git commit attached). Thanks to
Mattia Rizzolo for sponsoring me so that I could access a s390x
porterbox and debug this myself.

Cheers,
Uli

[here]: https://github.com/pavouk/lgi/pull/178
-- 
A learning experience is one of those things that say,
'You know that thing you just did? Don't do that.'
                     -- Douglas Adams
>From f8350780e77ed68922493c8397615abbd6908cb8 Mon Sep 17 00:00:00 2001
From: Uli Schlachter <psyc...@znc.in>
Date: Mon, 30 Oct 2017 21:14:11 +0100
Subject: [PATCH] callable: Fix enum return from C functions

According to [1], return values smaller than sizeof(long) are returned
as ffi_arg or ffi_sarg. Thus, the code here needs to use ffi_sarg
instead of int to work correctly.

This fixes a test failure on s390x that boils down to
cairo_pattern_get_type() returning 2, but the C code here turns that
into a value of 0.

A big "thank" you to Debian and specifically to Mattia Rizzolo for
giving me access to a porterbox so that I could debug this myself.

[1]: https://linux.die.net/man/3/ffi_call

Signed-off-by: Uli Schlachter <psyc...@znc.in>
---
 lgi/callable.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lgi/callable.c b/lgi/callable.c
index 62387ed..86b7ed3 100644
--- a/lgi/callable.c
+++ b/lgi/callable.c
@@ -769,7 +769,7 @@ callable_param_2lua (lua_State *L, Param *param, GIArgument *arg,
 			  args + callable->has_self);
       else
 	{
-	  union { GIArgument arg; int i; } *u = (gpointer) arg;
+	  union { GIArgument arg; ffi_sarg i; } *u = (gpointer) arg;
 	  lua_pushnumber (L, u->i);
 	}
     }
-- 
2.14.2

Reply via email to