Signed-off-by: Khem Raj <[email protected]>
---
 ...lename-before-passing-it-to-basename.patch | 40 +++++++++++++++++++
 ...ix-missing-basename-include-on-macOS.patch | 26 ++++++++++++
 meta/recipes-devtools/rpm/rpm_4.18.1.bb       |  2 +
 3 files changed, 68 insertions(+)
 create mode 100644 
meta/recipes-devtools/rpm/files/0001-Duplicate-filename-before-passing-it-to-basename.patch
 create mode 100644 
meta/recipes-devtools/rpm/files/0001-Fix-missing-basename-include-on-macOS.patch

diff --git 
a/meta/recipes-devtools/rpm/files/0001-Duplicate-filename-before-passing-it-to-basename.patch
 
b/meta/recipes-devtools/rpm/files/0001-Duplicate-filename-before-passing-it-to-basename.patch
new file mode 100644
index 00000000000..f9b809d1676
--- /dev/null
+++ 
b/meta/recipes-devtools/rpm/files/0001-Duplicate-filename-before-passing-it-to-basename.patch
@@ -0,0 +1,40 @@
+From 3fa2ae78db9b31edb4c22f3b5cd36c6c972947f1 Mon Sep 17 00:00:00 2001
+From: Florian Festi <[email protected]>
+Date: Wed, 26 Jul 2023 15:01:35 +0200
+Subject: [PATCH] Duplicate filename before passing it to basename
+
+basename is allowed change the string passed to it. While we don't need
+the filename after that just casting away the const seems a bit too
+hacky.
+
+Upstream-Status: Backport 
[https://github.com/rpm-software-management/rpm/commit/3fa2ae78db9b31edb4c22f3b5cd36c6c972947f1]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ tools/rpmuncompress.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/tools/rpmuncompress.c b/tools/rpmuncompress.c
+index 58ddf5683..e13cc6a66 100644
+--- a/tools/rpmuncompress.c
++++ b/tools/rpmuncompress.c
+@@ -98,7 +98,8 @@ static char *doUntar(const char *fn)
+       if (needtar) {
+           rasprintf(&buf, "%s '%s' | %s %s -", zipper, fn, tar, taropts);
+       } else if (at->compressed == COMPRESSED_GEM) {
+-          const char *bn = basename(fn);
++          char *tmp = xstrdup(fn);
++          const char *bn = basename(tmp);
+           size_t nvlen = strlen(bn) - 3;
+           char *gem = rpmGetPath("%{__gem}", NULL);
+           char *gemspec = NULL;
+@@ -112,6 +113,7 @@ static char *doUntar(const char *fn)
+ 
+           free(gemspec);
+           free(gem);
++          free(tmp);
+       } else {
+           rasprintf(&buf, "%s '%s'", zipper, fn);
+       }
+-- 
+2.43.0
+
diff --git 
a/meta/recipes-devtools/rpm/files/0001-Fix-missing-basename-include-on-macOS.patch
 
b/meta/recipes-devtools/rpm/files/0001-Fix-missing-basename-include-on-macOS.patch
new file mode 100644
index 00000000000..a93597a8352
--- /dev/null
+++ 
b/meta/recipes-devtools/rpm/files/0001-Fix-missing-basename-include-on-macOS.patch
@@ -0,0 +1,26 @@
+From b2e67642fd8cb64d8cb1cca9e759396c1c10807d Mon Sep 17 00:00:00 2001
+From: Calvin Buckley <[email protected]>
+Date: Tue, 11 Jul 2023 19:22:41 -0300
+Subject: [PATCH] Fix missing basename include on macOS
+
+Upstream-Status: Backport 
[https://github.com/rpm-software-management/rpm/commit/b2e67642fd8cb64d8cb1cca9e759396c1c10807d]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ tools/rpmuncompress.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/tools/rpmuncompress.c b/tools/rpmuncompress.c
+index bd4146d54..58ddf5683 100644
+--- a/tools/rpmuncompress.c
++++ b/tools/rpmuncompress.c
+@@ -1,6 +1,7 @@
+ #include "system.h"
+ 
+ #include <popt.h>
++#include <libgen.h>
+ #include <errno.h>
+ #include <stdio.h>
+ #include <string.h>
+-- 
+2.43.0
+
diff --git a/meta/recipes-devtools/rpm/rpm_4.18.1.bb 
b/meta/recipes-devtools/rpm/rpm_4.18.1.bb
index 95a9e92f96b..3e85cbb8efe 100644
--- a/meta/recipes-devtools/rpm/rpm_4.18.1.bb
+++ b/meta/recipes-devtools/rpm/rpm_4.18.1.bb
@@ -40,6 +40,8 @@ SRC_URI = 
"git://github.com/rpm-software-management/rpm;branch=rpm-4.18.x;protoc
            file://0001-python-Use-Py_hash_t-instead-of-long-in-hdr_hash.patch \
            file://fix-declaration.patch \
            file://ea3187cfcf9cac87e5bc5e7db79b0338da9e355e.patch \
+           file://0001-Duplicate-filename-before-passing-it-to-basename.patch \
+           file://0001-Fix-missing-basename-include-on-macOS.patch \
            "
 
 PE = "1"
-- 
2.43.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#193219): 
https://lists.openembedded.org/g/openembedded-core/message/193219
Mute This Topic: https://lists.openembedded.org/mt/103478225/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to