From 6715757024ed1fee3acff7392ee5b67989363be0 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Mon, 6 Apr 2020 14:40:01 +0300 Subject: [PATCH] Fix invalid path passed to parametric macro generators --- ...pend-buildroot-to-a-path-for-paramet.patch | 52 +++++++++++++++++++ rpm.spec | 6 ++- 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 0001-rpmfc-Do-not-prepend-buildroot-to-a-path-for-paramet.patch diff --git a/0001-rpmfc-Do-not-prepend-buildroot-to-a-path-for-paramet.patch b/0001-rpmfc-Do-not-prepend-buildroot-to-a-path-for-paramet.patch new file mode 100644 index 0000000..c60fd36 --- /dev/null +++ b/0001-rpmfc-Do-not-prepend-buildroot-to-a-path-for-paramet.patch @@ -0,0 +1,52 @@ +From 10127cdb2364de2c1408950a25b730920e665689 Mon Sep 17 00:00:00 2001 +Message-Id: <10127cdb2364de2c1408950a25b730920e665689.1586173014.git.pmatilai@redhat.com> +From: Igor Raits +Date: Sun, 5 Apr 2020 16:21:40 +0200 +Subject: [PATCH] rpmfc: Do not prepend buildroot to a path for parametric + generator + +'fn' already contains full path to a file, so no need to prepend it once +more. This is actually breaking things. + +Before: +D: Calling %{__pythonname_provides %{?__pythonname_provides_opts}}() on /home/brain/rpmbuild/BUILDROOT/hello-1-1.fc33.x86_64//home/brain/rpmbuild/BUILDROOT/hello-1-1.fc33.x86_64/usr/share/applications/org.gnome.Terminal.desktop + +After: +D: Calling %{__pythonname_provides %{?__pythonname_provides_opts}}() on /home/brain/rpmbuild/BUILDROOT/hello-1-1.fc33.x86_64/usr/share/applications/org.gnome.Terminal.desktop + +Fixes: https://github.com/rpm-software-management/rpm/issues/1162 +Signed-off-by: Igor Raits +--- + build/rpmfc.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/build/rpmfc.c b/build/rpmfc.c +index f6c358676..10c380ee9 100644 +--- a/build/rpmfc.c ++++ b/build/rpmfc.c +@@ -533,20 +533,18 @@ static ARGV_t runCall(const char *cmd, + const char *buildRoot, const char *fn) + { + ARGV_t output = NULL; +- char *path = rstrscat(NULL, buildRoot ? buildRoot : "", "/", fn, NULL); + + if (_rpmfc_debug) +- rpmlog(RPMLOG_DEBUG, "Calling %s() on %s\n", cmd, path); ++ rpmlog(RPMLOG_DEBUG, "Calling %s() on %s\n", cmd, fn); + + /* Hack to pass in the path as what looks like a macro argument */ +- rpmPushMacroFlags(NULL, "1", NULL, path, 1, RPMMACRO_LITERAL); ++ rpmPushMacroFlags(NULL, "1", NULL, fn, 1, RPMMACRO_LITERAL); + char *exp = rpmExpand(cmd, NULL); + rpmPopMacro(NULL, "1"); + if (*exp) + argvSplit(&output, exp, "\n\r"); + free(exp); + +- free(path); + return output; + } + +-- +2.25.1 + diff --git a/rpm.spec b/rpm.spec index 6830a28..d086e75 100644 --- a/rpm.spec +++ b/rpm.spec @@ -25,7 +25,7 @@ %global rpmver 4.15.90 %global snapver git14971 -%global rel 3 +%global rel 4 %global srcver %{version}%{?snapver:-%{snapver}} %global srcdir %{?snapver:testing}%{!?snapver:%{name}-%(echo %{version} | cut -d'.' -f1-2).x} @@ -58,6 +58,7 @@ Patch6: 0001-find-debuginfo.sh-decompress-DWARF-compressed-ELF-se.patch # Patches already upstream: Patch100: 0001-Unset-SOURCE_DATE_EPOCH-for-the-test-suite.patch +Patch101: 0001-rpmfc-Do-not-prepend-buildroot-to-a-path-for-paramet.patch # These are not yet upstream Patch906: rpm-4.7.1-geode-i686.patch @@ -523,6 +524,9 @@ make check || (cat tests/rpmtests.log; exit 1) %doc doc/librpm/html/* %changelog +* Mon Apr 06 2020 Panu Matilainen - 4.15.90-0.git14971.4 +- Fix invalid path passed to parametric macro generators + * Thu Apr 02 2020 Panu Matilainen - 4.15.90-0.git14971.3 - Fix db lock files not getting packaged