@@ -78,8 +78,13 @@ python do_fetch() {
shutil.copy2(db_file, db_tmp_file)
if update_db_file(db_tmp_file, d):
- # 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")
@@ -93,8 +93,13 @@ python do_fetch() {
shutil.copy2(db_file, db_tmp_file)
if update_db_file(db_tmp_file, d, database_time):
- # 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")