[Git][reproducible-builds/diffoscope][master] Ensure potential CalledProcessError is caught in OpenSSL comparator. (Re. #398)

Chris Lamb (@lamby) gitlab at salsa.debian.org
Wed Mar 19 14:35:16 UTC 2025



Chris Lamb pushed to branch master at Reproducible Builds / diffoscope


Commits:
c1827a11 by Chris Lamb at 2025-03-19T14:34:42+00:00
Ensure potential CalledProcessError is caught in OpenSSL comparator. (Re. #398)

- - - - -


1 changed file:

- diffoscope/comparators/openssl.py


Changes:

=====================================
diffoscope/comparators/openssl.py
=====================================
@@ -16,6 +16,7 @@
 # You should have received a copy of the GNU General Public License
 # along with diffoscope.  If not, see <https://www.gnu.org/licenses/>.
 
+import logging
 import plistlib
 
 from diffoscope.tools import tool_required
@@ -24,6 +25,8 @@ from diffoscope.difference import Difference
 from .utils.file import File
 from .utils.command import Command, our_check_output
 
+logger = logging.getLogger(__name__)
+
 
 class OpenSSLPKCS7(Command):
     @tool_required("openssl")
@@ -53,18 +56,23 @@ class MobileProvisionFile(File):
     @staticmethod
     @tool_required("openssl")
     def _get_structured_profile_text(path):
-        openssl_output = our_check_output(
-            [
-                "openssl",
-                "smime",
-                "-inform",
-                "der",
-                "-verify",
-                "-noverify",
-                "-in",
-                path,
-            ]
-        )
+        try:
+            openssl_output = our_check_output(
+                [
+                    "openssl",
+                    "smime",
+                    "-inform",
+                    "der",
+                    "-verify",
+                    "-noverify",
+                    "-in",
+                    path,
+                ]
+            )
+        except subprocess.CalledProcessError as exc:
+            logger.warning("Failed to execute openssl to analayse Xcode file", exc)
+            return "[Could not parse output]"
+
         return plistlib.dumps(plistlib.loads(openssl_output), sort_keys=True)
 
     def compare_details(self, other, source=None):



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

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/commit/c1827a1194f6bdd2fa50444580319a0fd1f845b5
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/20250319/021e4a0f/attachment.htm>


More information about the rb-commits mailing list