Skip to contentSkip to conversation

package/libselinux: fix swig 4.3.0 compatibility

PATCH In review James Hilliard 2 participants 5 messages Nov 10, 2024 – Nov 11, 2024

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 package/libselinux: fix swig 4.3.0 compatibility

Backport a patch fixing libselinux swig 4.3.0 compatibility for the upcoming swig 4.3.0 update.

---
 ...bselinux-fix-swig-bindings-for-4.3.0.patch | 88 +++++++++++++++++++
 1 file changed, 88 insertions(+)
 create mode 100644 package/libselinux/0003-libselinux-fix-swig-bindings-for-4.3.0.patch
package/libselinux/0003-libselinux-fix-swig-bindings-for-4.3.0.patch new file +88 -0
new file mode 100644
index 0000000000..5920c05196
@@ -0,0 +1,88 @@
+From 8e0e718bae53fff30831b92cd784151d475a20da Mon Sep 17 00:00:00 2001
+From: Petr Lautrbach <[email protected]>
+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 <[email protected]>
+Signed-off-by: Petr Lautrbach <[email protected]>
+Acked-by: James Carter <[email protected]>
+Signed-off-by: James Hilliard <[email protected]>
+Upstream: https://github.com/SELinuxProject/selinux/commit/8e0e718bae53fff30831b92cd784151d475a20da
+---
+ src/selinuxswig_python.i | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/selinuxswig_python.i b/src/selinuxswig_python.i
+index 17e03b9e..03ed296d 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 */
+-- 
+2.34.1
+
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH v2 2/2 package/swig: bump to version 4.3.0

---
 package/swig/swig.hash | 2 +-
 package/swig/swig.mk   | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
package/swig/swig.hash +1 -1
index 21590c422a..9c1dbcc2fc 100644
@@ -1,5 +1,5 @@
 # Locally computed:
-sha256  2af08aced8fcd65cdb5cc62426768914bedc735b1c250325203716f78e39ac9b  swig-4.1.1.tar.gz
+sha256  f7203ef796f61af986c70c05816236cbd0d31b7aa9631e5ab53020ab7804aa9e  swig-4.3.0.tar.gz
 sha256  f53abaeed775018d519a1b9615f0ca17894772bd9ca21c2a156bf340ac41c13e  LICENSE
 sha256  8ceb4b9ee5adedde47b31e975c1d90c73ad27b6b165a1dcd80c7c545eb65b903  LICENSE-GPL
 sha256  7f50d942373a871211c5efee03f3db2f9efd1cff1002b0ef8e3748baa611a5c2  LICENSE-UNIVERSITIES
package/swig/swig.mk +2 -2
index ad585c3f97..7e84bdd431 100644
@@ -4,8 +4,8 @@
 #
 ################################################################################
 
-SWIG_VERSION_MAJOR = 4.1
-SWIG_VERSION = $(SWIG_VERSION_MAJOR).1
+SWIG_VERSION_MAJOR = 4.3
+SWIG_VERSION = $(SWIG_VERSION_MAJOR).0
 SWIG_SITE = http://downloads.sourceforge.net/project/swig/swig/swig-$(SWIG_VERSION)
 HOST_SWIG_DEPENDENCIES = host-bison host-pcre2
 HOST_SWIG_CONF_OPTS = \
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Re: [Buildroot] [PATCH v2 2/2] package/swig: bump to version 4.3.0

Hello James,

Quoted 5 lines · On Sun, 10 Nov 2024 12:37:34 -0700 James Hilliard <[email protected]>…
---
 package/swig/swig.hash | 2 +-
 package/swig/swig.mk   | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

Thanks for this patch. Could you provide some details on how well you tested the reverse dependencies of host-swig?

Based on your PATCH 1/2, you tested libselinux, but what about the other packages? I certainly don't require testing *all* of them, but since this bump has caused some breakage for libselinux, we can potentially expect some breakage for other packages. Could you build a defconfig with a good number of reverse dependencies enabled, and verify it builds OK, and report this in the commit log?

Thanks!

Thomas

Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw

Re: [Buildroot] [PATCH v2 2/2] package/swig: bump to version 4.3.0

Quoted 15 lines · Thomas Petazzoni

Hello James,

Quoted 5 lines · On Sun, 10 Nov 2024 12:37:34 -0700 James Hilliard <[email protected]>…
---
 package/swig/swig.hash | 2 +-
 package/swig/swig.mk   | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

Thanks for this patch. Could you provide some details on how well you tested the reverse dependencies of host-swig?

Quoted 6 lines

Based on your PATCH 1/2, you tested libselinux, but what about the other packages? I certainly don't require testing *all* of them, but since this bump has caused some breakage for libselinux, we can potentially expect some breakage for other packages. Could you build a defconfig with a good number of reverse dependencies enabled, and verify it builds OK, and report this in the commit log?

I pretty much just test built packages individually rather than adding them to a defconfig. I think I tested pretty much everything with host-swig as a dependency, I didn't bother making sure all could fully build but just checked that there weren't any obvious swig compilation errors.

Quoted 8 lines

Thanks!

Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#4 lore raw

Re: [Buildroot] [PATCH v2 2/2] package/swig: bump to version 4.3.0

Quoted 11 lines · On Mon, 11 Nov 2024 13:25:33 -0700 James Hilliard <[email protected]>…
Quoted 6 lines

Based on your PATCH 1/2, you tested libselinux, but what about the other packages? I certainly don't require testing *all* of them, but since this bump has caused some breakage for libselinux, we can potentially expect some breakage for other packages. Could you build a defconfig with a good number of reverse dependencies enabled, and verify it builds OK, and report this in the commit log?

I pretty much just test built packages individually rather than adding them to a defconfig. I think I tested pretty much everything with host-swig as a dependency, I didn't bother making sure all could fully build but just checked that there weren't any obvious swig compilation errors.

Hm, how did you verify that there were "no obvious swig compilation errors", without fully building those packages?

Could you provide some more convincing evidence, such as: "here is a defconfig that I tested, it builds successfully before and after the bump"?

Thanks a lot!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot