diff options
author | Khem Raj <raj.khem@gmail.com> | 2023-12-10 19:51:16 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-12-13 11:34:27 +0000 |
commit | c39adf61d3d46e6bdb5f930674cd3a6d927c00b6 (patch) | |
tree | 49dd7497275601ddf315479dd8016aceec180d8f /meta/recipes-devtools/opkg/opkg | |
parent | 0ce61d9b8b6d28082715405c5ffffc24f4065d11 (diff) | |
download | poky-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.patch | 62 |
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 @@ | |||
1 | From 7a1c13a48cf020c40dda1721d5c2ffd95e8e669a Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Sun, 10 Dec 2023 19:39:29 -0800 | ||
4 | Subject: [PATCH v2] libopkg: Use libgen.h to provide basename API | ||
5 | |||
6 | Also ensure that copy of filename is passed into archive_entry_set_pathname | ||
7 | so it can be operated upon by posix basename which expect non-const | ||
8 | character pointer as input. | ||
9 | |||
10 | This became evident with latest musl where basename declaration was | ||
11 | dropped from string.h [1] | ||
12 | |||
13 | [1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7 | ||
14 | |||
15 | Upstream-Status: Submitted [https://lists.yoctoproject.org/g/opkg/message/12] | ||
16 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
17 | --- | ||
18 | v2: 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 | |||
24 | diff --git a/libopkg/opkg_archive.c b/libopkg/opkg_archive.c | ||
25 | index 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)", | ||
48 | diff --git a/libopkg/opkg_remove.c b/libopkg/opkg_remove.c | ||
49 | index 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 | -- | ||
61 | 2.43.0 | ||
62 | |||