[Libosinfo] [libosinfo PATCH 3/3] db: improve _guess_os_from_tree checks

Fabiano Fidêncio fidencio at redhat.com
Mon Dec 10 13:05:06 UTC 2018


On Mon, Dec 10, 2018 at 1:57 PM Christophe Fergeau <cfergeau at redhat.com> wrote:
>
> Hey,
>
> On Sun, Dec 02, 2018 at 04:37:59PM +0100, Fabiano Fidêncio wrote:
> > Do not check against a distro that has all the treeinfo attribute as
> > NULL as match_regex() would just match whatever we compare to it.
>
> When can this happen?

When testing *any* distro :-)

For instance, in osinfo_db_guess_from_os_tree() we go through the list
of OSes testing against the one we passed, right? So, here the one
passed is the "regex" for the match_regex() and the info we get from
the OS is the "pattern".
Considering this ... we end up testing, for instance, against Fedora 6
which doesn't have the treeinfo fields. Then, if you take a look at
match_regex() code, you'll find out that we just return "true" in case
the pattern is NULL.

So, in the end, we should only try to match the treeinfo when the
system we're trying to match to provides treeinfo.

[snip]




More information about the Libosinfo mailing list