Skip to content
Snippets Groups Projects
Commit e0e10c41 authored by Chris Lamb's avatar Chris Lamb :eyes:
Browse files

Ignore errors when listing .ar archives. (Closes: Debian:#1085257)

parent 7b46ad67
No related branches found
No related tags found
No related merge requests found
Pipeline #751675 passed
......@@ -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",
......
......@@ -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.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment