[dpkg] 178/200: Dpkg::Shlibs::Objdump:Object: Warn for unknown exec formats in analyze()

Ximin Luo infinity0 at debian.org
Wed Apr 5 15:17:38 UTC 2017


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch master
in repository dpkg.

commit 0fad19f2a3014b487d8c6dbcf70feac03ff0b693
Author: Guillem Jover <guillem at debian.org>
Date:   Wed Feb 8 06:08:03 2017 +0100

    Dpkg::Shlibs::Objdump:Object: Warn for unknown exec formats in analyze()
    
    Emit an explicit warning whenever we cannot detect the format for
    an executable object, instead of delegating this to the subsequent
    objdump, and letting it die, which ca be canfusing and is not
    future-proof.
    
    Closes: #854536
---
 debian/changelog               | 2 ++
 scripts/Dpkg/Shlibs/Objdump.pm | 5 +++++
 2 files changed, 7 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 4bf4d0a..d32a00c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,6 +8,8 @@ dpkg (1.18.23) UNRELEASED; urgency=medium
       the code has been fixed in NetBSD as that situation could not happen.
     - Fix read() error handling in Dpkg::Shlibs::Objdump::get_format() to
       gracefully ignore non-ELF files again. Closes: #854536
+    - Emit an explicit warning from Dpkg::Shlibs::Objdump::Object::analyze()
+      for unknown executable formats instead of relying on objdump doing so.
   * Documentation:
     - Clarify the requirements for deb-conffile(5) pathnames. Closes: #854417
       Proposed by Dieter Adriaenssens <dieter.adriaenssens at gmail.com>.
diff --git a/scripts/Dpkg/Shlibs/Objdump.pm b/scripts/Dpkg/Shlibs/Objdump.pm
index 60c3080..7eaac2e 100644
--- a/scripts/Dpkg/Shlibs/Objdump.pm
+++ b/scripts/Dpkg/Shlibs/Objdump.pm
@@ -293,6 +293,11 @@ sub analyze {
 
     $self->{exec_abi} = Dpkg::Shlibs::Objdump::get_format($file);
 
+    if (not defined $self->{exec_abi}) {
+        warning(g_("unknown executable format in file '%s'"), $file);
+        return;
+    }
+
     local $ENV{LC_ALL} = 'C';
     open(my $objdump, '-|', $OBJDUMP, '-w', '-f', '-p', '-T', '-R', $file)
         or syserr(g_('cannot fork for %s'), $OBJDUMP);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git



More information about the Reproducible-commits mailing list