Bug 13682 - cve-check might end up with read-only database when bitbake was interrupted with double Control-C
Summary: cve-check might end up with read-only database when bitbake was interrupted w...
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: devtools / tool chain (show other bugs)
Version: unspecified
Hardware: All Multiple
: Medium normal
Target Milestone: 3.1
Assignee: Chee Yang
QA Contact:
URL:
Whiteboard: cve-check.bbclass
Depends on:
Blocks:
 
Reported: 2019-12-05 12:45 UTC by Adrian Bunk
Modified: 2020-04-02 06:11 UTC (History)
4 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Bunk 2019-12-05 12:45:03 UTC
Aborting a build during CVE database download with double Control-C sometimes leads to:

ERROR: nspr-native-4.23-r0 do_cve_check: Error executing a python function in exec_python_func() autogenerated:

The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_python_func() autogenerated', lineno: 2, function: <module>
     0001:
 *** 0002:do_cve_check(d)
     0003:
File: '/home/bunk/yoctomaster/yocto-test/sources/poky/meta/classes/cve-check.bbclass', lineno: 56, function: do_cve_check
     0052:    """
     0053:
     0054:    if os.path.exists(d.getVar("CVE_CHECK_DB_FILE")):
     0055:        patched_cves = get_patches_cves(d)
 *** 0056:        patched, unpatched = check_cves(d, patched_cves)
     0057:        if patched or unpatched:
     0058:            cve_data = get_cve_info(d, patched + unpatched)
     0059:            cve_write_data(d, patched, unpatched, cve_data)
     0060:    else:
File: '/home/bunk/yoctomaster/yocto-test/sources/poky/meta/classes/cve-check.bbclass', lineno: 200, function: check_cves
     0196:        else:
     0197:            vendor = "%"
     0198:
     0199:        # Find all relevant CVE IDs.
 *** 0200:        for cverow in conn.execute("SELECT DISTINCT ID FROM PRODUCTS WHERE PRODUCT IS ? AND VENDOR LIKE ?", (product, vendor)):
     0201:            cve = cverow[0]
     0202:
     0203:            if cve in cve_whitelist:
     0204:                bb.note("%s-%s has been whitelisted for %s" % (product, pv, cve))
Exception: sqlite3.OperationalError: attempt to write a readonly database


It would be good if old files were removed first since they might be in a partially updated state.