From a81067329d81882d0b8feff1eee1f48c85aa1cf4 Mon Sep 17 00:00:00 2001 From: Emilio Pozuelo Monfort Date: Thu, 27 Jan 2022 18:36:55 +0100 Subject: remove-cve-dist-tags: remove empty CVE entries This can happen in ExtendFiles if they only contain dist tags that are being removed. --- bin/remove-cve-dist-tags | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'bin') diff --git a/bin/remove-cve-dist-tags b/bin/remove-cve-dist-tags index 6e8d7214eb..18db2a0257 100755 --- a/bin/remove-cve-dist-tags +++ b/bin/remove-cve-dist-tags @@ -56,6 +56,12 @@ for cve in data: if keep_annotation(cve, annotation) ) cve = cve._replace(annotations=annotations) + if not cve.annotations: + # this shouldn't happen on a normal CVE file as we're only removing + # the dist specific tags, but it may happen in an ExtendFile, in + # which case we don't want to keep an empty CVE entry + continue + new_data.append(cve) with open(main_list, 'w') as f: -- cgit v1.2.3