[diffoscope] 03/04: utils.libarchive: No need to track archive directory locations.

Chris Lamb chris at chris-lamb.co.uk
Fri Feb 10 11:08:05 CET 2017


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

lamby pushed a commit to branch master
in repository diffoscope.

commit acebcc0b0d4192d34ada8e8d1e84bc64dcf5b8c8
Author: Chris Lamb <lamby at debian.org>
Date:   Fri Feb 10 22:45:14 2017 +1300

    utils.libarchive: No need to track archive directory locations.
---
 diffoscope/comparators/utils/libarchive.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/diffoscope/comparators/utils/libarchive.py b/diffoscope/comparators/utils/libarchive.py
index 70160a0..49ae253 100644
--- a/diffoscope/comparators/utils/libarchive.py
+++ b/diffoscope/comparators/utils/libarchive.py
@@ -208,14 +208,15 @@ class LibarchiveContainer(Archive):
 
         with libarchive.file_reader(self.source.path) as archive:
             for idx, entry in enumerate(archive):
+                # Always skip directories
+                if entry.isdir:
+                    continue
+
                 # Maintain a mapping of archive path to the extracted path,
                 # avoiding the need to sanitise filenames.
                 dst = os.path.join(tmpdir, '{}'.format(idx))
                 self._members[entry.pathname] = dst
 
-                if entry.isdir:
-                    continue
-
                 logger.debug("Extracting %s to %s", entry.pathname, dst)
 
                 with open(dst, 'wb') as f:

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


More information about the diffoscope mailing list