summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/opkg/opkg
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2023-12-10 19:51:16 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-12-13 11:34:27 +0000
commitc39adf61d3d46e6bdb5f930674cd3a6d927c00b6 (patch)
tree49dd7497275601ddf315479dd8016aceec180d8f /meta/recipes-devtools/opkg/opkg
parent0ce61d9b8b6d28082715405c5ffffc24f4065d11 (diff)
downloadpoky-c39adf61d3d46e6bdb5f930674cd3a6d927c00b6.tar.gz
opkg: Use own version of portable basename function
Fixes build with upcoming musl release. (From OE-Core rev: f76d44192919c0b9a2f66ba93190322fe5bcb3ed) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/opkg/opkg')
-rw-r--r--meta/recipes-devtools/opkg/opkg/0001-libopkg-Use-libgen.h-to-provide-basename-API.patch62
1 files changed, 62 insertions, 0 deletions
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 0000000000..cff091fabf
--- /dev/null
+++ b/meta/recipes-devtools/opkg/opkg/0001-libopkg-Use-libgen.h-to-provide-basename-API.patch
@@ -0,0 +1,62 @@
1From 7a1c13a48cf020c40dda1721d5c2ffd95e8e669a Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 10 Dec 2023 19:39:29 -0800
4Subject: [PATCH v2] libopkg: Use libgen.h to provide basename API
5
6Also ensure that copy of filename is passed into archive_entry_set_pathname
7so it can be operated upon by posix basename which expect non-const
8character pointer as input.
9
10This became evident with latest musl where basename declaration was
11dropped from string.h [1]
12
13[1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7
14
15Upstream-Status: Submitted [https://lists.yoctoproject.org/g/opkg/message/12]
16Signed-off-by: Khem Raj <raj.khem@gmail.com>
17---
18v2: Do not override basename wholesale
19
20 libopkg/opkg_archive.c | 6 ++++--
21 libopkg/opkg_remove.c | 1 +
22 2 files changed, 5 insertions(+), 2 deletions(-)
23
24diff --git a/libopkg/opkg_archive.c b/libopkg/opkg_archive.c
25index 03a4afb..b099f5b 100644
26--- a/libopkg/opkg_archive.c
27+++ b/libopkg/opkg_archive.c
28@@ -20,6 +20,7 @@
29
30 #include <archive.h>
31 #include <archive_entry.h>
32+#include <libgen.h>
33 #include <stdlib.h>
34 #include <stdio.h>
35 #include <string.h>
36@@ -797,8 +798,9 @@ int gz_write_archive(const char *filename, const char *gz_filename)
37 }
38
39 /* Remove path hierarchy, as we are only compressing a single file */
40- archive_entry_set_pathname(entry, basename(filename));
41-
42+ char* tmp = xstrdup(filename);
43+ archive_entry_set_pathname(entry, basename(tmp));
44+ free(tmp);
45 r = archive_write_header(a, entry);
46 if (r != ARCHIVE_OK) {
47 opkg_msg(ERROR, "Failed to create compressed file: '%s' : %s (errno=%d)",
48diff --git a/libopkg/opkg_remove.c b/libopkg/opkg_remove.c
49index 889c672..5254388 100644
50--- a/libopkg/opkg_remove.c
51+++ b/libopkg/opkg_remove.c
52@@ -20,6 +20,7 @@
53
54 #include "config.h"
55
56+#include <libgen.h>
57 #include <stdio.h>
58 #include <glob.h>
59 #include <unistd.h>
60--
612.43.0
62