diff options
author | Salvatore Bonaccorso <carnil@debian.org> | 2021-02-27 16:14:00 +0100 |
---|---|---|
committer | Salvatore Bonaccorso <carnil@debian.org> | 2021-02-27 16:14:00 +0100 |
commit | c26b13fca65cec28f42e0c52a57147d381680aa7 (patch) | |
tree | 3e0f9972f986fcc68b2d2126212d0a1956b0f679 /lib | |
parent | 6acbac3e58468068cb67a2442f53464927cd64be (diff) | |
parent | 165d747f44d7f859c26f4a78804a108c9a998520 (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.py | 9 |
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): |