numam-dpdk/usertools
Mark Asselstine df86b009dd usertools: remove devbind module search corner cases
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 <mark.asselstine@windriver.com>
2017-05-01 23:58:31 +02:00
..
cpu_layout.py usertools: fix CPU layout for more than 2 threads 2017-04-30 15:28:01 +02:00
dpdk-devbind.py usertools: remove devbind module search corner cases 2017-05-01 23:58:31 +02:00
dpdk-pmdinfo.py tools: move to usertools 2017-01-04 21:17:32 +01:00
dpdk-setup.sh tools: move to usertools 2017-01-04 21:17:32 +01:00