[Git][reproducible-builds/diffoscope][master] Even if a Sphinx .inv inventory file is labelled "The remainder of this file...

Chris Lamb (@lamby) gitlab at salsa.debian.org
Sat Jan 8 12:07:05 UTC 2022



Chris Lamb pushed to branch master at Reproducible Builds / diffoscope


Commits:
6eb56487 by Chris Lamb at 2022-01-08T12:06:07+00:00
Even if a Sphinx .inv inventory file is labelled "The remainder of this file is compressed using zlib.", it might not actually be. In this case, don't traceback and simply return the original content. (Closes: reproducible-builds/diffoscope#299)

- - - - -


1 changed file:

- diffoscope/comparators/sphinx.py


Changes:

=====================================
diffoscope/comparators/sphinx.py
=====================================
@@ -55,6 +55,13 @@ def describe_inventory(filename):
                 tail += line
 
     result = head + b"\n" if head else b""
-    result += zlib.decompress(tail)
 
-    return result.decode("utf-8")
+    try:
+        result += zlib.decompress(tail)
+    except zlib.error:
+        # Even if the file is labelled "The remainder of this file is
+        # compressed using zlib.", it might not actually be. In this case,
+        # simply return the original content.
+        result += tail
+
+    return result.decode("utf-8", "ignore")



View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/commit/6eb56487e1df2b17a8c5598ef7aa1f4386791289

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/commit/6eb56487e1df2b17a8c5598ef7aa1f4386791289
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20220108/0f25c4ff/attachment.htm>


More information about the rb-commits mailing list