Panu Matilainen 671575
From 10127cdb2364de2c1408950a25b730920e665689 Mon Sep 17 00:00:00 2001
Panu Matilainen 671575
Message-Id: <10127cdb2364de2c1408950a25b730920e665689.1586173014.git.pmatilai@redhat.com>
Panu Matilainen 671575
From: Igor Raits <i.gnatenko.brain@gmail.com>
Panu Matilainen 671575
Date: Sun, 5 Apr 2020 16:21:40 +0200
Panu Matilainen 671575
Subject: [PATCH] rpmfc: Do not prepend buildroot to a path for parametric
Panu Matilainen 671575
 generator
Panu Matilainen 671575
Panu Matilainen 671575
'fn' already contains full path to a file, so no need to prepend it once
Panu Matilainen 671575
more. This is actually breaking things.
Panu Matilainen 671575
Panu Matilainen 671575
Before:
Panu Matilainen 671575
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
Panu Matilainen 671575
Panu Matilainen 671575
After:
Panu Matilainen 671575
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
Panu Matilainen 671575
Panu Matilainen 671575
Fixes: https://github.com/rpm-software-management/rpm/issues/1162
Panu Matilainen 671575
Signed-off-by: Igor Raits <i.gnatenko.brain@gmail.com>
Panu Matilainen 671575
---
Panu Matilainen 671575
 build/rpmfc.c | 6 ++----
Panu Matilainen 671575
 1 file changed, 2 insertions(+), 4 deletions(-)
Panu Matilainen 671575
Panu Matilainen 671575
diff --git a/build/rpmfc.c b/build/rpmfc.c
Panu Matilainen 671575
index f6c358676..10c380ee9 100644
Panu Matilainen 671575
--- a/build/rpmfc.c
Panu Matilainen 671575
+++ b/build/rpmfc.c
Panu Matilainen 671575
@@ -533,20 +533,18 @@ static ARGV_t runCall(const char *cmd,
Panu Matilainen 671575
 		     const char *buildRoot, const char *fn)
Panu Matilainen 671575
 {
Panu Matilainen 671575
     ARGV_t output = NULL;
Panu Matilainen 671575
-    char *path = rstrscat(NULL, buildRoot ? buildRoot : "", "/", fn, NULL);
Panu Matilainen 671575
 
Panu Matilainen 671575
     if (_rpmfc_debug)
Panu Matilainen 671575
-	rpmlog(RPMLOG_DEBUG, "Calling %s() on %s\n", cmd, path);
Panu Matilainen 671575
+	rpmlog(RPMLOG_DEBUG, "Calling %s() on %s\n", cmd, fn);
Panu Matilainen 671575
 
Panu Matilainen 671575
     /* Hack to pass in the path as what looks like a macro argument */
Panu Matilainen 671575
-    rpmPushMacroFlags(NULL, "1", NULL, path, 1, RPMMACRO_LITERAL);
Panu Matilainen 671575
+    rpmPushMacroFlags(NULL, "1", NULL, fn, 1, RPMMACRO_LITERAL);
Panu Matilainen 671575
     char *exp = rpmExpand(cmd, NULL);
Panu Matilainen 671575
     rpmPopMacro(NULL, "1");
Panu Matilainen 671575
     if (*exp)
Panu Matilainen 671575
 	argvSplit(&output, exp, "\n\r");
Panu Matilainen 671575
     free(exp);
Panu Matilainen 671575
 
Panu Matilainen 671575
-    free(path);
Panu Matilainen 671575
     return output;
Panu Matilainen 671575
 }
Panu Matilainen 671575
 
Panu Matilainen 671575
-- 
Panu Matilainen 671575
2.25.1
Panu Matilainen 671575