On Tue, May 15, 2018 at 05:24:40PM +0100, Daniel P. Berrangé wrote:
On Tue, May 15, 2018 at 06:12:05PM +0200, Andrea Bolognani wrote:On Fri, 2018-05-11 at 14:59 +0200, Ján Tomko wrote: > Per the discussion here: > https://www.redhat.com/archives/libvir-list/2017-November/msg00225.html > Switch from using yajl to Jansson. I tried building https://repo.or.cz/libvirt/jtomko.git/ jansson on all platform libvirt supports. Debian 8, Ubuntu 14.04 and Ubuntu 16.04 all linked successfully against Jansson, but when running the test suite I got FAIL: virnetdaemontest FAIL: qemumonitorjsontest FAIL: qemucapabilitiestest FAIL: qemuhotplugtest FAIL: qemucommandutiltest FAIL: qemublocktest FAIL: qemumigparamstest FAIL: virjsontest >From a quick look, it seems like at least some of the failures are caused by dictionaries and arrays having their members shuffled around.When using YAJL, object properties are stored in arrays, so order is stable when printing. With Jansson, object properties appear to be stored in hash tables, so order is potentially unstable when printing. I'm a little surprised it doesn't fail on all platforms - makes me wonder how good the hash function is. Looks like we would need JSON_SORT_KEYS to json_dumps(), but that may well require all test data to be recreated :-(
There is a JSON_PRESERVE_ORDER flag since v1.3 that formats the keys in the same order they were added and it's the default since 2.8. I have pushed a patch that uses it on my repo: https://repo.or.cz/libvirt/jtomko.git/ jansson_preserve Jano
Attachment:
signature.asc
Description: Digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list