[diffoscope] 01/01: comparators.squashfs: Actually include the leading "/" in the output.

Chris Lamb chris at chris-lamb.co.uk
Wed Mar 15 09:22:07 CET 2017


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

lamby pushed a commit to branch experimental
in repository diffoscope.

commit 46cd3f980c82f024a81388e57f9c3addd0c83e42
Author: Chris Lamb <lamby at debian.org>
Date:   Wed Mar 15 09:21:54 2017 +0100

    comparators.squashfs: Actually include the leading "/" in the output.
    
    Signed-off-by: Chris Lamb <lamby at debian.org>
---
 diffoscope/comparators/squashfs.py | 10 +++++++---
 tests/comparators/test_squashfs.py |  4 ++--
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/diffoscope/comparators/squashfs.py b/diffoscope/comparators/squashfs.py
index 3561b3e..5e1c70a 100644
--- a/diffoscope/comparators/squashfs.py
+++ b/diffoscope/comparators/squashfs.py
@@ -80,6 +80,11 @@ class SquashfsMember(ArchiveMember):
         # directory per-file in ArchiveMember.path.
         return os.path.join(self.container._temp_dir, self._name)
 
+    @property
+    def name(self):
+        # Don't include the leading "." in the output  (eg. "./etc/shadow")
+        return self._name[1:]
+
 
 class SquashfsRegularFile(SquashfsMember):
     # Example line:
@@ -280,9 +285,8 @@ class SquashfsContainer(Archive):
             except SquashfsInvalidLineFormat:
                 continue
 
-            # Pop to avoid duplicate member name twice and strip the leading
-            # "./" for aesthetics
-            member_name = kwargs.pop('member_name')[2:]
+            # Pop to avoid duplicating member name in the key and the value
+            member_name = kwargs.pop('member_name')
 
             self._members[member_name] = (cls, kwargs)
 
diff --git a/tests/comparators/test_squashfs.py b/tests/comparators/test_squashfs.py
index 05bc20d..1b379ef 100644
--- a/tests/comparators/test_squashfs.py
+++ b/tests/comparators/test_squashfs.py
@@ -68,8 +68,8 @@ def test_symlink(differences):
 
 @skip_unless_tools_exist('unsquashfs')
 def test_compressed_files(differences):
-    assert differences[3].source1 == 'text'
-    assert differences[3].source2 == 'text'
+    assert differences[3].source1 == '/text'
+    assert differences[3].source2 == '/text'
     expected_diff = get_data('text_ascii_expected_diff')
     assert differences[3].unified_diff == expected_diff
 

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


More information about the diffoscope mailing list