Skip to content

Commit

Permalink
* fix: allow extracts on zip files to fail
Browse files Browse the repository at this point in the history
Changes in intel#1181 to check return codes made it so failed extractions
caused cve-bin-tool to halt rather than log an error. This was
particularly a problem for .exe files, which we try to extract as
zipfiles in case they are self-extracting exectables.

Signed-off-by: Terri Oda <terri.oda@intel.com>
  • Loading branch information
terriko committed Jul 29, 2021
1 parent 2d69f84 commit 2603940
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions cve_bin_tool/extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,16 +178,19 @@ async def extract_file_cab(filename, extraction_path):
return 0

@staticmethod
async def extract_file_zip(filename, extraction_path, process_can_fail=False):
async def extract_file_zip(filename, extraction_path, process_can_fail=True):
"""Extract zip files"""
if await aio_inpath("unzip"):
stdout, stderr, _ = await aio_run_command(
["unzip", "-n", "-d", extraction_path, filename]
["unzip", "-n", "-d", extraction_path, filename], proccess_can_fail
)
if stderr or not stdout:
self.logger.warning()
return 1
elif await aio_inpath("7z"):
stdout, stderr, _ = await aio_run_command(["7z", "x", filename])
stdout, stderr, _ = await aio_run_command(
["7z", "x", filename], process_can_fail
)
if stderr or not stdout:
return 1
else:
Expand Down

0 comments on commit 2603940

Please sign in to comment.