Fix invalid path passed to parametric macro generators

This commit is contained in:
Panu Matilainen 2020-04-06 14:40:01 +03:00
parent 8332f4fa64
commit 6715757024
2 changed files with 57 additions and 1 deletions

View File

@ -0,0 +1,52 @@
From 10127cdb2364de2c1408950a25b730920e665689 Mon Sep 17 00:00:00 2001
Message-Id: <10127cdb2364de2c1408950a25b730920e665689.1586173014.git.pmatilai@redhat.com>
From: Igor Raits <i.gnatenko.brain@gmail.com>
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 <i.gnatenko.brain@gmail.com>
---
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

View File

@ -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 <pmatilai@redhat.com> - 4.15.90-0.git14971.4
- Fix invalid path passed to parametric macro generators
* Thu Apr 02 2020 Panu Matilainen <pmatilai@redhat.com> - 4.15.90-0.git14971.3
- Fix db lock files not getting packaged