This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


rhbz #909481. When a compression library wasn't installed libdwfl would
not try the next compression library for opening a file. Only try to open
a file with a compression library if it is actually used. 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@redhat.com>
---
 libdwfl/ChangeLog |    5 +++++
 libdwfl/open.c    |    8 ++++++++
 tests/ChangeLog   |    7 +++++++
 tests/Makefile.am |    8 ++++++--
 4 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 1311dea..21a6f0a 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,8 @@
+2013-02-22  Mark Wielaard  <mjw@redhat.com>
+
+	* open.c (decompress): Only call __libdw_[gunzip|bunzip2|unlzma]
+	when ZLIB, BZLIB or LZMA are configured.
+
 2013-02-10  Mark Wielaard  <mjw@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..4ee22de 100644
--- a/libdwfl/open.c
+++ b/libdwfl/open.c
@@ -60,12 +60,20 @@ decompress (int fd __attribute__ ((unused)), Elf **elf)
   if (mapped_size == 0)
     return error;
 
+#if USE_ZLIB
   error = __libdw_gunzip (fd, offset, mapped, mapped_size, &buffer, &size);
+#endif
+
+#if USE_BZLIB
   if (error == DWFL_E_BADELF)
     error = __libdw_bunzip2 (fd, offset, mapped, mapped_size, &buffer, &size);
+#endif
+
+#if USE_LZMA
   if (error == DWFL_E_BADELF)
     error = __libdw_unlzma (fd, offset, mapped, mapped_size, &buffer, &size);
 #endif
+#endif
 
   if (error == DWFL_E_NOERROR)
     {
diff --git a/tests/ChangeLog b/tests/ChangeLog
index c1e0ef9..102fdc1 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,10 @@
+2013-02-22  Mark Wielaard  <mjw@redhat.com>
+
+	* Makefile.am (check_PROGRAMS): Remove dwflsyms.
+	(TESTS): Remove run-readelf-s.sh and run-dwflsyms.sh.
+	(LZMA): Add dwflsyms to check_PROGRAMS, add run-readelf-s.sh and
+	run-dwflsyms.sh to TESTS.
+
 2013-02-15  Mark Wielaard  <mjw@redhat.com>
 
 	* testfile-dwzstr.bz2: New testfile.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 44b4e61..0b1a6af 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -51,7 +51,7 @@ check_PROGRAMS = arextract arsymtest newfile saridx scnnames sectiondump \
 		  dwfl-bug-getmodules dwarf-getmacros addrcfi \
 		  test-flag-nobits dwarf-getstring rerequest_tag \
 		  alldts md5-sha1-test typeiter low_high_pc \
-		  test-elf_cntl_gelf_getshdr dwflsyms
+		  test-elf_cntl_gelf_getshdr
 asm_TESTS = asm-tst1 asm-tst2 asm-tst3 asm-tst4 asm-tst5 \
 	    asm-tst6 asm-tst7 asm-tst8 asm-tst9
 
@@ -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,11 @@ check_PROGRAMS += msg_tst md5-sha1-test
 TESTS += msg_tst md5-sha1-test
 endif
 
+if LZMA
+check_PROGRAMS += dwflsyms
+TESTS += run-readelf-s.sh run-dwflsyms.sh
+endif
+
 if HAVE_LIBASM
 check_PROGRAMS += $(asm_TESTS)
 TESTS += $(asm_TESTS)
-- 
1.7.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]