From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932332AbcFOHuY (ORCPT ); Wed, 15 Jun 2016 03:50:24 -0400 Received: from mx2.suse.de ([195.135.220.15]:35511 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752869AbcFOHuO (ORCPT ); Wed, 15 Jun 2016 03:50:14 -0400 Subject: Re: [PATCH 2/4] scripts: add reqs python library To: "Luis R. Rodriguez" References: <1465942217-14452-1-git-send-email-mcgrof@kernel.org> <1465942217-14452-3-git-send-email-mcgrof@kernel.org> Cc: Julia.Lawall@lip6.fr, Gilles.Muller@lip6.fr, nicolas.palix@imag.fr, linux-kernel@vger.kernel.org, cocci@systeme.lip6.fr From: Michal Marek Message-ID: <576108B3.30008@suse.com> Date: Wed, 15 Jun 2016 09:50:11 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <1465942217-14452-3-git-send-email-mcgrof@kernel.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2016-06-15 00:10, Luis R. Rodriguez wrote: > + weight = (int(rel_specs['VERSION']) << 32) + \ > + (int(rel_specs['PATCHLEVEL']) << 16) + \ > + (sublevel << 8 ) + \ > + (extra * 60) + (relmod * 2) This is going to silently break as soon as we have a version number with e.g. a time stamp embedded. And there is actually no need to convert the version string to an integer. You can convert them to arrays of components and compare the components one by one. Michal From mboxrd@z Thu Jan 1 00:00:00 1970 From: mmarek@suse.com (Michal Marek) Date: Wed, 15 Jun 2016 09:50:11 +0200 Subject: [Cocci] [PATCH 2/4] scripts: add reqs python library In-Reply-To: <1465942217-14452-3-git-send-email-mcgrof@kernel.org> References: <1465942217-14452-1-git-send-email-mcgrof@kernel.org> <1465942217-14452-3-git-send-email-mcgrof@kernel.org> Message-ID: <576108B3.30008@suse.com> To: cocci@systeme.lip6.fr List-Id: cocci@systeme.lip6.fr On 2016-06-15 00:10, Luis R. Rodriguez wrote: > + weight = (int(rel_specs['VERSION']) << 32) + \ > + (int(rel_specs['PATCHLEVEL']) << 16) + \ > + (sublevel << 8 ) + \ > + (extra * 60) + (relmod * 2) This is going to silently break as soon as we have a version number with e.g. a time stamp embedded. And there is actually no need to convert the version string to an integer. You can convert them to arrays of components and compare the components one by one. Michal