]> code.ossystems Code Review - openembedded-core.git/commitdiff
cve-check: get_cve_info should open the database read-only
authorRoss Burton <ross@burtonini.com>
Wed, 23 Feb 2022 12:54:31 +0000 (12:54 +0000)
committerSteve Sakoman <steve@sakoman.com>
Thu, 3 Mar 2022 17:43:07 +0000 (07:43 -1000)
All of the function in cve-check should open the database read-only, as
the only writer is the fetch task in cve-update-db.  However,
get_cve_info() was failing to do this, which might be causing locking
issues with sqlite.

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 8de517238f1f418d9af1ce312d99de04ce2e26fc)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
meta/classes/cve-check.bbclass

index 6b627464a0c0e1cc7b0b05a6f1ca29fd734df3b7..5369b7074c65b7101be2393a0670d270ebd6f5a8 100644 (file)
@@ -323,7 +323,8 @@ def get_cve_info(d, cves):
     import sqlite3
 
     cve_data = {}
-    conn = sqlite3.connect(d.getVar("CVE_CHECK_DB_FILE"))
+    db_file = d.expand("file:${CVE_CHECK_DB_FILE}?mode=ro")
+    conn = sqlite3.connect(db_file, uri=True)
 
     for cve in cves:
         for row in conn.execute("SELECT * FROM NVD WHERE ID IS ?", (cve,)):