[diffoscope] 01/01: Handle "index" entries in .a archives in a better way

Ximin Luo infinity0 at debian.org
Tue Nov 15 12:01:25 CET 2016

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

infinity0 pushed a commit to branch master
in repository diffoscope.

commit c6bd520845794bf4542a155b4e1a25eddd51ee3b
Author: Ximin Luo <infinity0 at debian.org>
Date:   Sat Nov 12 16:53:56 2016 +0100

    Handle "index" entries in .a archives in a better way
    Sometimes these bypass elf.py (e.g. if the file ending is not .a) and we end
    up here with an error, which is unnecessary and we can continue perfectly well.
    Also make the error message a bit clearer on what it's actually doing.
 diffoscope/comparators/libarchive.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/diffoscope/comparators/libarchive.py b/diffoscope/comparators/libarchive.py
index e2536c1..2565e1a 100644
--- a/diffoscope/comparators/libarchive.py
+++ b/diffoscope/comparators/libarchive.py
@@ -167,9 +167,9 @@ class LibarchiveContainer(Archive):
         return member_names
     def extract(self, member_name, dest_dir):
-        dest_name = os.path.basename(member_name)
+        dest_name = os.path.basename(member_name.rstrip("/"+os.sep))
         if not dest_name:
-            raise ValueError('member_name should not be a directory')
+            raise ValueError('could not make safe name to extract member_name to: %s' % member_name)
         dest_path = os.path.join(dest_dir, dest_name)
         logger.debug('libarchive extracting %s to %s', member_name, dest_path)
         with libarchive.file_reader(self.source.path) as archive:

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

More information about the diffoscope mailing list