rpm/0025-build-files.c-Only-check-build-ids-for-executable-fi.patch
2017-07-18 15:49:11 +02:00

60 lines
2.3 KiB
Diff

From c21bf3aefdcfb22bc3f41888ef090c6d5a45baec Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
Date: Mon, 20 Mar 2017 11:52:00 +0100
Subject: [PATCH] build/files.c: Only check build-ids for executable files in
the main package.
generateBuildIDs should mimic what find-debuginfo.sh does. Only check
build-ids for executable files in non-debuginfo packages. This moves the
isDbg check up so the is executeble check can be done when the file is
part of the main package.
This fixes the build of qemu and uboot-tools in fedora. Both ship
non-executable ELF bios files in architecture specific packages.
https://bugzilla.redhat.com/show_bug.cgi?id=1433837
Signed-off-by: Mark Wielaard <mark@klomp.org>
(cherry picked from commit c9035d464a6ac3853b5dc705e0df1734ce915cd4)
---
build/files.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/build/files.c b/build/files.c
index 9e58ae547..9f7def78c 100644
--- a/build/files.c
+++ b/build/files.c
@@ -1684,6 +1684,19 @@ static int generateBuildIDs(FileList fl)
for (i = 0, flp = fl->files.recs; i < fl->files.used; i++, flp++) {
struct stat sbuf;
if (lstat(flp->diskPath, &sbuf) == 0 && S_ISREG (sbuf.st_mode)) {
+ /* We determine whether this is a main or
+ debug ELF based on path. */
+ #define DEBUGPATH "/usr/lib/debug/"
+ int isDbg = strncmp (flp->cpioPath,
+ DEBUGPATH, strlen (DEBUGPATH)) == 0;
+
+ /* For the main package files mimic what find-debuginfo.sh does.
+ Only check build-ids for executable files. Debug files are
+ always non-executable. */
+ if (!isDbg
+ && (sbuf.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) == 0)
+ continue;
+
int fd = open (flp->diskPath, O_RDONLY);
if (fd >= 0) {
/* Only real ELF files, that are ET_EXEC, ET_DYN or
@@ -1705,12 +1718,8 @@ static int generateBuildIDs(FileList fl)
is 128 bits) and 64 bytes (largest sha3 is 512
bits), common is 20 bytes (sha1 is 160 bits). */
if (len >= 16 && len <= 64) {
- /* We determine whether this is a main or
- debug ELF based on path. */
- #define DEBUGPATH "/usr/lib/debug/"
int addid = 0;
- if (strncmp (flp->cpioPath,
- DEBUGPATH, strlen (DEBUGPATH)) == 0) {
+ if (isDbg) {
needDbg = 1;
addid = 1;
}