Package: libselinux
Version: 3.7-3
Followup-For: Bug #1091131
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu plucky ubuntu-patch
Control: tags -1 patch ftbfs

Dear Maintainer,

In Ubuntu, the attached patch was applied to achieve the following:

Fix FTBFS by incorporating the relevant fix from upstream to deal with the API
change in SWIG_Python_AppendOutput in swig 4.3.0


  * debian/patches/fix-swig-bingings-for-4.3.0.patch: Fix FTBFS with swig
    4.3.0 by backporting patch from upstream


Thanks for considering the patch.


-- System Information:
Debian Release: trixie/sid
  APT prefers oracular-updates
  APT policy: (500, 'oracular-updates'), (500, 'oracular-security'), (500, 
'oracular'), (100, 'oracular-proposed'), (100, 'oracular-backports')
Architecture: amd64 (x86_64)

Kernel: Linux 6.11.0-13-generic (SMP w/8 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_WARN, TAINT_OOT_MODULE
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_AU:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff -Nru libselinux-3.7/debian/patches/fix-swig-bingings-for-4.3.0.patch 
libselinux-3.7/debian/patches/fix-swig-bingings-for-4.3.0.patch
--- libselinux-3.7/debian/patches/fix-swig-bingings-for-4.3.0.patch     
1970-01-01 09:30:00.000000000 +0930
+++ libselinux-3.7/debian/patches/fix-swig-bingings-for-4.3.0.patch     
2025-01-06 11:41:15.000000000 +1030
@@ -0,0 +1,83 @@
+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 */
diff -Nru libselinux-3.7/debian/patches/series 
libselinux-3.7/debian/patches/series
--- libselinux-3.7/debian/patches/series        2024-11-14 17:29:12.000000000 
+1030
+++ libselinux-3.7/debian/patches/series        2025-01-06 11:41:50.000000000 
+1030
@@ -1,2 +1,3 @@
 default
 lfs-compat.patch
+fix-swig-bingings-for-4.3.0.patch

Reply via email to