[libvirt] Should we switch to a different JSON library?

Pino Toscano ptoscano at redhat.com
Wed Feb 14 16:43:00 UTC 2018


On Monday, 12 February 2018 19:47:00 CET Ján Tomko wrote:
> On Mon, Feb 12, 2018 at 02:38:02PM +0100, Pino Toscano wrote:
> >On Tuesday, 7 November 2017 14:05:25 CET Martin Kletzander wrote:
> >>  - Jansson [3] - I really like this one.  The API seems very intuitive,
> >>                  it has nice documentation [4] in readthedocs (and I'm
> >>                  not talking about the visual style, but how easy is to
> >>                  find information), it can be used for formatting JSON
> >>                  in a similar way we are doing it.  It has json_auto_t
> >>                  (optional) type that uses the attribute cleanup for
> >>                  automatic scope dereference (just in case we want to
> >>                  use it), it has iterators... did I tell you I like this
> >>                  one a lot?
> >>
> >> What do you (others) think of switching the JSON library?  Do you know
> >> about any other projects that could be used considering license,
> >> platform support, etc.?  Also feel free to fix any mistakes I might have
> >> posted.  I double-checked it, but you know, "trust, but verify".
> >
> >FYI: libguestfs just switched to Jansson [1], so any version starting
> >from 1.39.1 will use it instead of Yajl.  In case of libguestfs, yajl
> >was used directly, without wrappers of any sort, and the switch was
> >straightforward.
> >
> >[1] https://github.com/libguestfs/libguestfs/commit/bd1c5c9f4dcf38458099db8a0bf4659a07ef055d
> >
> 
> I do have a working virjson.c implementation in my local git waiting to be
> polished and sent. The issues with libvirt were:
> * virjson.c storing numbers as a string
> * backwards compatibility (AFAIK we want to support building on
>   RHEL/CentOS 6, which did not have recent enough jansson - for the
>   _foreach macros, at least 2.5 is needed)
>   If we really need to maintain two implementations side-by-side,
>   one of them should have an expiration date.

RHEL/CentOS 6 do not seem to have jansson -- it's in EPEL, and its
version there is 2.9.
RHEL/CentOS 7 have jansson 2.10.

> I don't see any version check in that libguestfs commit, what are the
> compatibility requirements there?

I though the APIs we used were old enough, but apparently not for an
old distro I still had around (Mageia 5, EOL).  I just bumped the
minimum requirement in libguestfs to 2.7, which is old enough, and
IMHO good enough as baseline; see
https://repology.org/metapackage/jansson/versions

-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180214/ecce7a05/attachment-0001.sig>


More information about the libvir-list mailing list