From dev-return-95861-archive-asf-public=cust-asf.ponee.io@httpd.apache.org Thu Jun 3 08:03:20 2021 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mxout1-ec2-va.apache.org (mxout1-ec2-va.apache.org [3.227.148.255]) by mx-eu-01.ponee.io (Postfix) with ESMTPS id 72FAF180643 for ; Thu, 3 Jun 2021 10:03:20 +0200 (CEST) Received: from mail.apache.org (mailroute1-lw-us.apache.org [207.244.88.153]) by mxout1-ec2-va.apache.org (ASF Mail Server at mxout1-ec2-va.apache.org) with SMTP id C2147418A2 for ; Thu, 3 Jun 2021 08:03:18 +0000 (UTC) Received: (qmail 6159 invoked by uid 500); 3 Jun 2021 08:03:18 -0000 Mailing-List: contact dev-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list dev@httpd.apache.org Received: (qmail 6149 invoked by uid 99); 3 Jun 2021 08:03:17 -0000 Received: from spamproc1-he-de.apache.org (HELO spamproc1-he-de.apache.org) (116.203.196.100) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Jun 2021 08:03:17 +0000 Received: from localhost (localhost [127.0.0.1]) by spamproc1-he-de.apache.org (ASF Mail Server at spamproc1-he-de.apache.org) with ESMTP id 342A01FF4B7 for ; Thu, 3 Jun 2021 08:03:17 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamproc1-he-de.apache.org X-Spam-Flag: NO X-Spam-Score: 0.499 X-Spam-Level: X-Spam-Status: No, score=0.499 tagged_above=-999 required=6.31 tests=[KHOP_HELO_FCRDNS=0.399, NICE_REPLY_A=-0.001, POISEN_SPAM_PILL_3=0.1, RCVD_IN_MSPIKE_H2=-0.001, SPF_NONE=0.001, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-he-de.apache.org ([116.203.227.195]) by localhost (spamproc1-he-de.apache.org [116.203.196.100]) (amavisd-new, port 10024) with ESMTP id onMAU63Huo98 for ; Thu, 3 Jun 2021 08:03:16 +0000 (UTC) Received-SPF: None (mailfrom) identity=mailfrom; client-ip=80.12.242.130; helo=smtp.smtpout.orange.fr; envelope-from=christophe.jaillet@wanadoo.fr; receiver= Received: from smtp.smtpout.orange.fr (smtp08.smtpout.orange.fr [80.12.242.130]) by mx1-he-de.apache.org (ASF Mail Server at mx1-he-de.apache.org) with ESMTPS id AABCD7FF84 for ; Thu, 3 Jun 2021 08:03:16 +0000 (UTC) Received: from [192.168.1.18] ([86.243.172.93]) by mwinf5d16 with ME id CY3F2500m21Fzsu03Y3Gt8; Thu, 03 Jun 2021 10:03:16 +0200 X-ME-Helo: [192.168.1.18] X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Thu, 03 Jun 2021 10:03:16 +0200 X-ME-IP: 86.243.172.93 Subject: Re: svn commit: r1890412 - /httpd/site/trunk/content/security/cvejsontohtml.py To: dev@httpd.apache.org References: <20210603063144.AD0BD17E774@svn01-us-east.apache.org> From: Christophe JAILLET Message-ID: <8dcd81a8-1870-94df-5fa5-88beb470c7a2@wanadoo.fr> Date: Thu, 3 Jun 2021 10:03:14 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.2 MIME-Version: 1.0 In-Reply-To: <20210603063144.AD0BD17E774@svn01-us-east.apache.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Le 03/06/2021 à 08:31, jailletc36@apache.org a écrit : > Author: jailletc36 > Date: Thu Jun 3 06:31:44 2021 > New Revision: 1890412 > > URL: http://svn.apache.org/viewvc?rev=1890412&view=rev > Log: > Use natural order sorting, so that 2.4.9 is after 2.4.10 > > (trick found on https://stackoverflow.com/questions/4836710/is-there-a-built-in-function-for-string-natural-sort) > > Modified: > httpd/site/trunk/content/security/cvejsontohtml.py > > Modified: httpd/site/trunk/content/security/cvejsontohtml.py > URL: http://svn.apache.org/viewvc/httpd/site/trunk/content/security/cvejsontohtml.py?rev=1890412&r1=1890411&r2=1890412&view=diff > ============================================================================== > --- httpd/site/trunk/content/security/cvejsontohtml.py (original) > +++ httpd/site/trunk/content/security/cvejsontohtml.py Thu Jun 3 06:31:44 2021 > @@ -66,7 +66,8 @@ for k,v in sorted(entries.items(), key=l > else: > # Otherwise maybe we started doing things like "<2.7.8" > affects.append(ver["version_affected"]+ver["version_value"]) > - affects.sort(reverse=True) > + # Make a natural order sort (i.e. revrite version like 0002.4.8 and 002.4.38) > + affects.sort(reverse=True, key=lambda x: '{0:0>8}'.format(x).lower()) > e['affects'] = ", ".join(affects) > e['timetable'] = []; > for time in cve["timeline"]: > This works better, IMHO, but is still not perfect. For example 2.0.30 is now before 2.2.0 (which was not the case previously) Googling gives some other solution, either with 3rd party module or hand writing a natural sort. I'll leave it to anyone else better than me in python :) So feel free to revert or improve. CJ