https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=%231091131
Below is the backtrace from the Ruby test case you provided. It shows that it fails in SWIG related code. The attached patch was recently applied in version 3.7-3.1 to build with SWIG 4.3 and close the above bug. The patch is needed to match the latest SWIG so reverting that patch is not an option - the code in question can't compile without it. I think that the root cause of this is SWIG. Is there anyone who has had previous experience of Ruby and SWIG who can help with this? (gdb) bt #0 rbimpl_RB_TYPE_P_fastpath (obj=8, t=RUBY_T_DATA) at /usr/include/ ruby-3.3.0/ruby/internal/value_type.h:351 #1 RB_TYPE_P (t=RUBY_T_DATA, obj=8) at /usr/include/ruby-3.3.0/ruby/internal/ value_type.h:378 #2 Check_Type (t=RUBY_T_DATA, v=8) at /usr/include/ruby-3.3.0/ruby/internal/ value_type.h:434 #3 rb_data_object_get (obj=8) at /usr/include/ruby-3.3.0/ruby/internal/core/ rdata.h:314 #4 SWIG_Ruby_GetModule (clientdata=0x0) at ./src/selinuxswig_ruby_wrap.c:1823 #5 SWIG_InitializeModule (clientdata=0x0) at ./src/selinuxswig_ruby_wrap.c: 12230 #6 Init_selinux () at ./src/selinuxswig_ruby_wrap.c:12402 #7 0x00007ffff7a3bfe6 in dln_load () from /lib/x86_64-linux-gnu/ libruby-3.1.so.3.1 #8 0x00007ffff7c55bd1 in ?? () from /lib/x86_64-linux-gnu/libruby-3.1.so.3.1 #9 0x00007ffff7b0d8b8 in ?? () from /lib/x86_64-linux-gnu/libruby-3.1.so.3.1 #10 0x00007ffff7b0de71 in rb_require_string () from /lib/x86_64-linux-gnu/ libruby-3.1.so.3.1 #11 0x00007ffff7c49e6c in ?? () from /lib/x86_64-linux-gnu/libruby-3.1.so.3.1 #12 0x00007ffff7c5f211 in ?? () from /lib/x86_64-linux-gnu/libruby-3.1.so.3.1 #13 0x00007ffff7c54d20 in ?? () from /lib/x86_64-linux-gnu/libruby-3.1.so.3.1 #14 0x00007ffff7c57f92 in ?? () from /lib/x86_64-linux-gnu/libruby-3.1.so.3.1 #15 0x00007ffff7c5c686 in rb_vm_exec () from /lib/x86_64-linux-gnu/ libruby-3.1.so.3.1 #16 0x00007ffff7ab98d6 in ?? () from /lib/x86_64-linux-gnu/libruby-3.1.so.3.1 #17 0x00007ffff7abd0e7 in ruby_run_node () from /lib/x86_64-linux-gnu/ libruby-3.1.so.3.1 #18 0x000055555555510d in ?? () #19 0x00007ffff7833d68 in ?? () from /lib/x86_64-linux-gnu/libc.so.6 #20 0x00007ffff7833e25 in __libc_start_main () from /lib/x86_64-linux-gnu/ libc.so.6 #21 0x0000555555555151 in _start () -- My Main Blog http://etbe.coker.com.au/ My Documents Blog http://doc.coker.com.au/
From 8e0e718bae53fff30831b92cd784151d475a20da Mon Sep 17 00:00:00 2001 From: Petr Lautrbach <lautrb...@redhat.com> Date: Wed, 16 Oct 2024 20:48:11 +0200 Subject: [PATCH] libselinux: fix swig bindings for 4.3.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/swig/swig/blob/master/CHANGES.current "[Python] #2907 Fix returning null from functions with output parameters. Ensures OUTPUT and INOUT typemaps are handled consistently wrt return type. New declaration of SWIG_Python_AppendOutput is now: SWIG_Python_AppendOutput(PyObject* result, PyObject* obj, int is_void); The 3rd parameter is new and the new $isvoid special variable should be passed to it, indicating whether or not the wrapped function returns void. Also consider replacing with: SWIG_AppendOutput(PyObject* result, PyObject* obj); which calls SWIG_Python_AppendOutput with same parameters but adding $isvoid for final parameter." Fixes: https://github.com/SELinuxProject/selinux/issues/447 selinuxswig_python_wrap.c: In function ‘_wrap_security_compute_user’: selinuxswig_python_wrap.c:11499:17: error: too few arguments to function ‘SWIG_Python_AppendOutput’ 11499 | resultobj = SWIG_Python_AppendOutput(resultobj, plist); | ^~~~~~~~~~~~~~~~~~~~~~~~ selinuxswig_python_wrap.c:1248:1: note: declared here 1248 | SWIG_Python_AppendOutput(PyObject* result, PyObject* obj, int is_void) { | ^~~~~~~~~~~~~~~~~~~~~~~~ selinuxswig_python_wrap.c: In function ‘_wrap_security_compute_user_raw’: selinuxswig_python_wrap.c:11570:17: error: too few arguments to function ‘SWIG_Python_AppendOutput’ 11570 | resultobj = SWIG_Python_AppendOutput(resultobj, plist); | ^~~~~~~~~~~~~~~~~~~~~~~~ selinuxswig_python_wrap.c:1248:1: note: declared here 1248 | SWIG_Python_AppendOutput(PyObject* result, PyObject* obj, int is_void) { | ^~~~~~~~~~~~~~~~~~~~~~~~ selinuxswig_python_wrap.c: In function ‘_wrap_security_get_boolean_names’: selinuxswig_python_wrap.c:12470:17: error: too few arguments to function ‘SWIG_Python_AppendOutput’ 12470 | resultobj = SWIG_Python_AppendOutput(resultobj, list); | ^~~~~~~~~~~~~~~~~~~~~~~~ selinuxswig_python_wrap.c:1248:1: note: declared here 1248 | SWIG_Python_AppendOutput(PyObject* result, PyObject* obj, int is_void) { | ^~~~~~~~~~~~~~~~~~~~~~~~ error: command '/usr/bin/gcc' failed with exit code 1 Suggested-by: Jitka Plesnikova <jples...@redhat.com> Signed-off-by: Petr Lautrbach <lautrb...@redhat.com> Acked-by: James Carter <jwca...@gmail.com> --- libselinux/src/selinuxswig_python.i | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libselinux/src/selinuxswig_python.i b/libselinux/src/selinuxswig_python.i index 17e03b9e36..03ed296d5b 100644 --- a/src/selinuxswig_python.i +++ b/src/selinuxswig_python.i @@ -71,7 +71,7 @@ def install(src, dest): for (i = 0; i < *$2; i++) { PyList_SetItem(list, i, PyString_FromString((*$1)[i])); } - $result = SWIG_Python_AppendOutput($result, list); + $result = SWIG_AppendOutput($result, list); } /* return a sid along with the result */ @@ -108,7 +108,7 @@ def install(src, dest): plist = PyList_New(0); } - $result = SWIG_Python_AppendOutput($result, plist); + $result = SWIG_AppendOutput($result, plist); } /* Makes functions in get_context_list.h return a Python list of contexts */