mirror of
https://git.yoctoproject.org/poky
synced 2026-06-01 00:59:48 +00:00
cve-check: fail gracefully when file not found
With out these changes, a traceback displayed when a file is listed in the SRC_URI but the file does not exist. raise FileNotFoundError and print the patch then mark the task as failed. (From OE-Core rev: d4926c11a4ab9148bdb640a9367c9e1891491a5b) Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
56fa7845a4
commit
8fb7fbcb98
@@ -52,7 +52,10 @@ python do_cve_check () {
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
if os.path.exists(d.getVar("CVE_CHECK_DB_FILE")):
|
if os.path.exists(d.getVar("CVE_CHECK_DB_FILE")):
|
||||||
patched_cves = get_patches_cves(d)
|
try:
|
||||||
|
patched_cves = get_patches_cves(d)
|
||||||
|
except FileNotFoundError:
|
||||||
|
bb.fatal("Failure in searching patches")
|
||||||
patched, unpatched = check_cves(d, patched_cves)
|
patched, unpatched = check_cves(d, patched_cves)
|
||||||
if patched or unpatched:
|
if patched or unpatched:
|
||||||
cve_data = get_cve_info(d, patched + unpatched)
|
cve_data = get_cve_info(d, patched + unpatched)
|
||||||
@@ -129,6 +132,10 @@ def get_patches_cves(d):
|
|||||||
for url in src_patches(d):
|
for url in src_patches(d):
|
||||||
patch_file = bb.fetch.decodeurl(url)[2]
|
patch_file = bb.fetch.decodeurl(url)[2]
|
||||||
|
|
||||||
|
if not os.path.isfile(patch_file):
|
||||||
|
bb.error("File Not found: %s" % patch_file)
|
||||||
|
raise FileNotFoundError
|
||||||
|
|
||||||
# Check patch file name for CVE ID
|
# Check patch file name for CVE ID
|
||||||
fname_match = cve_file_name_match.search(patch_file)
|
fname_match = cve_file_name_match.search(patch_file)
|
||||||
if fname_match:
|
if fname_match:
|
||||||
|
|||||||
Reference in New Issue
Block a user