From 1cd1d45798a30b95bd5535463002c148bf04e7e2 Mon Sep 17 00:00:00 2001
From: Igor Gnatenko <i.gnatenko.brain@gmail.com>
Date: Fri, 28 Jul 2017 18:32:06 +0200
Subject: [PATCH] reference proper debug files whenever RemovePathPostfixes is
used
Closes: https://github.com/rpm-software-management/rpm/issues/280
Reviewed-by: Mark Wielaard <mark@klomp.org>
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
(cherry picked from commit 98efb7f6dc222ed175516298a34e807053d125f4)
---
build/files.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/build/files.c b/build/files.c
index 42709a549..3b93ac559 100644
--- a/build/files.c
+++ b/build/files.c
@@ -2791,6 +2791,19 @@ static void filterDebuginfoPackage(rpmSpec spec, Package pkg,
namel = strlen(name);
if (namel > 6 && !strcmp(name + namel - 6, ".debug"))
namel -= 6;
+
+ /* fileRenameMap doesn't necessarily have to be initialized */
+ if (pkg->fileRenameMap) {
+ const char **names = NULL;
+ int namec = 0;
+ fileRenameHashGetEntry(pkg->fileRenameMap, name, &names, &namec, NULL);
+ if (namec) {
+ if (namec > 1)
+ rpmlog(RPMLOG_WARNING, _("%s was mapped to multiple filenames"), name);
+ name = *names;
+ namel = strlen(name);
+ }
+ }
/* generate path */
rasprintf(&path, "%s%s%.*s%s.debug", buildroot, DEBUG_LIB_DIR, namel, name, uniquearch);