From 6dd82f3a04966c1cdf80ce76dfb7f5660449a6ad Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Sun, 28 Aug 2022 11:48:48 -0700 Subject: python3-netifaces: Fix build with python3 and musl Signed-off-by: Khem Raj --- ...faces-initialize-msghdr-in-a-portable-way.patch | 49 ++++++++++++++++++++++ .../python/python3-netifaces_0.11.0.bb | 6 ++- 2 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 meta-python/recipes-devtools/python/python3-netifaces/0001-netifaces-initialize-msghdr-in-a-portable-way.patch (limited to 'meta-python/recipes-devtools/python') diff --git a/meta-python/recipes-devtools/python/python3-netifaces/0001-netifaces-initialize-msghdr-in-a-portable-way.patch b/meta-python/recipes-devtools/python/python3-netifaces/0001-netifaces-initialize-msghdr-in-a-portable-way.patch new file mode 100644 index 000000000..7ff86cc8b --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-netifaces/0001-netifaces-initialize-msghdr-in-a-portable-way.patch @@ -0,0 +1,49 @@ +From cbcd19f38ae4b31c57c57ce3619b8d2674defb68 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sun, 28 Aug 2022 08:11:27 -0700 +Subject: [PATCH] netifaces: initialize msghdr in a portable way + +musl has padding bytes inside the msghdr struct which means initializing +full structure will cause wrong assignments, doing partial assignment is +more portable and assign the elements after that + +Fixes +netifaces.c:1808:9: error: incompatible pointer to integer conversion initializing 'int' with an expression of type 'void *' [-Wint-conversion] + NULL, + ^~~~ + +Upstream-Status: Inappropriate [Upstream Repo is read-only] +Signed-off-by: Khem Raj +--- + netifaces.c | 15 ++++++--------- + 1 file changed, 6 insertions(+), 9 deletions(-) + +diff --git a/netifaces.c b/netifaces.c +index 839c42c..7da78e7 100644 +--- a/netifaces.c ++++ b/netifaces.c +@@ -1800,15 +1800,12 @@ gateways (PyObject *self) + do { + struct sockaddr_nl sanl_from; + struct iovec iov = { msgbuf, bufsize }; +- struct msghdr msghdr = { +- &sanl_from, +- sizeof(sanl_from), +- &iov, +- 1, +- NULL, +- 0, +- 0 +- }; ++ struct msghdr msghdr = { 0 }; ++ ++ msghdr.msg_name = &sanl_from; ++ msghdr.msg_namelen = sizeof(sanl_from); ++ msghdr.msg_iov = &iov; ++ msghdr.msg_iovlen = 1; + int nllen; + + ret = recvmsg (s, &msghdr, 0); +-- +2.37.2 + diff --git a/meta-python/recipes-devtools/python/python3-netifaces_0.11.0.bb b/meta-python/recipes-devtools/python/python3-netifaces_0.11.0.bb index 09e54b0ba..f211c6954 100644 --- a/meta-python/recipes-devtools/python/python3-netifaces_0.11.0.bb +++ b/meta-python/recipes-devtools/python/python3-netifaces_0.11.0.bb @@ -4,6 +4,8 @@ SECTION = "devel/python" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://PKG-INFO;beginline=8;endline=8;md5=a53cbc7cb75660694e138ba973c148df" -SRC_URI[sha256sum] = "043a79146eb2907edf439899f262b3dfe41717d34124298ed281139a8b93ca32" - inherit pypi setuptools3 + +SRC_URI += "file://0001-netifaces-initialize-msghdr-in-a-portable-way.patch" + +SRC_URI[sha256sum] = "043a79146eb2907edf439899f262b3dfe41717d34124298ed281139a8b93ca32" -- cgit v1.2.3-54-g00ecf