From 7674f0d76be7fe09a4fb91e0494082bb9b7ccb45 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Tue, 1 Jul 2014 13:39:03 +0300 Subject: [PATCH] - Macro-expand load macro argument --- rpm-4.11.90-expand-load-arg.patch | 30 ++++++++++++++++++++++++++++++ rpm.spec | 3 +++ 2 files changed, 33 insertions(+) create mode 100644 rpm-4.11.90-expand-load-arg.patch diff --git a/rpm-4.11.90-expand-load-arg.patch b/rpm-4.11.90-expand-load-arg.patch new file mode 100644 index 0000000..9e2c65c --- /dev/null +++ b/rpm-4.11.90-expand-load-arg.patch @@ -0,0 +1,30 @@ +commit d4ab1d82d7888f41b866751d0ef340a82be7cff2 +Author: Panu Matilainen +Date: Tue Jul 1 12:04:40 2014 +0300 + + Macro-expand %{load:...} argument to make the thing more useful... + +diff --git a/rpmio/macro.c b/rpmio/macro.c +index b00155c..1d9bd1c 100644 +--- a/rpmio/macro.c ++++ b/rpmio/macro.c +@@ -1093,16 +1093,15 @@ expandMacro(MacroBuf mb, const char *src, size_t slen) + + /* Expand builtin macros */ + if (STREQ("load", f, fn)) { +- if (g && gn > 0) { +- char arg[gn + 1]; +- strncpy(arg, g, gn); +- arg[gn] = '\0'; ++ char *arg = NULL; ++ if (g && gn > 0 && expandThis(mb, g, gn, &arg) == 0) { + /* Print failure iff %{load:...} or %{!?load:...} */ + if (loadMacroFile(mb->mc, arg) && chkexist == negate) { + rpmlog(RPMLOG_ERR, + _("failed to load macro file %s"), arg); + } + } ++ free(arg); + s = se; + continue; + } diff --git a/rpm.spec b/rpm.spec index 184b1f6..62c8127 100644 --- a/rpm.spec +++ b/rpm.spec @@ -49,6 +49,7 @@ Patch4: rpm-4.8.1-use-gpg2.patch # Patches already upstream: Patch100: rpm-4.11.90-hardlink-groups.patch +Patch101: rpm-4.11.90-expand-load-arg.patch # These are not yet upstream Patch302: rpm-4.7.1-geode-i686.patch @@ -286,6 +287,7 @@ Requires: rpm-libs%{_isa} = %{version}-%{release} %patch4 -p1 -b .use-gpg2 %patch100 -p1 -b .hardlink-groups +%patch101 -p1 -b .expand-load-arg %patch302 -p1 -b .geode %patch304 -p1 -b .ldflags @@ -541,6 +543,7 @@ exit 0 %changelog * Tue Jul 01 2014 Panu Matilainen - 4.11.90-0.git12844.3 - Drop no longer needed temporary UsrMove patch +- Macro-expand load macro argument * Mon Jun 30 2014 Panu Matilainen - 4.11.90-0.git12844.2 - Fix multiple interleaved hardlink groups during build