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

Christophe Fergeau cfergeau at redhat.com
Mon Dec 10 13:11:26 UTC 2018


On Mon, Dec 10, 2018 at 02:05:06PM +0100, Fabiano Fidêncio wrote:
> 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.

I believe this last paragraph is what I was asking :) If we are trying
to match something which does not have treeinfo defined, we'll be
getting NULL for all the calls (and what I was trying to understand was
if we would be getting NULL values only in odd/invalid databases, or
even in the nominal case, now I understand it's the latter).

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libosinfo/attachments/20181210/766c3b6b/attachment.sig>


More information about the Libosinfo mailing list