Skip to content

Guarantee valid JSON in QMP, even for nonfinite numbers

Eric Blake qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 13 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4qobject: Correct JSON lexer grammar commentsqobject/json-lexer.c+16 -54 replies
2/4checkpatch: There is no qemu_strtod()scripts/checkpatch.pl+1 -12 replies
3/4qobject: Parse non-finite numbers, as an extensiondocs/qmp-spec.txt qobject/json-lexer.c qobject/json-parser.c +1 more+79 -154 replies
4/4qobject: Output valid JSON for non-finite numbersdocs/qmp-spec.txt qobject/qjson.c tests/check-qjson.c+18 -103 replies

Reviews trailers per patch

2 of 4 patches have a Reviewed-by or Acked-by.

PatchMarkus Armbruster
1/4R-b
2/4R-b
3/4
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [Qemu-devel] [PATCH 0/4] Guarantee valid JSON in QMP, even for nonfinite numbers

Flesh out an idea that came up during my JSON visitor series. Semantic errors are nicer than lexical errors. While we generally consider any non-finite number a bug in our code (that is, we don't plan to expose them over QMP), at least we can guarantee that even with a bug in our code we are still giving the user valid JSON, similar to how we convert non-UTF-8 byte sequences to use the replacement character for valid UTF-8 output.

I hit a couple of checkpatch false negatives in while writing this series; one was easy to fix, but the other stumped me. It doesn't help that checkpatch tweaks also trigger checkpatch warnings...

Eric Blake (4):
qobject: Correct JSON lexer grammar comments
checkpatch: There is no qemu_strtod()
qobject: Parse non-finite numbers, as an extension
qobject: Output valid JSON for non-finite numbers

 qobject/json-lexer.c  | 32 ++++++++++++++++++++-------
 qobject/json-parser.c | 13 +++++++++--
 qobject/qjson.c       | 15 ++++++++++---
 tests/check-qjson.c   | 61 ++++++++++++++++++++++++++++++++++++++++++++-------
 docs/qmp-spec.txt     |  4 ++++
 scripts/checkpatch.pl |  2 +-
 6 files changed, 105 insertions(+), 22 deletions(-)
Signature · 1 line
2.5.5