From eba4e0859e5830759a3c44a4cb382ba2bec2b118 Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Fri, 27 Jul 2018 12:17:01 +0200 Subject: [PATCH] fix printing of details about ELF binaries --- file-5.34-readelf.patch | 35 +++++++++++++++++++++++++++++++++++ file.spec | 3 +++ 2 files changed, 38 insertions(+) create mode 100644 file-5.34-readelf.patch diff --git a/file-5.34-readelf.patch b/file-5.34-readelf.patch new file mode 100644 index 0000000..9135dc3 --- /dev/null +++ b/file-5.34-readelf.patch @@ -0,0 +1,35 @@ +From 9ec8a9d418059f6a2db0a8b5dd9c3242b4ab8b0a Mon Sep 17 00:00:00 2001 +From: Kamil Dudka +Date: Thu, 26 Jul 2018 17:39:05 +0200 +Subject: [PATCH] magic: fix printing of details about ELF binaries + +This commit fixes a regression introduced by the following commit: +https://github.com/file/file/commit/e2adab14 + +Without this patch: +/usr/bin/curl: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV) +/usr/bin/true: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=57291d41021b27733e8eb00ee1e561a98c11e2d2, stripped + +With this patch: +/usr/bin/curl: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=fd7ce380cd8dff1f52c1a4c1f3d8635cb20dda23, stripped, too many notes (256) +/usr/bin/true: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=57291d41021b27733e8eb00ee1e561a98c11e2d2, stripped +--- + src/funcs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/funcs.c b/src/funcs.c +index 0bf92fe1..4ddf5afe 100644 +--- a/src/funcs.c ++++ b/src/funcs.c +@@ -268,7 +268,7 @@ file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((__u + + rv = file_tryelf(ms, &b); + rbuf = file_pop_buffer(ms, pb); +- if (rv != 1) { ++ if (rv == -1) { + free(rbuf); + rbuf = NULL; + } +-- +2.14.4 + diff --git a/file.spec b/file.spec index 2f16aeb..27b3bd1 100644 --- a/file.spec +++ b/file.spec @@ -26,6 +26,9 @@ Patch0: file-localmagic.patch Patch1: file-4.17-rpm-name.patch Patch2: file-5.04-volume_key.patch +# fix printing of details about ELF binaries +Patch3: file-5.34-readelf.patch + URL: http://www.darwinsys.com/file/ Requires: file-libs = %{version}-%{release} BuildRequires: zlib-devel