Skip to contentSkip to conversation

Pull request

PATCH New Yoann Congal 1 participant 2 messages Jul 30

lore
Share & tools
lore
#0 lore raw

cover Pull request

Fixes to improve the local CVE database reliability. Even if the branch
is EOL, the CVE metrics is the only part we maintain.
Should fix 15660 – [kirkstone, scarthgap] AB-INT: cve-update-nvd2-native-1.0-r0 do_fetch: CVE database update failed
https://bugzilla.yoctoproject.org/show_bug.cgi?id=15660

The following changes since commit 51259c7e933a2ac8ebc01604d6e65607b76b7b56:

build-appliance-image: Update to kirkstone head revision (2026-04-10 14:14:10 +0100)

are available in the Git repository at:

https://git.openembedded.org/openembedded-core-contrib stable/kirkstone-next
https://git.openembedded.org/openembedded-core-contrib/log/?h=stable/kirkstone-next

for you to fetch changes up to 9687b9409d3a1e121f0f04de856055764d0a392e:

cve-update: Avoid NFS caching issues (2026-07-31 01:06:35 +0200)

----------------------------------------------------------------

Paul Barker (1):
cve-update: Avoid NFS caching issues

 meta/recipes-core/meta/cve-update-db-native.bb   | 9 +++++++--
 meta/recipes-core/meta/cve-update-nvd2-native.bb | 9 +++++++--
 2 files changed, 14 insertions(+), 4 deletions(-)
#1 lore raw

PATCH 1/1 cve-update: Avoid NFS caching issues

From: Paul Barker <[email protected]>

When moving the updated CVE database file to the downloads directory, ensure that it has a different inode number to the previous version of this file.

We have seen "sqlite3.DatabaseError: database disk image is malformed" exceptions on our autobuilder when trying to read the CVE database in do_cve_check tasks. The context here is that the downloads directory (where the updated database file is copied to) is shared between workers as an NFS mount. Different autobuilder workers were seeing different checksums for the database file, which indicates that a mix of both new and stale data was being read. Forcing each new version of the database file to have a different inode number will prevent stale data from being read from local caches.

This should fix [YOCTO #16086].

(cherry picked from commit f63622bbec1cfaca6d0b3e05e11466e4c10fa86e)
[YC: backported to also fix [YOCTO #15660] ]
---
 meta/recipes-core/meta/cve-update-db-native.bb   | 9 +++++++--
 meta/recipes-core/meta/cve-update-nvd2-native.bb | 9 +++++++--
 2 files changed, 14 insertions(+), 4 deletions(-)
meta/recipes-core/meta/cve-update-db-native.bb +7 -2
index e042e67b09a..d6a3cf0dd66 100644
@@ -64,8 +64,13 @@ python do_fetch() {
         shutil.copy2(db_file, db_tmp_file)
 
     if update_db_file(db_tmp_file, d) == True:
-        # Update downloaded correctly, can swap files
-        shutil.move(db_tmp_file, db_file)
+        # Update downloaded correctly, we can swap files. To avoid potential
+        # NFS caching issues, ensure that the destination file has a new inode
+        # number. We do this in two steps as the downloads directory may be on
+        # a different filesystem to tmpdir we're working in.
+        new_file = "%s.new" % (db_file)
+        shutil.move(db_tmp_file, new_file)
+        os.rename(new_file, db_file)
     else:
         # Update failed, do not modify the database
         bb.note("CVE database update failed")
meta/recipes-core/meta/cve-update-nvd2-native.bb +7 -2
index d50d9a2ceaf..f9d265479d9 100644
@@ -83,8 +83,13 @@ python do_fetch() {
         shutil.copy2(db_file, db_tmp_file)
 
     if update_db_file(db_tmp_file, d, database_time) == True:
-        # Update downloaded correctly, can swap files
-        shutil.move(db_tmp_file, db_file)
+        # Update downloaded correctly, we can swap files. To avoid potential
+        # NFS caching issues, ensure that the destination file has a new inode
+        # number. We do this in two steps as the downloads directory may be on
+        # a different filesystem to tmpdir we're working in.
+        new_file = "%s.new" % (db_file)
+        shutil.move(db_tmp_file, new_file)
+        os.rename(new_file, db_file)
     else:
         # Update failed, do not modify the database
         bb.warn("CVE database update failed")