summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSalvatore Bonaccorso <carnil@debian.org>2021-02-27 16:14:00 +0100
committerSalvatore Bonaccorso <carnil@debian.org>2021-02-27 16:14:00 +0100
commitf72d124e15df4d654960854613ae06d46eecdba6 (patch)
tree0fb8dbe4e165504500a9c9f645cd77c5525662ea /lib
parentb46bca4dc6f2fe204db071906e5c462b7171c9ae (diff)
parentd2f3228e1ae5ce34c63115b1a3a67019276fc74b (diff)
Merge branch 'beuc/security-tracker-natsort'
tracker_service: display CVE entries using natural sort order See merge request security-tracker-team/security-tracker!76
Diffstat (limited to 'lib')
-rw-r--r--lib/python/security_db.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/python/security_db.py b/lib/python/security_db.py
index d501feefda..26d1d61aca 100644
--- a/lib/python/security_db.py
+++ b/lib/python/security_db.py
@@ -138,7 +138,14 @@ BugsForSourcePackage_query = \
JOIN source_packages sp ON (st.package = sp.rowid)
WHERE sp.name = ?
AND (bugs.name LIKE 'CVE-%' OR bugs.name LIKE 'TEMP-%')
- ORDER BY bugs.name DESC, sp.release"""
+ ORDER BY
+ -- 'COLLATE natorder' emulation, using 0-padding (MR#76)
+ -- e.g. CVE-2016-1000393 -> CVE-2016-0001000393
+ CASE substr(bugs.name,1,3)
+ WHEN 'CVE' THEN
+ substr(bugs.name,1,9) || substr("0000000000"||substr(bugs.name, 10, 10), -10)
+ ELSE bugs.name
+ END DESC, sp.release"""
# Sort order is important for the groupby operation below.
def getBugsForSourcePackage(cursor, pkg):

© 2014-2024 Faster IT GmbH | imprint | privacy policy