mirror of
https://git.yoctoproject.org/poky
synced 2026-04-23 09:32:17 +02:00
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>
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
From 7a1c13a48cf020c40dda1721d5c2ffd95e8e669a Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
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 <raj.khem@gmail.com>
|
||||
---
|
||||
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 <archive.h>
|
||||
#include <archive_entry.h>
|
||||
+#include <libgen.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -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 <libgen.h>
|
||||
#include <stdio.h>
|
||||
#include <glob.h>
|
||||
#include <unistd.h>
|
||||
--
|
||||
2.43.0
|
||||
|
||||
@@ -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 \
|
||||
"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user