[kernel-sec-discuss] r4830 - scripts

Ben Hutchings benh at moszumanska.debian.org
Tue Jan 3 19:52:47 UTC 2017


Author: benh
Date: 2017-01-03 19:52:46 +0000 (Tue, 03 Jan 2017)
New Revision: 4830

Modified:
   scripts/filter-active.py
Log:
scripts/filter-active.py: Fix sorting of CVE IDs with last part >= 10000


Modified: scripts/filter-active.py
===================================================================
--- scripts/filter-active.py	2017-01-02 01:52:10 UTC (rev 4829)
+++ scripts/filter-active.py	2017-01-03 19:52:46 UTC (rev 4830)
@@ -47,13 +47,17 @@
         if p.match(issue):
             return True
     return False
-        
+
+# Pad last part of CVE ID to 6 digits so string comparison keeps working
+def pad_cve_id(cve_id):
+    return re.sub(r'-(\d+)$', lambda m: '-%06d' % int(m.group(1)), cve_id)
+
 def get_issues(dir):
     issues = []
     L = [f for f in os.listdir(dir)
          if not os.path.isdir(os.path.join(dir, f))
          and not ignore_issue_name(f)]
-    L.sort()
+    L.sort(key=pad_cve_id)
 
     return [ issue(os.path.join(dir, f)) for f in L ]
 




More information about the kernel-sec-discuss mailing list