From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH] dpdk-devbind.py: remove module search corner cases Date: Tue, 02 May 2017 00:01:14 +0200 Message-ID: <3119012.hFVryfW1nx@xps> References: <1493665749-10733-1-git-send-email-mark.asselstine@windriver.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev@dpdk.org To: Mark Asselstine Return-path: Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id 95C815942 for ; Tue, 2 May 2017 00:01:16 +0200 (CEST) In-Reply-To: <1493665749-10733-1-git-send-email-mark.asselstine@windriver.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 01/05/2017 21:09, Mark Asselstine: > The existing code used to search for module files via modinfo has > several corner cases which can result in it failing where it should be > successful. > > The call to lower() would cause results returned by 'modinfo' to be > forced to lowercase, results which were subsequently passed to > exists() which is case sensitive. This was most likely done to capture > all variants of failure strings modinfo might return > (ie. ERROR/Error/error/...) without thought negative effect to the > later call to exists(). For many this is a nonissue but if the module > path included non-lowercase alpha characters, something which is > easily possible with a non-lowercase kernel-extraversion string, this > would cause an issue. > > We could move the call to lower() to the check for "error" but this > still leaves possible corner cases, for modules or module paths with > 'error' in them. > > Instead we will prevent modinfo's stderr from being used as a "good > value" for path, meaning we either get a valid path from modinfo, or > nothing at all. This removes all corner cases. > > Ultimately these preliminary checks are unnecessary as exists() will > only return True if it is passed a valid path, passing it modinfo's > stderr would fail. In keeping with the original code, however, we do > some preliminary checks, but we are now free of corner cases. > > Signed-off-by: Mark Asselstine Good explanation and good fix. Applied, thanks and welcome