Your message dated Fri, 18 Dec 2015 16:54:23 +0000
with message-id <>
and subject line Bug#808002: fixed in diffoscope 44
has caused the Debian Bug report #808002,
regarding diffoscope: Add support for Mozilla-optimized ZIPs
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact

Debian Bug Tracking System
Contact with problems
--- Begin Message ---
Source: diffoscope
Version: ada1a1dcdc19217fb611e0a1e57bc3744399aefa
Severity: wishlist
Tags: patch

It would be useful for diffoscope to output differences in omni.ja files as
for other Zip files, instead of ending up with a diff of an hexdump.

The attached patch implements a minimal support for this. It however doesn't
look at the difference in the `preload` value.

-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.2.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=ja_JP.UTF-8, LC_CTYPE=ja_JP.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
diff --git a/diffoscope/comparators/ b/diffoscope/comparators/
index b4615c9..b5dd320 100644
--- a/diffoscope/comparators/
+++ b/diffoscope/comparators/
@@ -72,7 +72,7 @@ from diffoscope.comparators.symlink import Symlink
 from diffoscope.comparators.text import TextFile
 from diffoscope.comparators.tar import TarFile
 from diffoscope.comparators.xz import XzFile
-from import ZipFile
+from import ZipFile, MozillaZipFile
 def bail_if_non_existing(*paths):
@@ -154,6 +154,7 @@ FILE_CLASSES = (
+    MozillaZipFile,
diff --git a/diffoscope/comparators/ b/diffoscope/comparators/
index ecdc77b..42c9a9f 100644
--- a/diffoscope/comparators/
+++ b/diffoscope/comparators/
@@ -111,3 +111,54 @@ class ZipFile(File):
         zipinfo_difference = Difference.from_command(Zipinfo, self.path, other.path) or \
                              Difference.from_command(ZipinfoVerbose, self.path, other.path)
         return [zipinfo_difference]
+class MozillaZipCommandMixin(object):
+    def wait(self):
+        # zipinfo emits an error when reading Mozilla-optimized ZIPs,
+        # which is fine to ignore.
+        super(Zipinfo, self).wait()
+        return 0
+class MozillaZipinfo(MozillaZipCommandMixin, Zipinfo): pass
+class MozillaZipinfoVerbose(MozillaZipCommandMixin, ZipinfoVerbose): pass
+class MozillaZipContainer(ZipContainer):
+    def open_archive(self):
+        # This is gross: Monkeypatch zipfile._EndRecData to work with
+        # Mozilla-optimized ZIPs
+        _orig_EndRecData = zipfile._EndRecData
+        def _EndRecData(fh):
+            endrec = _orig_EndRecData(fh)
+            if endrec:
+                endrec[zipfile._ECD_LOCATION] = (endrec[zipfile._ECD_OFFSET] +
+                                                 endrec[zipfile._ECD_SIZE])
+            return endrec
+        zipfile._EndRecData = _EndRecData
+        result = super(MozillaZipContainer, self).open_archive()
+        zipfile._EndRecData = _orig_EndRecData
+        return result
+class MozillaZipFile(File):
+    CONTAINER_CLASS = MozillaZipContainer
+    @staticmethod
+    def recognizes(file):
+        # Mozilla-optimized ZIPs start with a 32-bit little endian integer
+        # indicating the amount of data to preload, followed by the ZIP
+        # central directory (with a PK\x01\x02 signature)
+        with open(file.path, 'rb') as f:
+            preload =
+            if len(preload) == 4:
+                signature =
+                return signature == b'PK\x01\x02'
+    def compare_details(self, other, source=None):
+        zipinfo_difference = Difference.from_command(MozillaZipinfo, self.path, other.path) or \
+                             Difference.from_command(MozillaZipinfoVerbose, self.path, other.path)
+        return [zipinfo_difference]

--- End Message ---
--- Begin Message ---
Source: diffoscope
Source-Version: 44

We believe that the bug you reported is fixed in the latest version of
diffoscope, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
Jérémy Bobbio <> (supplier of updated diffoscope package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing

Hash: SHA256

Format: 1.8
Date: Fri, 18 Dec 2015 15:42:20 +0000
Source: diffoscope
Binary: diffoscope debbindiff
Architecture: source all
Version: 44
Distribution: unstable
Urgency: medium
Maintainer: Reproducible builds folks 
Changed-By: Jérémy Bobbio <>
 debbindiff - transitional package
 diffoscope - in-depth comparison of files, archives, and directories
Closes: 808002 808003 808103 808104 808121 808199
 diffoscope (44) unstable; urgency=medium
   [ Mike Hommey ]
   * Tell readelf to use wide output. (Closes: #808103)
   * Add support for Mozilla optimized Zip files. (Closes: #808002)
   * Use <ins/> and <del/> in HTML output.
   * Fix line numbering in HTML diff output (Closes: #808199)
   [ Jérémy Bobbio ]
   * Fix .deb comparisons when md5sums is wrong or missing. (Closes: #808104)
   * Remove some quadratic string concatenations in HTML presenter.
   * Remove useless <span>s in HTML output. (Closes: #808121)
   * Replace calling find by using os.walk in directory comparator.
   * Sort the file list in directory comparator. (Closes: #808003)
   * Ensure the 'lines skipped' message gets written when lines are skipped
     at the end of a diff.
   * Make sure to read HTML reports as utf-8 in tests.
   [ Esa Peuha ]
   * Convert HTML character entity references to UTF-8 characters to save space.
 3b77317eeab4df32c7c90ba8a51826d1c5fa1f9c 2000 diffoscope_44.dsc
 48377ad108e8c42b13521311e5118a9ef9236d24 236288 diffoscope_44.tar.xz
 1fc36ad107a6015946fd3938d4509be055c41095 12584 debbindiff_44_all.deb
 e9dd48d5da74d80b9568c1c1c0a32d0dcbac2cbb 50220 diffoscope_44_all.deb
 d2c7d223d68c6cb91b4192d77a9aac35b0b80cc780aef2fd91a20f7df872459c 2000 
 f5a9df72de769bcc339c2e5de09bd31cc8da575ed4a0dc22e99f4840e3cf3560 236288 
 39f0e43cd788e17e85080c0f7e7a00fea1e9f1f8b122372154d5ecd0834b77ed 12584 
 72929681c5e08eeb5e1fd86201e90b61a3473214d584478c3278bdc1a2770084 50220 
 e1fd37eeda4cb226ea04ba8a40d3e8d6 2000 devel optional diffoscope_44.dsc
 f2a69c5dd8d5fee4f28b981a81ad41e6 236288 devel optional diffoscope_44.tar.xz
 d4624e94a94b5e657ea22db806629c3b 12584 oldlibs extra debbindiff_44_all.deb
 ab2ad44c47083c9968fd7cc0b25143f0 50220 devel optional diffoscope_44_all.deb

Version: GnuPG v1


--- End Message ---
Reproducible-builds mailing list

Reply via email to