]> code.ossystems Code Review - openembedded-core.git/commitdiff
libsolv: Enable correct qsort_r on musl
authorKhem Raj <raj.khem@gmail.com>
Fri, 29 Oct 2021 17:10:22 +0000 (10:10 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 1 Nov 2021 10:41:15 +0000 (10:41 +0000)
Newer musl now has this function implemented and signatures are same as
glibc, current codepaths forces it on BSD path which is wrong for musl
and results in random segfaults in apps using libsolv e.g. opkg

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-extended/libsolv/libsolv/0001-utils-Conside-musl-when-wrapping-qsort_r.patch [new file with mode: 0644]
meta/recipes-extended/libsolv/libsolv_0.7.20.bb

diff --git a/meta/recipes-extended/libsolv/libsolv/0001-utils-Conside-musl-when-wrapping-qsort_r.patch b/meta/recipes-extended/libsolv/libsolv/0001-utils-Conside-musl-when-wrapping-qsort_r.patch
new file mode 100644 (file)
index 0000000..6f0dea2
--- /dev/null
@@ -0,0 +1,34 @@
+From 06321f1a2aa89b8e028946e793344657eaad0165 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 28 Oct 2021 22:28:45 -0700
+Subject: [PATCH] utils: Conside musl when wrapping qsort_r
+
+musl now has implemented qsort_r, the signature however matches glibc
+and not BSD, current check makes it such that it falls into BSD case
+when building for musl, which clearly is wrong, therefore instead of
+just checking for glibc check for linux to decide which qsort_r
+signature to use. This covers both glibc and musl
+
+Upstream-Status: Pending
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/util.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/util.c b/src/util.c
+index 72426e09..8f29bc5a 100644
+--- a/src/util.c
++++ b/src/util.c
+@@ -159,7 +159,7 @@ solv_setcloexec(int fd, int state)
+    see also: http://sources.redhat.com/ml/libc-alpha/2008-12/msg00003.html
+  */
+-#if (defined(__GLIBC__) || defined(__NEWLIB__)) && (defined(HAVE_QSORT_R) || defined(HAVE___QSORT_R))
++#if (defined(__linux__) || defined(__NEWLIB__)) && (defined(HAVE_QSORT_R) || defined(HAVE___QSORT_R))
+ void
+ solv_sort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *, void *), void *compard)
+-- 
+2.33.1
+
index 6861def5331606d8c08dc7050f4bae71fc931aba..21017c39027bf1cf07459524f0561df4f6b17973 100644 (file)
@@ -9,6 +9,7 @@ LIC_FILES_CHKSUM = "file://LICENSE.BSD;md5=62272bd11c97396d4aaf1c41bc11f7d8"
 DEPENDS = "expat zlib"
 
 SRC_URI = "git://github.com/openSUSE/libsolv.git;branch=master \
+           file://0001-utils-Conside-musl-when-wrapping-qsort_r.patch \
 "
 
 SRCREV = "f618e6aae1d44be633b2ab91d4fd4f4f974f4d40"