[Git][reproducible-builds/diffoscope][master] 2 commits: If we fail to import binwalk, don't report that we are missing the Python "rpm" module (!).

Chris Lamb (@lamby) gitlab at salsa.debian.org
Fri Feb 4 17:38:17 UTC 2022



Chris Lamb pushed to branch master at Reproducible Builds / diffoscope


Commits:
dd7bace5 by Chris Lamb at 2022-02-04T09:30:31-08:00
If we fail to import binwalk, don't report that we are missing the Python "rpm" module (!).

- - - - -
9e1786fa by Chris Lamb at 2022-02-04T09:37:31-08:00
If we fail to scan using binwalk, return 'False' from BinwalkFile.recognizes.

- - - - -


1 changed file:

- diffoscope/comparators/binwalk.py


Changes:

=====================================
diffoscope/comparators/binwalk.py
=====================================
@@ -34,8 +34,8 @@ except ImportError:
 
 try:
     import binwalk
-except ImportError:
-    python_module_missing("rpm")
+except Exception:
+    python_module_missing("binwalk")
     binwalk = None
 else:
     # Disable binwalk's own user configuration for predictable results and to
@@ -89,14 +89,17 @@ class BinwalkFile(File):
         unpacked = get_temporary_directory(prefix="binwalk")
         logger.debug("Extracting %s to %s", file.path, unpacked.name)
 
-        binwalk.scan(
-            file.path,
-            dd="cpio:cpio",
-            carve=True,
-            quiet=True,
-            signature=True,
-            directory=unpacked.name,
-        )
+        try:
+            binwalk.scan(
+                file.path,
+                dd="cpio:cpio",
+                carve=True,
+                quiet=True,
+                signature=True,
+                directory=unpacked.name,
+            )
+        except binwalk.core.exceptions.ModuleException:
+            return False
 
         members = {
             "{} file embedded at offset {}".format(



View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/compare/4c6295e316ee25754e6a0b2a2fc3f1c3d31b8cec...9e1786fa96ab70d61df5e55705ed327de6c1946b

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/compare/4c6295e316ee25754e6a0b2a2fc3f1c3d31b8cec...9e1786fa96ab70d61df5e55705ed327de6c1946b
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/20220204/2a7c8d43/attachment.htm>


More information about the rb-commits mailing list