From d145899932ed040cdaaed70a7ce2ea0f11757ab6 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko 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 Signed-off-by: Igor Gnatenko --- build/files.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/build/files.c b/build/files.c index 2387a2e5b..a4b5cd6e8 100644 --- a/build/files.c +++ b/build/files.c @@ -2788,6 +2788,19 @@ static void filterDebuginfoPackage(rpmSpec spec, Package pkg, /* strip trailing .debug like in find-debuginfo.sh */ if (namel > 6 && !strcmp(name + namel - 6, ".debug")) namel -= 6; + + /* fileRenameMap doesn't necessarily have to be initialized */ + if (pkg->fileRenameMap) { + 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);