[Git][reproducible-builds/diffoscope][master] Ignore errors when listing .ar archives. (Closes: Debian:#1085257)

Chris Lamb (@lamby) gitlab at salsa.debian.org
Wed Oct 23 18:57:17 UTC 2024



Chris Lamb pushed to branch master at Reproducible Builds / diffoscope


Commits:
e0e10c41 by Chris Lamb at 2024-10-23T11:56:55-07:00
Ignore errors when listing .ar archives. (Closes: Debian:#1085257)

- - - - -


2 changed files:

- diffoscope/comparators/ar.py
- diffoscope/comparators/utils/libarchive.py


Changes:

=====================================
diffoscope/comparators/ar.py
=====================================
@@ -69,8 +69,8 @@ class ArFile(File):
                 ArSymbolTableDumper, self.path, other.path
             ),
             Difference.from_text_readers(
-                list_libarchive(self.path),
-                list_libarchive(other.path),
+                list_libarchive(self.path, ignore_errors=True),
+                list_libarchive(other.path, ignore_errors=True),
                 self.path,
                 other.path,
                 source="file list",


=====================================
diffoscope/comparators/utils/libarchive.py
=====================================
@@ -122,6 +122,14 @@ libarchive.ArchiveEntry.pathname = property(
 
 
 def list_libarchive(path, ignore_errors=False):
+    """
+    NB. Despite this method's contents being wrapped entirely in a try/except,
+    the use of yield operator means that the setting `ignore_errors` to `True`
+    will emit valid entries until there is an error, rather than a) masking all
+    entries if there is any error or b) skipping *over* errors to the next
+    entry.
+    """
+
     def force_str(val):
         # libarchive ~5 began to return uname and gname as UTF-8 whilst
         # previous versions returned bytes that required decoding.



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

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/commit/e0e10c419f5060ecb21a2ec3a1dea3ea6ef6a387
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/20241023/bb83a0ef/attachment.htm>


More information about the rb-commits mailing list