All of lore.kernel.org
 help / color / mirror / Atom feed
* A brief look at deprecating our JSON extensions over RFC 8259
@ 2021-02-22 14:57 Markus Armbruster
  2021-02-22 15:10 ` Peter Krempa
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Markus Armbruster @ 2021-02-22 14:57 UTC (permalink / raw)
  To: qemu-devel
  Cc: libvir-list, Peter Maydell, John Snow, Daniel P. Berrangé,
	Paolo Bonzini

We use JSON in several external interfaces:

* QMP

* The guest agent's QMP

* QAPIfied command line options when the option argument starts with
  '{'

* The block layer's pseudo-protocol "json:" (which can get embedded in
  image headers)

I *think* that's all.

The JSON parser we use for these interfaces supports extensions over RFC
8259.  Quoting json-lexer.c:

    - Extra escape sequence in strings:
      0x27 (apostrophe) is recognized after escape, too

    - Single-quoted strings:
      Like double-quoted strings, except they're delimited by %x27
      (apostrophe) instead of %x22 (quotation mark), and can't contain
      unescaped apostrophe, but can contain unescaped quotation mark.

    - Interpolation, if enabled:
      The lexer accepts %[A-Za-z0-9]*, and leaves rejecting invalid
      ones to the parser.

Ignore interpolation; it's never enabled at external interfaces.

This leaves single-quotes strings and the escape sequence to go with
them.

I disabled them as an experiment.  Some 20 iotests, a qtest and two unit
tests explode.

The unit test testing the JSON parser is of course excused.

The remaining qtest and the unit test could perhaps be dismissed as
atypical use of QEMU from C.  The iotests less so, I think.

I looked at some iotest failures, and quickly found single-quoted
strings used with all external interfaces except for qemu-ga's QMP.

We could certainly tidy up the tests to stick to standard JSON.
However, the prevalence of single-quoted strings in iotests makes me
suspect that they are being used in the field as well.  Deprecating the
extension is likely more trouble than it's worth.

Opinions?



^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2021-02-23 12:44 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-22 14:57 A brief look at deprecating our JSON extensions over RFC 8259 Markus Armbruster
2021-02-22 15:10 ` Peter Krempa
2021-02-22 15:24 ` Daniel P. Berrangé
2021-02-22 15:43   ` Liviu Ionescu
2021-02-22 17:47   ` Paolo Bonzini
2021-02-22 17:54     ` Daniel P. Berrangé
2021-02-22 18:06       ` Paolo Bonzini
2021-02-23  9:31       ` Markus Armbruster
2021-02-23  9:37         ` Markus Armbruster
2021-02-23 11:03         ` Peter Maydell
2021-02-23 12:43           ` Markus Armbruster
2021-02-23  9:06     ` Markus Armbruster
2021-02-23 10:59       ` Paolo Bonzini
2021-02-23 12:34         ` Markus Armbruster
2021-02-22 17:42 ` Paolo Bonzini
2021-02-22 18:01   ` Daniel P. Berrangé
2021-02-22 18:22   ` Peter Krempa
2021-02-22 18:25     ` Peter Krempa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.