[diffoscope] 01/01: comparators.macho: Always strip the filename, not just when by itself.

Chris Lamb chris at chris-lamb.co.uk
Wed Jan 10 08:53:57 CET 2018


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

lamby pushed a commit to branch master
in repository diffoscope.

commit 35a2ce907dc25c3bb46157d540e4e7fe54ced49d
Author: Chris Lamb <lamby at debian.org>
Date:   Wed Jan 10 12:40:41 2018 +0530

    comparators.macho: Always strip the filename, not just when by itself.
---
 diffoscope/comparators/macho.py | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/diffoscope/comparators/macho.py b/diffoscope/comparators/macho.py
index 65e02d2..0ac0c76 100644
--- a/diffoscope/comparators/macho.py
+++ b/diffoscope/comparators/macho.py
@@ -42,14 +42,11 @@ class Otool(Command):
         return ['-arch', self._arch]
 
     def filter(self, line):
-        try:
-            # Strip the filename itself, it's in the first line on its own,
-            # terminated by a colon
-            if line and line.decode('utf-8').strip() == self._path + ':':
-                return b""
-            return line
-        except UnicodeDecodeError:
-            return line
+        # Strip filename
+        prefix = '{}:'.format(self._path)
+        if line.decode('utf-8', 'ignore').index(prefix) == 0:
+            return line[len(prefix):].strip()
+        return line
 
 
 class OtoolHeaders(Otool):

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


More information about the diffoscope mailing list