From: Khem Raj Date: Mon, 11 Dec 2023 03:51:16 +0000 (-0800) Subject: opkg: Use own version of portable basename function X-Git-Tag: uninative-4.4~762 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f76d44192919c0b9a2f66ba93190322fe5bcb3ed;p=thirdparty%2Fopenembedded%2Fopenembedded-core.git opkg: Use own version of portable basename function Fixes build with upcoming musl release. Signed-off-by: Khem Raj Signed-off-by: Alexandre Belloni --- diff --git a/meta/recipes-devtools/opkg/opkg/0001-libopkg-Use-libgen.h-to-provide-basename-API.patch b/meta/recipes-devtools/opkg/opkg/0001-libopkg-Use-libgen.h-to-provide-basename-API.patch new file mode 100644 index 00000000000..cff091fabf9 --- /dev/null +++ b/meta/recipes-devtools/opkg/opkg/0001-libopkg-Use-libgen.h-to-provide-basename-API.patch @@ -0,0 +1,62 @@ +From 7a1c13a48cf020c40dda1721d5c2ffd95e8e669a Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sun, 10 Dec 2023 19:39:29 -0800 +Subject: [PATCH v2] libopkg: Use libgen.h to provide basename API + +Also ensure that copy of filename is passed into archive_entry_set_pathname +so it can be operated upon by posix basename which expect non-const +character pointer as input. + +This became evident with latest musl where basename declaration was +dropped from string.h [1] + +[1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7 + +Upstream-Status: Submitted [https://lists.yoctoproject.org/g/opkg/message/12] +Signed-off-by: Khem Raj +--- +v2: Do not override basename wholesale + + libopkg/opkg_archive.c | 6 ++++-- + libopkg/opkg_remove.c | 1 + + 2 files changed, 5 insertions(+), 2 deletions(-) + +diff --git a/libopkg/opkg_archive.c b/libopkg/opkg_archive.c +index 03a4afb..b099f5b 100644 +--- a/libopkg/opkg_archive.c ++++ b/libopkg/opkg_archive.c +@@ -20,6 +20,7 @@ + + #include + #include ++#include + #include + #include + #include +@@ -797,8 +798,9 @@ int gz_write_archive(const char *filename, const char *gz_filename) + } + + /* Remove path hierarchy, as we are only compressing a single file */ +- archive_entry_set_pathname(entry, basename(filename)); +- ++ char* tmp = xstrdup(filename); ++ archive_entry_set_pathname(entry, basename(tmp)); ++ free(tmp); + r = archive_write_header(a, entry); + if (r != ARCHIVE_OK) { + opkg_msg(ERROR, "Failed to create compressed file: '%s' : %s (errno=%d)", +diff --git a/libopkg/opkg_remove.c b/libopkg/opkg_remove.c +index 889c672..5254388 100644 +--- a/libopkg/opkg_remove.c ++++ b/libopkg/opkg_remove.c +@@ -20,6 +20,7 @@ + + #include "config.h" + ++#include + #include + #include + #include +-- +2.43.0 + diff --git a/meta/recipes-devtools/opkg/opkg_0.6.2.bb b/meta/recipes-devtools/opkg/opkg_0.6.2.bb index 46be137354c..b2e675ae48b 100644 --- a/meta/recipes-devtools/opkg/opkg_0.6.2.bb +++ b/meta/recipes-devtools/opkg/opkg_0.6.2.bb @@ -15,6 +15,7 @@ PE = "1" SRC_URI = "http://downloads.yoctoproject.org/releases/${BPN}/${BPN}-${PV}.tar.gz \ file://opkg.conf \ file://0001-opkg_conf-create-opkg.lock-in-run-instead-of-var-run.patch \ + file://0001-libopkg-Use-libgen.h-to-provide-basename-API.patch \ file://run-ptest \ "