On Sat, Nov 8, 2014 at 2:08 AM, Joshua M. Clulow <j...@sysmgr.org> wrote:

> Hi Yacine,
>
> On 7 November 2014 10:56, Yacine Kheddache <yacine.khedda...@alyseo.com>
> wrote:
> > Please check this out and let us know what you are thinking about it :
> > https://github.com/Alyseo/zfs/tree/json
>
> I took a look at the code.  I like that the entire JSON object appears
> on one line, in keeping with the popular pattern of
> "linefeed-delimited JSON" used by tools like bunyan[1].  I think the
> output would be better without the needless whitespace between keys,
> values, colons, etc.
>

Yes agree, this has been fixed (see github).


> I think there's a deeper problem with this relatively simplistic
> approach to generating JSON: the encoding of non-printing characters,
> or characters beyond the 7-bit ASCII space.  You really need to escape
> both key and value strings, and possibly deal with locales, etc.  The
> safest subset of UTF-8 for use here is 7-bit ASCII, with numeric
> escape sequences for characters beyond that in the Basic Multilingual
> Plane.
>

We did not see when this could happen (especially on ZoL), ex :
# zpool create daté sdk sdj
cannot create 'daté': invalid character '�' in pool name
pool name may have been omitted

What is the use case here and when could it happen ?


> I know Robert mentioned to you earlier that we already have code in
> libnvpair, and thus available to OpenZFS in general, to take an
> nvlist_t and emit it as JSON.  This code does deal (at least
> minimally) with the escaping of strings:
>
>
> https://github.com/joyent/illumos-joyent/blob/master/usr/src/lib/libnvpair/nvpair_json.c#L29-L109
>

This is still under investigation and we have not decided yet, let's select
and all agree on the "easiest"
and better solution for mid & long term.


> I like the idea in general, we just need to agree on a correct and
> well-specified output format (and implementation) if we are
> introducing new Public flags to zpool(1M) and zfs(1M) -- especially as
> this output is for programmatic consumption.
>

100% agree this is exactly why we have created this thread and have push
code samples on github.

Thank you
Regards,
Goulven & Yacine @Alyseo
_______________________________________________
developer mailing list
developer@open-zfs.org
http://lists.open-zfs.org/mailman/listinfo/developer

Reply via email to