diff options
author | Ben Hutchings <benh@debian.org> | 2017-01-03 19:52:46 +0000 |
---|---|---|
committer | Ben Hutchings <benh@debian.org> | 2017-01-03 19:52:46 +0000 |
commit | 279c28bd5c5cafdc28e3bdb02498795fc5592062 (patch) | |
tree | 59dfd7c9f995e367a69512020c00faff886bb2fd /scripts | |
parent | 8c6842d942fa5af210f56df981dad132376e1e86 (diff) |
scripts/filter-active.py: Fix sorting of CVE IDs with last part >= 10000
git-svn-id: svn+ssh://svn.debian.org/svn/kernel-sec@4830 e094ebfe-e918-0410-adfb-c712417f3574
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/filter-active.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/scripts/filter-active.py b/scripts/filter-active.py index de7ca541..97145d77 100755 --- a/scripts/filter-active.py +++ b/scripts/filter-active.py @@ -47,13 +47,17 @@ def ignore_issue_name(issue): 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 ] |