|
Panu Matilainen |
5b4d98 |
From eb21562bcec67746e756679a60995f68d7d45577 Mon Sep 17 00:00:00 2001
|
|
Panu Matilainen |
5b4d98 |
Message-Id: <eb21562bcec67746e756679a60995f68d7d45577.1488964568.git.pmatilai@redhat.com>
|
|
Panu Matilainen |
5b4d98 |
In-Reply-To: <189b4f88c8e100155ec23a1e0b214bdc8473532a.1488964568.git.pmatilai@redhat.com>
|
|
Panu Matilainen |
5b4d98 |
References: <189b4f88c8e100155ec23a1e0b214bdc8473532a.1488964568.git.pmatilai@redhat.com>
|
|
Panu Matilainen |
5b4d98 |
From: Panu Matilainen <pmatilai@redhat.com>
|
|
Panu Matilainen |
5b4d98 |
Date: Thu, 5 Jan 2017 12:13:54 +0200
|
|
Panu Matilainen |
5b4d98 |
Subject: [PATCH 07/11] Only process regular files when generating build-ids
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
Versioned shared libraries typically have several symlinks pointing
|
|
Panu Matilainen |
5b4d98 |
to them directly and indirectly. When %_build_id_links is set to compat or
|
|
Panu Matilainen |
5b4d98 |
separate this causes bogus warnings about duplicate build-ids.
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
It looks commit bbfe1f86b2e4b5c0bd499d9f3dd9de9c9c20fff2 intends to skip
|
|
Panu Matilainen |
5b4d98 |
symlinks since it filters on S_ISREG(), but since uses fstat()
|
|
Panu Matilainen |
5b4d98 |
on already open()'ed file it ends up stat()'ing the symlink target.
|
|
Panu Matilainen |
5b4d98 |
Flip stat() + open() around and use lstat() instead to fix it.
|
|
Panu Matilainen |
5b4d98 |
---
|
|
Panu Matilainen |
5b4d98 |
build/files.c | 11 +++++------
|
|
Panu Matilainen |
5b4d98 |
1 file changed, 5 insertions(+), 6 deletions(-)
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
diff --git a/build/files.c b/build/files.c
|
|
Panu Matilainen |
5b4d98 |
index 2ede463..ca04176 100644
|
|
Panu Matilainen |
5b4d98 |
--- a/build/files.c
|
|
Panu Matilainen |
5b4d98 |
+++ b/build/files.c
|
|
Panu Matilainen |
5b4d98 |
@@ -1678,11 +1678,10 @@ static int generateBuildIDs(FileList fl)
|
|
Panu Matilainen |
5b4d98 |
int needMain = 0;
|
|
Panu Matilainen |
5b4d98 |
int needDbg = 0;
|
|
Panu Matilainen |
5b4d98 |
for (i = 0, flp = fl->files.recs; i < fl->files.used; i++, flp++) {
|
|
Panu Matilainen |
5b4d98 |
- int fd;
|
|
Panu Matilainen |
5b4d98 |
- fd = open (flp->diskPath, O_RDONLY);
|
|
Panu Matilainen |
5b4d98 |
- if (fd >= 0) {
|
|
Panu Matilainen |
5b4d98 |
- struct stat sbuf;
|
|
Panu Matilainen |
5b4d98 |
- if (fstat (fd, &sbuf) == 0 && S_ISREG (sbuf.st_mode)) {
|
|
Panu Matilainen |
5b4d98 |
+ struct stat sbuf;
|
|
Panu Matilainen |
5b4d98 |
+ if (lstat(flp->diskPath, &sbuf) == 0 && S_ISREG (sbuf.st_mode)) {
|
|
Panu Matilainen |
5b4d98 |
+ int fd = open (flp->diskPath, O_RDONLY);
|
|
Panu Matilainen |
5b4d98 |
+ if (fd >= 0) {
|
|
Panu Matilainen |
5b4d98 |
Elf *elf = elf_begin (fd, ELF_C_READ, NULL);
|
|
Panu Matilainen |
5b4d98 |
if (elf != NULL && elf_kind(elf) == ELF_K_ELF) {
|
|
Panu Matilainen |
5b4d98 |
const void *build_id;
|
|
Panu Matilainen |
5b4d98 |
@@ -1748,8 +1747,8 @@ static int generateBuildIDs(FileList fl)
|
|
Panu Matilainen |
5b4d98 |
}
|
|
Panu Matilainen |
5b4d98 |
elf_end (elf);
|
|
Panu Matilainen |
5b4d98 |
}
|
|
Panu Matilainen |
5b4d98 |
+ close (fd);
|
|
Panu Matilainen |
5b4d98 |
}
|
|
Panu Matilainen |
5b4d98 |
- close (fd);
|
|
Panu Matilainen |
5b4d98 |
}
|
|
Panu Matilainen |
5b4d98 |
}
|
|
Panu Matilainen |
5b4d98 |
|
|
Panu Matilainen |
5b4d98 |
--
|
|
Panu Matilainen |
5b4d98 |
2.9.3
|
|
Panu Matilainen |
5b4d98 |
|