[Reproducible-commits] [diffoscope] 08/23: XXX More binary files

Jérémy Bobbio lunar at moszumanska.debian.org
Sat Sep 19 23:18:20 UTC 2015


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

lunar pushed a commit to branch pu/py3
in repository diffoscope.

commit d3ba17222d626f08797ab3e5eef1ec69df46791d
Author: Jérémy Bobbio <lunar at debian.org>
Date:   Sat Sep 19 18:18:13 2015 +0200

    XXX More binary files
---
 diffoscope/comparators/binary.py     | 2 +-
 diffoscope/comparators/deb.py        | 2 +-
 diffoscope/comparators/libarchive.py | 2 +-
 diffoscope/comparators/png.py        | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/diffoscope/comparators/binary.py b/diffoscope/comparators/binary.py
index d4d7f5d..ca040ce 100644
--- a/diffoscope/comparators/binary.py
+++ b/diffoscope/comparators/binary.py
@@ -121,7 +121,7 @@ class File(object):
             with self.get_content():
                 # tlsh is not meaningful with files smaller than 512 bytes
                 if os.stat(self.path).st_size >= 512:
-                    self._fuzzy_hash = tlsh.hash(open(self.path).read())
+                    self._fuzzy_hash = tlsh.hash(open(self.path, 'rb').read())
                 else:
                     self._fuzzy_hash = None
         return self._fuzzy_hash
diff --git a/diffoscope/comparators/deb.py b/diffoscope/comparators/deb.py
index 0d5cffb..157aafb 100644
--- a/diffoscope/comparators/deb.py
+++ b/diffoscope/comparators/deb.py
@@ -47,7 +47,7 @@ class ArContainer(Archive):
         member = self.archive.getmember(member_name)
         dest_path = os.path.join(dest_dir, os.path.basename(member_name))
         member.seek(0)
-        with open(dest_path, 'w') as fp:
+        with open(dest_path, 'wb') as fp:
             for buf in iter(lambda: member.read(AR_EXTRACTION_BUFFER_SIZE), b''):
                 fp.write(buf)
         return dest_path
diff --git a/diffoscope/comparators/libarchive.py b/diffoscope/comparators/libarchive.py
index 702324a..e0b8960 100644
--- a/diffoscope/comparators/libarchive.py
+++ b/diffoscope/comparators/libarchive.py
@@ -127,7 +127,7 @@ class LibarchiveContainer(Archive):
             for entry in archive:
                 if entry.pathname == member_name:
                     logger.debug('entry found, writing %s', dest_path)
-                    with open(dest_path, 'w') as f:
+                    with open(dest_path, 'wb') as f:
                         for buf in entry.get_blocks():
                             f.write(buf)
                     return dest_path
diff --git a/diffoscope/comparators/png.py b/diffoscope/comparators/png.py
index 22f81c0..1eceacd 100644
--- a/diffoscope/comparators/png.py
+++ b/diffoscope/comparators/png.py
@@ -32,7 +32,7 @@ class Sng(Command):
 
     def feed_stdin(self, stdin):
         try:
-            with open(self.path) as f:
+            with open(self.path, 'rb') as f:
                 for buf in iter(partial(f.read, 32768), b''):
                     stdin.write(buf)
         finally:

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



More information about the Reproducible-commits mailing list