[PATCH] libdwfl: Only try opening files with installed compression libraries.

Mark Wielaard mjw at redhat.com
Fri Feb 22 22:51:33 UTC 2013


On Fri, Feb 22, 2013 at 09:43:57AM -0800, Roland McGrath wrote:
> Instead change the macros above in open.c to return
> DWFL_E_{ZLIB,BZLIB,LZMA} rather than false.

Much nicer and shorter.
 
> Don't conditionalize check_PROGRAMS.  The test code will build fine even if
> the support isn't there, and this avoids things like 'make dist' having
> their behavior depend on configuration details.

Ah, yeah. That would not be good. Changed.

Thanks,

Mark
-------------- next part --------------
>From f6185a75448c395795182ed1e568484056e7a2bf Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mjw at redhat.com>
Date: Fri, 22 Feb 2013 23:42:59 +0100
Subject: [PATCH] libdwfl: Try opening files all installed compression libraries.

rhbz #909481. When a compression library wasn't installed libdwfl would
not try the next compression library for opening a file. Retry with the
next available compression library if a previous one isn't installed. Also
disable tests that depend on a particular compression library
(run-readelf-s.sh and run-dwflsyms.sh) if that library isn't installed.

Signed-off-by: Mark Wielaard <mjw at redhat.com>
---
 libdwfl/ChangeLog |    5 +++++
 libdwfl/open.c    |    6 +++---
 tests/ChangeLog   |    5 +++++
 tests/Makefile.am |    5 ++++-
 4 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 1311dea..78139ba 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,8 @@
+2013-02-22  Mark Wielaard  <mjw at redhat.com>
+
+	* open.c (__libdw_gunzip,__libdw_bunzip2,__libdw_unlzma): Define
+	as DWFL_E_BADELF when not used.
+
 2013-02-10  Mark Wielaard  <mjw at redhat.com>
 
 	* argp-std.c (parse_opt): Use opt->core and opt->e explicitly in
diff --git a/libdwfl/open.c b/libdwfl/open.c
index 7dd5b52..40aac38 100644
--- a/libdwfl/open.c
+++ b/libdwfl/open.c
@@ -33,15 +33,15 @@
 #include <unistd.h>
 
 #if !USE_ZLIB
-# define __libdw_gunzip(...)	false
+# define __libdw_gunzip(...)	DWFL_E_BADELF
 #endif
 
 #if !USE_BZLIB
-# define __libdw_bunzip2(...)	false
+# define __libdw_bunzip2(...)	DWFL_E_BADELF
 #endif
 
 #if !USE_LZMA
-# define __libdw_unlzma(...)	false
+# define __libdw_unlzma(...)	DWFL_E_BADELF
 #endif
 
 /* Consumes and replaces *ELF only on success.  */
diff --git a/tests/ChangeLog b/tests/ChangeLog
index c1e0ef9..d181cd5 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,8 @@
+2013-02-22  Mark Wielaard  <mjw at redhat.com>
+
+	* Makefile.am (TESTS): Remove run-readelf-s.sh and run-dwflsyms.sh.
+	(LZMA): Add run-readelf-s.sh and run-dwflsyms.sh to TESTS.
+
 2013-02-15  Mark Wielaard  <mjw at redhat.com>
 
 	* testfile-dwzstr.bz2: New testfile.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 44b4e61..63184f8 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -83,7 +83,6 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \
 	run-test-flag-nobits.sh run-prelink-addr-test.sh \
 	run-dwarf-getstring.sh run-rerequest_tag.sh run-typeiter.sh \
 	run-readelf-d.sh run-readelf-gdb_index.sh run-unstrip-n.sh \
-	run-readelf-s.sh run-dwflsyms.sh \
 	run-low_high_pc.sh run-macro-test.sh run-elf_cntl_gelf_getshdr.sh \
 	run-test-archive64.sh run-readelf-vmcoreinfo.sh \
 	run-readelf-mixed-corenote.sh
@@ -93,6 +92,10 @@ check_PROGRAMS += msg_tst md5-sha1-test
 TESTS += msg_tst md5-sha1-test
 endif
 
+if LZMA
+TESTS += run-readelf-s.sh run-dwflsyms.sh
+endif
+
 if HAVE_LIBASM
 check_PROGRAMS += $(asm_TESTS)
 TESTS += $(asm_TESTS)
-- 
1.7.1



More information about the elfutils-devel mailing list