1 diff -urNpa libvirt-4.6.0.orig/config-post.h libvirt-4.6.0/config-post.h
2 --- libvirt-4.6.0.orig/config-post.h 2018-07-28 13:26:44.376463865 +0000
3 +++ libvirt-4.6.0/config-post.h 2018-08-20 18:00:20.571398013 +0000
6 # undef WITH_DTRACE_PROBES
14 # undef WITH_SYSTEMD_DAEMON
15 # undef WITH_VIRTUALPORT
21 diff -urNpa libvirt-4.6.0.orig/configure.ac libvirt-4.6.0/configure.ac
22 --- libvirt-4.6.0.orig/configure.ac 2018-07-28 13:26:44.376463865 +0000
23 +++ libvirt-4.6.0/configure.ac 2018-08-20 18:01:24.611397292 +0000
24 @@ -250,7 +250,6 @@ LIBVIRT_ARG_FIREWALLD
32 @@ -291,7 +290,6 @@ LIBVIRT_CHECK_FUSE
36 -LIBVIRT_CHECK_JANSSON
38 LIBVIRT_CHECK_LIBPARTED
40 @@ -972,7 +970,6 @@ LIBVIRT_RESULT_FUSE
41 LIBVIRT_RESULT_GLUSTER
44 -LIBVIRT_RESULT_JANSSON
46 LIBVIRT_RESULT_LIBPCAP
48 diff -urNpa libvirt-4.6.0.orig/libvirt.spec.in libvirt-4.6.0/libvirt.spec.in
49 --- libvirt-4.6.0.orig/libvirt.spec.in 2018-08-02 03:58:35.025820949 +0000
50 +++ libvirt-4.6.0/libvirt.spec.in 2018-08-20 18:00:20.572398013 +0000
51 @@ -292,7 +292,7 @@ BuildRequires: libblkid-devel >= 2.17
53 BuildRequires: systemd-devel >= 185
54 BuildRequires: libpciaccess-devel >= 0.10.9
55 -BuildRequires: jansson-devel
56 +BuildRequires: yajl-devel
58 BuildRequires: sanlock-devel >= 2.4
60 @@ -898,8 +898,6 @@ Requires: ncurses
62 # Needed by virt-pki-validate script.
63 Requires: gnutls-utils
64 -# We dlopen(libjansson.so.4), so need an explicit dep
66 %if %{with_bash_completion}
67 Requires: %{name}-bash-completion = %{version}-%{release}
69 @@ -1228,7 +1226,7 @@ rm -f po/stamp-po
78 diff -urNpa libvirt-4.6.0.orig/m4/virt-driver-qemu.m4 libvirt-4.6.0/m4/virt-driver-qemu.m4
79 --- libvirt-4.6.0.orig/m4/virt-driver-qemu.m4 2018-07-28 13:26:44.395463693 +0000
80 +++ libvirt-4.6.0/m4/virt-driver-qemu.m4 2018-08-20 18:00:20.572398013 +0000
81 @@ -18,7 +18,7 @@ dnl <http://www.gnu.org/licenses/>.
84 AC_DEFUN([LIBVIRT_DRIVER_ARG_QEMU], [
85 - LIBVIRT_ARG_WITH_FEATURE([QEMU], [QEMU/KVM], [check])
86 + LIBVIRT_ARG_WITH_FEATURE([QEMU], [QEMU/KVM], [yes])
87 LIBVIRT_ARG_WITH([QEMU_USER], [username to run QEMU system instance as],
88 ['platform dependent'])
89 LIBVIRT_ARG_WITH([QEMU_GROUP], [groupname to run QEMU system instance as],
90 @@ -26,13 +26,6 @@ AC_DEFUN([LIBVIRT_DRIVER_ARG_QEMU], [
93 AC_DEFUN([LIBVIRT_DRIVER_CHECK_QEMU], [
94 - AC_REQUIRE([LIBVIRT_CHECK_JANSSON])
95 - if test "$with_qemu:$with_jansson" = "yes:no"; then
96 - AC_MSG_ERROR([Jansson >= 2.5 is required to build QEMU driver])
98 - if test "$with_qemu" = "check"; then
99 - with_qemu=$with_jansson
101 if test "$with_qemu" = "yes" ; then
102 AC_DEFINE_UNQUOTED([WITH_QEMU], 1, [whether QEMU driver is enabled])
104 diff -urNpa libvirt-4.6.0.orig/m4/virt-jansson.m4 libvirt-4.6.0/m4/virt-jansson.m4
105 --- libvirt-4.6.0.orig/m4/virt-jansson.m4 2018-07-28 13:26:44.395463693 +0000
106 +++ libvirt-4.6.0/m4/virt-jansson.m4 1970-01-01 00:00:00.000000000 +0000
108 -dnl The jansson library
110 -dnl This library is free software; you can redistribute it and/or
111 -dnl modify it under the terms of the GNU Lesser General Public
112 -dnl License as published by the Free Software Foundation; either
113 -dnl version 2.1 of the License, or (at your option) any later version.
115 -dnl This library is distributed in the hope that it will be useful,
116 -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
117 -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
118 -dnl Lesser General Public License for more details.
120 -dnl You should have received a copy of the GNU Lesser General Public
121 -dnl License along with this library. If not, see
122 -dnl <http://www.gnu.org/licenses/>.
125 -AC_DEFUN([LIBVIRT_ARG_JANSSON],[
126 - LIBVIRT_ARG_WITH_FEATURE([JANSSON], [jansson], [check])
129 -AC_DEFUN([LIBVIRT_CHECK_JANSSON],[
130 - dnl Jansson http://www.digip.org/jansson/
131 - LIBVIRT_CHECK_PKG([JANSSON], [jansson], [2.5])
132 - dnl Older versions of Jansson did not preserve the order of object keys
133 - dnl use this check to guard the tests that are sensitive to this
134 - LIBVIRT_CHECK_PKG([STABLE_ORDERING_JANSSON], [jansson], [2.8], [true])
137 -AC_DEFUN([LIBVIRT_RESULT_JANSSON],[
138 - LIBVIRT_RESULT_LIB([JANSSON])
140 diff -urNpa libvirt-4.6.0.orig/m4/virt-nss.m4 libvirt-4.6.0/m4/virt-nss.m4
141 --- libvirt-4.6.0.orig/m4/virt-nss.m4 2018-07-28 13:26:44.396463684 +0000
142 +++ libvirt-4.6.0/m4/virt-nss.m4 2018-08-20 18:00:20.572398013 +0000
143 @@ -27,9 +27,9 @@ AC_DEFUN([LIBVIRT_CHECK_NSS],[
146 if test "x$with_nss_plugin" != "xno" ; then
147 - if test "x$with_jansson" != "xyes" ; then
148 + if test "x$with_yajl" != "xyes" ; then
149 if test "x$with_nss_plugin" = "xyes" ; then
150 - AC_MSG_ERROR([Can't build nss plugin without JSON support])
151 + AC_MSG_ERROR([Can't build nss plugin without yajl])
155 diff -urNpa libvirt-4.6.0.orig/m4/virt-yajl.m4 libvirt-4.6.0/m4/virt-yajl.m4
156 --- libvirt-4.6.0.orig/m4/virt-yajl.m4 2018-07-28 13:26:44.396463684 +0000
157 +++ libvirt-4.6.0/m4/virt-yajl.m4 2018-08-20 18:00:20.572398013 +0000
158 @@ -23,10 +23,31 @@ AC_DEFUN([LIBVIRT_ARG_YAJL],[
160 AC_DEFUN([LIBVIRT_CHECK_YAJL],[
161 dnl YAJL JSON library http://lloyd.github.com/yajl/
162 - if test "$with_yajl" = yes; then
163 - AC_MSG_ERROR([Compilation with YAJL is no longer supported])
164 + if test "$with_qemu:$with_yajl" = yes:check; then
165 + dnl Some versions of qemu require the use of yajl; try to detect them
166 + dnl here, although we do not require qemu to exist in order to compile.
167 + dnl This check mirrors src/qemu/qemu_capabilities.c
168 + AC_PATH_PROGS([QEMU], [qemu-kvm qemu kvm qemu-system-x86_64],
169 + [], [$PATH:/usr/bin:/usr/libexec])
170 + if test -x "$QEMU"; then
171 + if $QEMU -help 2>/dev/null | grep -q libvirt; then
174 + [qemu_version_sed='s/.*ersion \([0-9.,]*\).*/\1/']
175 + qemu_version=`$QEMU -version | sed "$qemu_version_sed"`
176 + case $qemu_version in
177 + [[1-9]].* | 0.15.* ) with_yajl=yes ;;
179 + *) AC_MSG_ERROR([Unexpected qemu version string]) ;;
186 + LIBVIRT_CHECK_LIB_ALT([YAJL], [yajl],
187 + [yajl_parse_complete], [yajl/yajl_common.h],
189 + [yajl_tree_parse], [yajl/yajl_common.h])
192 AC_DEFUN([LIBVIRT_RESULT_YAJL],[
193 diff -urNpa libvirt-4.6.0.orig/src/libvirt_private.syms libvirt-4.6.0/src/libvirt_private.syms
194 --- libvirt-4.6.0.orig/src/libvirt_private.syms 2018-08-02 03:58:35.114820107 +0000
195 +++ libvirt-4.6.0/src/libvirt_private.syms 2018-08-20 18:00:20.572398013 +0000
196 @@ -2098,6 +2098,7 @@ virJSONValueNewNumberUint;
197 virJSONValueNewNumberUlong;
198 virJSONValueNewObject;
199 virJSONValueNewString;
200 +virJSONValueNewStringLen;
201 virJSONValueObjectAdd;
202 virJSONValueObjectAddVArgs;
203 virJSONValueObjectAppend;
204 @@ -2135,10 +2136,6 @@ virJSONValueObjectStealObject;
205 virJSONValueToString;
208 -# util/virjsoncompat.h
213 virKeycodeSetTypeFromString;
214 virKeycodeSetTypeToString;
215 diff -urNpa libvirt-4.6.0.orig/src/Makefile.am libvirt-4.6.0/src/Makefile.am
216 --- libvirt-4.6.0.orig/src/Makefile.am 2018-08-02 03:58:35.114820107 +0000
217 +++ libvirt-4.6.0/src/Makefile.am 2018-08-20 18:04:33.691395163 +0000
218 @@ -544,7 +544,7 @@ libvirt_admin_la_CFLAGS = \
219 libvirt_admin_la_CFLAGS += \
222 - $(JANSSON_CFLAGS) \
227 @@ -552,6 +552,7 @@ libvirt_admin_la_CFLAGS += \
229 libvirt_admin_la_LIBADD += \
235 @@ -689,7 +690,6 @@ libvirt_setuid_rpc_client_la_SOURCES = \
239 - util/virjsoncompat.c \
243 @@ -961,8 +961,6 @@ libvirt_nss_la_SOURCES = \
247 - util/virjsoncompat.c \
248 - util/virjsoncompat.h \
252 @@ -996,11 +994,15 @@ libvirt_nss_la_SOURCES = \
253 libvirt_nss_la_CFLAGS = \
256 - $(JANSSON_CFLAGS) \
259 libvirt_nss_la_LDFLAGS = \
263 +libvirt_nss_la_LIBADD = \
269 diff -urNpa libvirt-4.6.0.orig/src/qemu/qemu_driver.c libvirt-4.6.0/src/qemu/qemu_driver.c
270 --- libvirt-4.6.0.orig/src/qemu/qemu_driver.c 2018-07-31 03:31:26.316391201 +0000
271 +++ libvirt-4.6.0/src/qemu/qemu_driver.c 2018-08-20 18:00:20.575398013 +0000
272 @@ -2092,7 +2092,7 @@ qemuDomainReboot(virDomainPtr dom, unsig
275 (ret < 0 && (acpiRequested || !flags))) {
278 virReportError(VIR_ERR_OPERATION_INVALID, "%s",
279 _("ACPI reboot is not supported without the JSON monitor"));
281 diff -urNpa libvirt-4.6.0.orig/src/remote/remote_daemon.c libvirt-4.6.0/src/remote/remote_daemon.c
282 --- libvirt-4.6.0.orig/src/remote/remote_daemon.c 2018-08-02 03:58:35.116820088 +0000
283 +++ libvirt-4.6.0/src/remote/remote_daemon.c 2018-08-20 18:00:20.575398013 +0000
286 #include "virgettext.h"
287 #include "util/virnetdevopenvswitch.h"
288 -#include "virjsoncompat.h"
292 @@ -1184,9 +1183,6 @@ int main(int argc, char **argv) {
296 - if (virJSONInitialize() < 0)
297 - exit(EXIT_FAILURE);
299 daemonSetupNetDevOpenvswitch(config);
301 if (daemonSetupAccessManager(config) < 0) {
302 diff -urNpa libvirt-4.6.0.orig/src/util/Makefile.inc.am libvirt-4.6.0/src/util/Makefile.inc.am
303 --- libvirt-4.6.0.orig/src/util/Makefile.inc.am 2018-08-02 03:58:35.116820088 +0000
304 +++ libvirt-4.6.0/src/util/Makefile.inc.am 2018-08-20 18:00:20.575398013 +0000
305 @@ -86,8 +86,6 @@ UTIL_SOURCES = \
309 - util/virjsoncompat.c \
310 - util/virjsoncompat.h \
314 @@ -253,7 +251,7 @@ libvirt_util_la_SOURCES = \
316 libvirt_util_la_CFLAGS = \
318 - $(JANSSON_CFLAGS) \
323 @@ -266,6 +264,7 @@ libvirt_util_la_CFLAGS = \
325 libvirt_util_la_LIBADD = \
331 diff -urNpa libvirt-4.6.0.orig/src/util/virjson.c libvirt-4.6.0/src/util/virjson.c
332 --- libvirt-4.6.0.orig/src/util/virjson.c 2018-08-02 03:58:35.117820079 +0000
333 +++ libvirt-4.6.0/src/util/virjson.c 2018-08-20 18:00:20.576398013 +0000
335 #include "virstring.h"
339 +# include <yajl/yajl_gen.h>
340 +# include <yajl/yajl_parse.h>
343 +# define yajl_size_t size_t
344 +# define VIR_YAJL_STATUS_OK(status) ((status) == yajl_status_ok)
346 +# define yajl_size_t unsigned int
347 +# define yajl_complete_parse yajl_parse_complete
348 +# define VIR_YAJL_STATUS_OK(status) \
349 + ((status) == yajl_status_ok || (status) == yajl_status_insufficient_data)
355 #define VIR_FROM_THIS VIR_FROM_NONE
357 @@ -72,6 +88,23 @@ struct _virJSONValue {
361 +typedef struct _virJSONParserState virJSONParserState;
362 +typedef virJSONParserState *virJSONParserStatePtr;
363 +struct _virJSONParserState {
364 + virJSONValuePtr value;
368 +typedef struct _virJSONParser virJSONParser;
369 +typedef virJSONParser *virJSONParserPtr;
370 +struct _virJSONParser {
371 + virJSONValuePtr head;
372 + virJSONParserStatePtr state;
379 virJSONValueGetType(const virJSONValue *value)
381 @@ -420,6 +453,28 @@ virJSONValueNewString(const char *data)
386 +virJSONValueNewStringLen(const char *data,
389 + virJSONValuePtr val;
392 + return virJSONValueNewNull();
394 + if (VIR_ALLOC(val) < 0)
397 + val->type = VIR_JSON_TYPE_STRING;
398 + if (VIR_STRNDUP(val->data.string, data, length) < 0) {
407 static virJSONValuePtr
408 virJSONValueNewNumber(const char *data)
410 @@ -1436,193 +1491,446 @@ virJSONValueCopy(const virJSONValue *in)
417 +virJSONParserInsertValue(virJSONParserPtr parser,
418 + virJSONValuePtr value)
420 + if (!parser->head) {
421 + parser->head = value;
423 + virJSONParserStatePtr state;
424 + if (!parser->nstate) {
425 + VIR_DEBUG("got a value to insert without a container");
429 -# include "virjsoncompat.h"
430 + state = &parser->state[parser->nstate-1];
432 -static virJSONValuePtr
433 -virJSONValueFromJansson(json_t *json)
435 - virJSONValuePtr ret = NULL;
439 + switch (state->value->type) {
440 + case VIR_JSON_TYPE_OBJECT: {
442 + VIR_DEBUG("missing key when inserting object value");
446 - switch (json_typeof(json)) {
448 - ret = virJSONValueNewObject();
451 + if (virJSONValueObjectAppend(state->value,
456 - json_object_foreach(json, key, cur) {
457 - virJSONValuePtr val = virJSONValueFromJansson(cur);
460 + VIR_FREE(state->key);
463 - if (virJSONValueObjectAppend(ret, key, val) < 0) {
464 - virJSONValueFree(val);
466 + case VIR_JSON_TYPE_ARRAY: {
468 + VIR_DEBUG("unexpected key when inserting array value");
472 + if (virJSONValueArrayAppend(state->value,
478 + VIR_DEBUG("unexpected value type, not a container");
488 - ret = virJSONValueNewArray();
492 - json_array_foreach(json, i, cur) {
493 - virJSONValuePtr val = virJSONValueFromJansson(cur);
497 +virJSONParserHandleNull(void *ctx)
499 + virJSONParserPtr parser = ctx;
500 + virJSONValuePtr value = virJSONValueNewNull();
502 - if (virJSONValueArrayAppend(ret, val) < 0) {
503 - virJSONValueFree(val);
508 + VIR_DEBUG("parser=%p", parser);
511 - ret = virJSONValueNewString(json_string_value(json));
517 - ret = virJSONValueNewNumberLong(json_integer_value(json));
519 + if (virJSONParserInsertValue(parser, value) < 0) {
520 + virJSONValueFree(value);
525 - ret = virJSONValueNewNumberDouble(json_real_value(json));
531 - ret = virJSONValueNewBoolean(true);
535 - ret = virJSONValueNewBoolean(false);
538 +virJSONParserHandleBoolean(void *ctx,
541 + virJSONParserPtr parser = ctx;
542 + virJSONValuePtr value = virJSONValueNewBoolean(boolean_);
545 - ret = virJSONValueNewNull();
547 + VIR_DEBUG("parser=%p boolean=%d", parser, boolean_);
552 + if (virJSONParserInsertValue(parser, value) < 0) {
553 + virJSONValueFree(value);
562 - virJSONValueFree(ret);
566 +virJSONParserHandleNumber(void *ctx,
570 + virJSONParserPtr parser = ctx;
572 + virJSONValuePtr value;
574 + if (VIR_STRNDUP(str, s, l) < 0)
576 + value = virJSONValueNewNumber(str);
579 + VIR_DEBUG("parser=%p str=%s", parser, str);
584 + if (virJSONParserInsertValue(parser, value) < 0) {
585 + virJSONValueFree(value);
594 +virJSONParserHandleString(void *ctx,
595 + const unsigned char *stringVal,
596 + yajl_size_t stringLen)
598 + virJSONParserPtr parser = ctx;
599 + virJSONValuePtr value = virJSONValueNewStringLen((const char *)stringVal,
602 + VIR_DEBUG("parser=%p str=%p", parser, (const char *)stringVal);
607 + if (virJSONParserInsertValue(parser, value) < 0) {
608 + virJSONValueFree(value);
617 +virJSONParserHandleMapKey(void *ctx,
618 + const unsigned char *stringVal,
619 + yajl_size_t stringLen)
621 + virJSONParserPtr parser = ctx;
622 + virJSONParserStatePtr state;
624 + VIR_DEBUG("parser=%p key=%p", parser, (const char *)stringVal);
626 + if (!parser->nstate)
629 + state = &parser->state[parser->nstate-1];
632 + if (VIR_STRNDUP(state->key, (const char *)stringVal, stringLen) < 0)
639 +virJSONParserHandleStartMap(void *ctx)
641 + virJSONParserPtr parser = ctx;
642 + virJSONValuePtr value = virJSONValueNewObject();
644 + VIR_DEBUG("parser=%p", parser);
649 + if (virJSONParserInsertValue(parser, value) < 0) {
650 + virJSONValueFree(value);
654 + if (VIR_REALLOC_N(parser->state,
655 + parser->nstate + 1) < 0) {
659 + parser->state[parser->nstate].value = value;
660 + parser->state[parser->nstate].key = NULL;
668 +virJSONParserHandleEndMap(void *ctx)
670 + virJSONParserPtr parser = ctx;
671 + virJSONParserStatePtr state;
673 + VIR_DEBUG("parser=%p", parser);
675 + if (!parser->nstate)
678 + state = &(parser->state[parser->nstate-1]);
680 + VIR_FREE(state->key);
684 + VIR_DELETE_ELEMENT(parser->state, parser->nstate - 1, parser->nstate);
691 +virJSONParserHandleStartArray(void *ctx)
693 + virJSONParserPtr parser = ctx;
694 + virJSONValuePtr value = virJSONValueNewArray();
696 + VIR_DEBUG("parser=%p", parser);
701 + if (virJSONParserInsertValue(parser, value) < 0) {
702 + virJSONValueFree(value);
706 + if (VIR_REALLOC_N(parser->state,
707 + parser->nstate + 1) < 0)
710 + parser->state[parser->nstate].value = value;
711 + parser->state[parser->nstate].key = NULL;
719 +virJSONParserHandleEndArray(void *ctx)
721 + virJSONParserPtr parser = ctx;
722 + virJSONParserStatePtr state;
724 + VIR_DEBUG("parser=%p", parser);
726 + if (!(parser->nstate - parser->wrap))
729 + state = &(parser->state[parser->nstate-1]);
731 + VIR_FREE(state->key);
735 + VIR_DELETE_ELEMENT(parser->state, parser->nstate - 1, parser->nstate);
741 +static const yajl_callbacks parserCallbacks = {
742 + virJSONParserHandleNull,
743 + virJSONParserHandleBoolean,
746 + virJSONParserHandleNumber,
747 + virJSONParserHandleString,
748 + virJSONParserHandleStartMap,
749 + virJSONParserHandleMapKey,
750 + virJSONParserHandleEndMap,
751 + virJSONParserHandleStartArray,
752 + virJSONParserHandleEndArray
756 +/* XXX add an incremental streaming parser - yajl trivially supports it */
758 virJSONValueFromString(const char *jsonstring)
761 + virJSONParser parser = { NULL, NULL, 0, 0 };
762 virJSONValuePtr ret = NULL;
764 - json_error_t error;
765 - size_t flags = JSON_REJECT_DUPLICATES |
768 + size_t len = strlen(jsonstring);
770 + yajl_parser_config cfg = { 0, 1 }; /* Match yajl 2 default behavior */
771 + VIR_AUTOPTR(virJSONValue) tmp = NULL;
774 + VIR_DEBUG("string=%s", jsonstring);
777 + hand = yajl_alloc(&parserCallbacks, NULL, &parser);
779 + hand = yajl_alloc(&parserCallbacks, &cfg, NULL, &parser);
782 + virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
783 + _("Unable to create JSON parser"));
787 - if (virJSONInitialize() < 0)
789 + /* Yajl 2 is nice enough to default to rejecting trailing garbage.
790 + * Yajl 1.0.12 has yajl_get_bytes_consumed to make that detection
791 + * simpler. But we're stuck with yajl 1.0.7 on RHEL 6, which
792 + * happily quits parsing at the end of a valid JSON construct,
793 + * with no visibility into how much more input remains. Wrapping
794 + * things in an array forces yajl to confess the truth. */
796 + rc = yajl_parse(hand, (const unsigned char *)jsonstring, len);
798 + rc = yajl_parse(hand, (const unsigned char *)"[", 1);
800 + if (VIR_YAJL_STATUS_OK(rc))
801 + rc = yajl_parse(hand, (const unsigned char *)jsonstring, len);
803 + if (VIR_YAJL_STATUS_OK(rc))
804 + rc = yajl_parse(hand, (const unsigned char *)"]", 1);
806 + if (!VIR_YAJL_STATUS_OK(rc) ||
807 + yajl_complete_parse(hand) != yajl_status_ok) {
808 + unsigned char *errstr = yajl_get_error(hand, 1,
809 + (const unsigned char*)jsonstring,
810 + strlen(jsonstring));
812 - if (!(json = json_loads(jsonstring, flags, &error))) {
813 virReportError(VIR_ERR_INTERNAL_ERROR,
814 - _("failed to parse JSON %d:%d: %s"),
815 - error.line, error.column, error.text);
817 + _("cannot parse json %s: %s"),
818 + jsonstring, (const char*) errstr);
819 + yajl_free_error(hand, errstr);
820 + virJSONValueFree(parser.head);
824 - ret = virJSONValueFromJansson(json);
826 + if (parser.nstate != 0) {
827 + virReportError(VIR_ERR_INTERNAL_ERROR,
828 + _("cannot parse json %s: unterminated string/map/array"),
830 + virJSONValueFree(parser.head);
834 + /* Undo the array wrapping above */
837 + if (virJSONValueArraySize(tmp) > 1)
838 + virReportError(VIR_ERR_INTERNAL_ERROR,
839 + _("cannot parse json %s: too many items present"),
842 + ret = virJSONValueArraySteal(tmp, 0);
849 + if (parser.nstate) {
851 + for (i = 0; i < parser.nstate; i++)
852 + VIR_FREE(parser.state[i].key);
853 + VIR_FREE(parser.state);
856 + VIR_DEBUG("result=%p", ret);
863 -virJSONValueToJansson(virJSONValuePtr object)
865 +virJSONValueToStringOne(virJSONValuePtr object,
868 - json_t *ret = NULL;
871 - switch ((virJSONType)object->type) {
872 + VIR_DEBUG("object=%p type=%d gen=%p", object, object->type, g);
874 + switch (object->type) {
875 case VIR_JSON_TYPE_OBJECT:
876 - ret = json_object();
879 + if (yajl_gen_map_open(g) != yajl_gen_status_ok)
881 for (i = 0; i < object->data.object.npairs; i++) {
882 - virJSONObjectPairPtr cur = object->data.object.pairs + i;
883 - json_t *val = virJSONValueToJansson(cur->value);
887 - if (json_object_set_new(ret, cur->key, val) < 0) {
891 + if (yajl_gen_string(g,
892 + (unsigned char *)object->data.object.pairs[i].key,
893 + strlen(object->data.object.pairs[i].key))
894 + != yajl_gen_status_ok)
896 + if (virJSONValueToStringOne(object->data.object.pairs[i].value, g) < 0)
899 + if (yajl_gen_map_close(g) != yajl_gen_status_ok)
903 case VIR_JSON_TYPE_ARRAY:
904 - ret = json_array();
907 + if (yajl_gen_array_open(g) != yajl_gen_status_ok)
909 for (i = 0; i < object->data.array.nvalues; i++) {
910 - virJSONValuePtr cur = object->data.array.values[i];
911 - json_t *val = virJSONValueToJansson(cur);
915 - if (json_array_append_new(ret, val) < 0) {
919 + if (virJSONValueToStringOne(object->data.array.values[i], g) < 0)
922 + if (yajl_gen_array_close(g) != yajl_gen_status_ok)
926 case VIR_JSON_TYPE_STRING:
927 - ret = json_string(object->data.string);
928 + if (yajl_gen_string(g, (unsigned char *)object->data.string,
929 + strlen(object->data.string)) != yajl_gen_status_ok)
933 - case VIR_JSON_TYPE_NUMBER: {
936 - if (virStrToLong_ll(object->data.number, NULL, 10, &ll_val) < 0) {
937 - if (virStrToDouble(object->data.number, NULL, &d_val) < 0) {
938 - virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
939 - _("JSON value is not a number"));
942 - ret = json_real(d_val);
944 - ret = json_integer(ll_val);
947 + case VIR_JSON_TYPE_NUMBER:
948 + if (yajl_gen_number(g, object->data.number,
949 + strlen(object->data.number)) != yajl_gen_status_ok)
953 case VIR_JSON_TYPE_BOOLEAN:
954 - ret = json_boolean(object->data.boolean);
955 + if (yajl_gen_bool(g, object->data.boolean) != yajl_gen_status_ok)
959 case VIR_JSON_TYPE_NULL:
961 + if (yajl_gen_null(g) != yajl_gen_status_ok)
966 - virReportEnumRangeError(virJSONType, object->type);
975 - virReportOOMError();
983 @@ -1630,27 +1938,50 @@ char *
984 virJSONValueToString(virJSONValuePtr object,
987 - size_t flags = JSON_ENCODE_ANY;
991 + const unsigned char *str;
995 + yajl_gen_config conf = { pretty ? 1 : 0, pretty ? " " : " "};
998 + VIR_DEBUG("object=%p", object);
1001 + g = yajl_gen_alloc(NULL);
1003 + yajl_gen_config(g, yajl_gen_beautify, pretty ? 1 : 0);
1004 + yajl_gen_config(g, yajl_gen_indent_string, pretty ? " " : " ");
1005 + yajl_gen_config(g, yajl_gen_validate_utf8, 1);
1008 + g = yajl_gen_alloc(&conf, NULL);
1011 + virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
1012 + _("Unable to create JSON formatter"));
1016 - if (virJSONInitialize() < 0)
1018 + if (virJSONValueToStringOne(object, g) < 0) {
1019 + virReportOOMError();
1024 - flags |= JSON_INDENT(2);
1026 - flags |= JSON_COMPACT;
1027 + if (yajl_gen_get_buf(g, &str, &len) != yajl_gen_status_ok) {
1028 + virReportOOMError();
1032 - json = virJSONValueToJansson(object);
1035 + ignore_value(VIR_STRDUP(ret, (const char *)str));
1037 - str = json_dumps(json, flags);
1039 - virReportOOMError();
1040 - json_decref(json);
1045 + VIR_DEBUG("result=%s", NULLSTR(ret));
1051 diff -urNpa libvirt-4.6.0.orig/src/util/virjsoncompat.c libvirt-4.6.0/src/util/virjsoncompat.c
1052 --- libvirt-4.6.0.orig/src/util/virjsoncompat.c 2018-08-02 03:58:35.117820079 +0000
1053 +++ libvirt-4.6.0/src/util/virjsoncompat.c 1970-01-01 00:00:00.000000000 +0000
1056 - * virjsoncompat.c: JSON object parsing/formatting
1058 - * Copyright (C) 2018 Red Hat, Inc.
1060 - * This library is free software; you can redistribute it and/or
1061 - * modify it under the terms of the GNU Lesser General Public
1062 - * License as published by the Free Software Foundation; either
1063 - * version 2.1 of the License, or (at your option) any later version.
1065 - * This library is distributed in the hope that it will be useful,
1066 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
1067 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1068 - * Lesser General Public License for more details.
1070 - * You should have received a copy of the GNU Lesser General Public
1071 - * License along with this library. If not, see
1072 - * <http://www.gnu.org/licenses/>.
1076 -#include <config.h>
1078 -#include "virthread.h"
1079 -#include "virerror.h"
1080 -#define VIR_JSON_COMPAT_IMPL
1081 -#include "virjsoncompat.h"
1083 -#define VIR_FROM_THIS VIR_FROM_NONE
1087 -# include <dlfcn.h>
1089 -json_t *(*json_array_ptr)(void);
1090 -int (*json_array_append_new_ptr)(json_t *array, json_t *value);
1091 -json_t *(*json_array_get_ptr)(const json_t *array, size_t index);
1092 -size_t (*json_array_size_ptr)(const json_t *array);
1093 -void (*json_delete_ptr)(json_t *json);
1094 -char *(*json_dumps_ptr)(const json_t *json, size_t flags);
1095 -json_t *(*json_false_ptr)(void);
1096 -json_t *(*json_integer_ptr)(json_int_t value);
1097 -json_int_t (*json_integer_value_ptr)(const json_t *integer);
1098 -json_t *(*json_loads_ptr)(const char *input, size_t flags, json_error_t *error);
1099 -json_t *(*json_null_ptr)(void);
1100 -json_t *(*json_object_ptr)(void);
1101 -void *(*json_object_iter_ptr)(json_t *object);
1102 -const char *(*json_object_iter_key_ptr)(void *iter);
1103 -void *(*json_object_iter_next_ptr)(json_t *object, void *iter);
1104 -json_t *(*json_object_iter_value_ptr)(void *iter);
1105 -void *(*json_object_key_to_iter_ptr)(const char *key);
1106 -int (*json_object_set_new_ptr)(json_t *object, const char *key, json_t *value);
1107 -json_t *(*json_real_ptr)(double value);
1108 -double (*json_real_value_ptr)(const json_t *real);
1109 -json_t *(*json_string_ptr)(const char *value);
1110 -const char *(*json_string_value_ptr)(const json_t *string);
1111 -json_t *(*json_true_ptr)(void);
1115 -virJSONJanssonOnceInit(void)
1117 - void *handle = dlopen("libjansson.so.4", RTLD_LAZY|RTLD_LOCAL|RTLD_NODELETE);
1119 - virReportError(VIR_ERR_NO_SUPPORT,
1120 - _("libjansson.so.4 JSON library not available: %s"), dlerror());
1124 -# define LOAD(name) \
1126 - if (!(name ## _ptr = dlsym(handle, #name))) { \
1127 - virReportError(VIR_ERR_NO_SUPPORT, \
1128 - _("missing symbol '%s' in libjansson.so.4: %s"), #name, dlerror()); \
1134 - LOAD(json_array_append_new);
1135 - LOAD(json_array_get);
1136 - LOAD(json_array_size);
1137 - LOAD(json_delete);
1140 - LOAD(json_integer);
1141 - LOAD(json_integer_value);
1144 - LOAD(json_object);
1145 - LOAD(json_object_iter);
1146 - LOAD(json_object_iter_key);
1147 - LOAD(json_object_iter_next);
1148 - LOAD(json_object_iter_value);
1149 - LOAD(json_object_key_to_iter);
1150 - LOAD(json_object_set_new);
1152 - LOAD(json_real_value);
1153 - LOAD(json_string);
1154 - LOAD(json_string_value);
1160 -VIR_ONCE_GLOBAL_INIT(virJSONJansson);
1163 -virJSONInitialize(void)
1165 - return virJSONJanssonInitialize();
1169 -json_array_impl(void)
1171 - return json_array_ptr();
1176 -json_array_append_new_impl(json_t *array, json_t *value)
1178 - return json_array_append_new_ptr(array, value);
1183 -json_array_get_impl(const json_t *array, size_t index)
1185 - return json_array_get_ptr(array, index);
1190 -json_array_size_impl(const json_t *array)
1192 - return json_array_size_ptr(array);
1197 -json_delete_impl(json_t *json)
1199 - return json_delete_ptr(json);
1204 -json_dumps_impl(const json_t *json, size_t flags)
1206 - return json_dumps_ptr(json, flags);
1211 -json_false_impl(void)
1213 - return json_false_ptr();
1218 -json_integer_impl(json_int_t value)
1220 - return json_integer_ptr(value);
1225 -json_integer_value_impl(const json_t *integer)
1227 - return json_integer_value_ptr(integer);
1232 -json_loads_impl(const char *input, size_t flags, json_error_t *error)
1234 - return json_loads_ptr(input, flags, error);
1239 -json_null_impl(void)
1241 - return json_null_ptr();
1246 -json_object_impl(void)
1248 - return json_object_ptr();
1253 -json_object_iter_impl(json_t *object)
1255 - return json_object_iter_ptr(object);
1260 -json_object_iter_key_impl(void *iter)
1262 - return json_object_iter_key_ptr(iter);
1267 -json_object_iter_next_impl(json_t *object, void *iter)
1269 - return json_object_iter_next_ptr(object, iter);
1274 -json_object_iter_value_impl(void *iter)
1276 - return json_object_iter_value_ptr(iter);
1281 -json_object_key_to_iter_impl(const char *key)
1283 - return json_object_key_to_iter_ptr(key);
1288 -json_object_set_new_impl(json_t *object, const char *key, json_t *value)
1290 - return json_object_set_new_ptr(object, key, value);
1295 -json_real_impl(double value)
1297 - return json_real_ptr(value);
1302 -json_real_value_impl(const json_t *real)
1304 - return json_real_value_ptr(real);
1309 -json_string_impl(const char *value)
1311 - return json_string_ptr(value);
1316 -json_string_value_impl(const json_t *string)
1318 - return json_string_value_ptr(string);
1323 -json_true_impl(void)
1325 - return json_true_ptr();
1329 -#else /* !WITH_JANSSON */
1333 -virJSONInitialize(void)
1339 -#endif /* !WITH_JANSSON */
1340 diff -urNpa libvirt-4.6.0.orig/src/util/virjsoncompat.h libvirt-4.6.0/src/util/virjsoncompat.h
1341 --- libvirt-4.6.0.orig/src/util/virjsoncompat.h 2018-08-02 03:58:35.117820079 +0000
1342 +++ libvirt-4.6.0/src/util/virjsoncompat.h 1970-01-01 00:00:00.000000000 +0000
1345 - * virjsoncompat.h: JSON object parsing/formatting
1347 - * Copyright (C) 2018 Red Hat, Inc.
1349 - * This library is free software; you can redistribute it and/or
1350 - * modify it under the terms of the GNU Lesser General Public
1351 - * License as published by the Free Software Foundation; either
1352 - * version 2.1 of the License, or (at your option) any later version.
1354 - * This library is distributed in the hope that it will be useful,
1355 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
1356 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1357 - * Lesser General Public License for more details.
1359 - * You should have received a copy of the GNU Lesser General Public
1360 - * License along with this library. If not, see
1361 - * <http://www.gnu.org/licenses/>.
1366 -#ifndef __VIR_JSON_COMPAT_H_
1367 -# define __VIR_JSON_COMPAT_H_
1370 -# ifndef VIR_JSON_COMPAT_IMPL
1372 -# define json_array json_array_impl
1373 -# define json_array_append_new json_array_append_new_impl
1374 -# define json_array_get json_array_get_impl
1375 -# define json_array_size json_array_size_impl
1376 -# define json_delete json_delete_impl
1377 -# define json_dumps json_dumps_impl
1378 -# define json_false json_false_impl
1379 -# define json_integer json_integer_impl
1380 -# define json_integer_value json_integer_value_impl
1381 -# define json_loads json_loads_impl
1382 -# define json_null json_null_impl
1383 -# define json_object json_object_impl
1384 -# define json_object_iter json_object_iter_impl
1385 -# define json_object_iter_key json_object_iter_key_impl
1386 -# define json_object_iter_next json_object_iter_next_impl
1387 -# define json_object_iter_value json_object_iter_value_impl
1388 -# define json_object_key_to_iter json_object_key_to_iter_impl
1389 -# define json_object_set_new json_object_set_new_impl
1390 -# define json_real json_real_impl
1391 -# define json_real_value json_real_value_impl
1392 -# define json_string json_string_impl
1393 -# define json_string_value json_string_value_impl
1394 -# define json_true json_true_impl
1396 -# endif /* ! VIR_JSON_COMPAT_IMPL */
1398 -# include <jansson.h>
1400 -# ifdef VIR_JSON_COMPAT_IMPL
1402 -json_t *json_array_impl(void);
1403 -int json_array_append_new_impl(json_t *array, json_t *value);
1404 -json_t *json_array_get_impl(const json_t *array, size_t index);
1405 -size_t json_array_size_impl(const json_t *array);
1406 -void json_delete_impl(json_t *json);
1407 -char *json_dumps_impl(const json_t *json, size_t flags);
1408 -json_t *json_false_impl(void);
1409 -json_t *json_integer_impl(json_int_t value);
1410 -json_int_t json_integer_value_impl(const json_t *integer);
1411 -json_t *json_loads_impl(const char *input, size_t flags, json_error_t *error);
1412 -json_t *json_null_impl(void);
1413 -json_t *json_object_impl(void);
1414 -void *json_object_iter_impl(json_t *object);
1415 -const char *json_object_iter_key_impl(void *iter);
1416 -void *json_object_iter_next_impl(json_t *object, void *iter);
1417 -json_t *json_object_iter_value_impl(void *iter);
1418 -void *json_object_key_to_iter_impl(const char *key);
1419 -int json_object_set_new_impl(json_t *object, const char *key, json_t *value);
1420 -json_t *json_real_impl(double value);
1421 -double json_real_value_impl(const json_t *real);
1422 -json_t *json_string_impl(const char *value);
1423 -const char *json_string_value_impl(const json_t *string);
1424 -json_t *json_true_impl(void);
1426 -# endif /* VIR_JSON_COMPAT_IMPL */
1427 -# endif /* WITH_JANSSON */
1429 -int virJSONInitialize(void);
1431 -#endif /* __VIR_JSON_COMPAT_H_ */
1432 diff -urNpa libvirt-4.6.0.orig/src/util/virjson.h libvirt-4.6.0/src/util/virjson.h
1433 --- libvirt-4.6.0.orig/src/util/virjson.h 2018-07-28 13:26:44.464463065 +0000
1434 +++ libvirt-4.6.0/src/util/virjson.h 2018-08-20 18:00:20.576398013 +0000
1435 @@ -59,6 +59,7 @@ int virJSONValueObjectAddVArgs(virJSONVa
1438 virJSONValuePtr virJSONValueNewString(const char *data);
1439 +virJSONValuePtr virJSONValueNewStringLen(const char *data, size_t length);
1440 virJSONValuePtr virJSONValueNewNumberInt(int data);
1441 virJSONValuePtr virJSONValueNewNumberUint(unsigned int data);
1442 virJSONValuePtr virJSONValueNewNumberLong(long long data);
1443 diff -urNpa libvirt-4.6.0.orig/tests/cputest.c libvirt-4.6.0/tests/cputest.c
1444 --- libvirt-4.6.0.orig/tests/cputest.c 2018-07-28 13:26:44.475462965 +0000
1445 +++ libvirt-4.6.0/tests/cputest.c 2018-08-20 18:00:20.576398013 +0000
1447 #include "cpu/cpu_map.h"
1448 #include "virstring.h"
1450 -#if WITH_QEMU && WITH_JANSSON
1451 +#if WITH_QEMU && WITH_YAJL
1452 # include "testutilsqemu.h"
1453 # include "qemumonitortestutils.h"
1454 # define __QEMU_CAPSPRIV_H_ALLOW__
1455 @@ -67,7 +67,7 @@ struct data {
1459 -#if WITH_QEMU && WITH_JANSSON
1460 +#if WITH_QEMU && WITH_YAJL
1461 static virQEMUDriver driver;
1464 @@ -479,7 +479,7 @@ typedef enum {
1465 JSON_MODELS_REQUIRED,
1468 -#if WITH_QEMU && WITH_JANSSON
1469 +#if WITH_QEMU && WITH_YAJL
1470 static virQEMUCapsPtr
1471 cpuTestMakeQEMUCaps(const struct data *data)
1473 @@ -554,7 +554,7 @@ cpuTestGetCPUModels(const struct data *d
1477 -#else /* if WITH_QEMU && WITH_JANSSON */
1478 +#else /* if WITH_QEMU && WITH_YAJL */
1481 cpuTestGetCPUModels(const struct data *data,
1482 @@ -834,7 +834,7 @@ cpuTestUpdateLive(const void *arg)
1486 -#if WITH_QEMU && WITH_JANSSON
1487 +#if WITH_QEMU && WITH_YAJL
1489 cpuTestJSONCPUID(const void *arg)
1491 @@ -911,7 +911,7 @@ mymain(void)
1492 virDomainCapsCPUModelsPtr ppc_models = NULL;
1495 -#if WITH_QEMU && WITH_JANSSON
1496 +#if WITH_QEMU && WITH_YAJL
1497 if (qemuTestDriverInit(&driver) < 0)
1498 return EXIT_FAILURE;
1500 @@ -1004,7 +1004,7 @@ mymain(void)
1501 host "/" cpu " (" #models ")", \
1502 host, cpu, models, 0, result)
1504 -#if WITH_QEMU && WITH_JANSSON
1505 +#if WITH_QEMU && WITH_YAJL
1506 # define DO_TEST_JSON(arch, host, json) \
1508 if (json == JSON_MODELS) { \
1509 @@ -1205,7 +1205,7 @@ mymain(void)
1510 DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-X5460", JSON_NONE);
1513 -#if WITH_QEMU && WITH_JANSSON
1514 +#if WITH_QEMU && WITH_YAJL
1515 qemuTestDriverFree(&driver);
1518 diff -urNpa libvirt-4.6.0.orig/tests/libxlxml2domconfigtest.c libvirt-4.6.0/tests/libxlxml2domconfigtest.c
1519 --- libvirt-4.6.0.orig/tests/libxlxml2domconfigtest.c 2018-08-06 09:22:16.558995687 +0000
1520 +++ libvirt-4.6.0/tests/libxlxml2domconfigtest.c 2018-08-20 18:00:20.576398013 +0000
1523 #include "testutils.h"
1525 -#if defined(WITH_LIBXL) && defined(WITH_JANSSON) && defined(HAVE_LIBXL_DOMAIN_CONFIG_FROM_JSON)
1526 +#if defined(WITH_LIBXL) && defined(WITH_YAJL) && defined(HAVE_LIBXL_DOMAIN_CONFIG_FROM_JSON)
1528 # include "internal.h"
1529 # include "viralloc.h"
1530 @@ -228,4 +228,4 @@ int main(void)
1531 return EXIT_AM_SKIP;
1534 -#endif /* WITH_LIBXL && WITH_JANSSON && HAVE_LIBXL_DOMAIN_CONFIG_FROM_JSON */
1535 +#endif /* WITH_LIBXL && WITH_YAJL && HAVE_LIBXL_DOMAIN_CONFIG_FROM_JSON */
1536 diff -urNpa libvirt-4.6.0.orig/tests/Makefile.am libvirt-4.6.0/tests/Makefile.am
1537 --- libvirt-4.6.0.orig/tests/Makefile.am 2018-07-28 13:26:44.475462965 +0000
1538 +++ libvirt-4.6.0/tests/Makefile.am 2018-08-20 18:00:20.576398013 +0000
1539 @@ -46,7 +46,7 @@ AM_CFLAGS = \
1542 $(APPARMOR_CFLAGS) \
1543 - $(JANSSON_CFLAGS) \
1545 $(COVERAGE_CFLAGS) \
1548 @@ -331,9 +331,9 @@ if WITH_CIL
1549 test_programs += objectlocking
1554 test_programs += virjsontest
1559 networkxml2xmltest \
1560 @@ -1219,15 +1219,15 @@ virdeterministichashmock_la_LIBADD = $(M
1562 test_libraries += virdeterministichashmock.la
1566 virmacmaptest_SOURCES = \
1567 virmacmaptest.c testutils.h testutils.c
1568 virmacmaptest_LDADD = $(LDADDS)
1570 test_programs += virmacmaptest
1571 -else ! WITH_JANSSON
1573 EXTRA_DIST += virmacmaptest.c
1574 -endif ! WITH_JANSSON
1577 virnetdevtest_SOURCES = \
1578 virnetdevtest.c testutils.h testutils.c
1579 diff -urNpa libvirt-4.6.0.orig/tests/qemuagenttest.c libvirt-4.6.0/tests/qemuagenttest.c
1580 --- libvirt-4.6.0.orig/tests/qemuagenttest.c 2018-07-28 13:26:44.477462947 +0000
1581 +++ libvirt-4.6.0/tests/qemuagenttest.c 2018-08-20 18:00:20.576398013 +0000
1582 @@ -907,8 +907,8 @@ mymain(void)
1586 -#if !WITH_STABLE_ORDERING_JANSSON
1587 - fputs("libvirt not compiled with recent enough Jansson, skipping this test\n", stderr);
1589 + fputs("libvirt not compiled with JSON support, skipping this test\n", stderr);
1590 return EXIT_AM_SKIP;
1593 diff -urNpa libvirt-4.6.0.orig/tests/qemublocktest.c libvirt-4.6.0/tests/qemublocktest.c
1594 --- libvirt-4.6.0.orig/tests/qemublocktest.c 2018-07-28 13:26:44.477462947 +0000
1595 +++ libvirt-4.6.0/tests/qemublocktest.c 2018-08-20 18:00:20.577398013 +0000
1596 @@ -309,7 +309,6 @@ testQemuDiskXMLToPropsValidateFile(const
1599 virBufferAdd(&buf, jsonstr, -1);
1600 - virBufferAddLit(&buf, "\n");
1604 @@ -337,11 +336,6 @@ mymain(void)
1605 char *capslatest_x86_64 = NULL;
1606 virQEMUCapsPtr caps_x86_64 = NULL;
1608 -#if !WITH_STABLE_ORDERING_JANSSON
1609 - fputs("libvirt not compiled with recent enough Jansson, skipping this test\n", stderr);
1610 - return EXIT_AM_SKIP;
1613 if (qemuTestDriverInit(&driver) < 0)
1614 return EXIT_FAILURE;
1616 diff -urNpa libvirt-4.6.0.orig/tests/qemucapabilitiestest.c libvirt-4.6.0/tests/qemucapabilitiestest.c
1617 --- libvirt-4.6.0.orig/tests/qemucapabilitiestest.c 2018-07-28 13:26:44.484462883 +0000
1618 +++ libvirt-4.6.0/tests/qemucapabilitiestest.c 2018-08-20 18:00:20.577398013 +0000
1619 @@ -141,12 +141,7 @@ mymain(void)
1623 -#if !WITH_STABLE_ORDERING_JANSSON
1624 - fputs("libvirt not compiled with recent enough Jansson, skipping this test\n", stderr);
1625 - return EXIT_AM_SKIP;
1630 fputs("libvirt not compiled with JSON support, skipping this test\n", stderr);
1631 return EXIT_AM_SKIP;
1633 diff -urNpa libvirt-4.6.0.orig/tests/qemucaps2xmltest.c libvirt-4.6.0/tests/qemucaps2xmltest.c
1634 --- libvirt-4.6.0.orig/tests/qemucaps2xmltest.c 2018-07-28 13:26:44.484462883 +0000
1635 +++ libvirt-4.6.0/tests/qemucaps2xmltest.c 2018-08-20 18:00:20.577398013 +0000
1636 @@ -165,7 +165,7 @@ mymain(void)
1642 fputs("libvirt not compiled with JSON support, skipping this test\n", stderr);
1643 return EXIT_AM_SKIP;
1645 diff -urNpa libvirt-4.6.0.orig/tests/qemucapsprobemock.c libvirt-4.6.0/tests/qemucapsprobemock.c
1646 --- libvirt-4.6.0.orig/tests/qemucapsprobemock.c 2018-08-02 03:58:35.117820079 +0000
1647 +++ libvirt-4.6.0/tests/qemucapsprobemock.c 2018-08-20 18:00:20.577398013 +0000
1648 @@ -76,7 +76,6 @@ qemuMonitorSend(qemuMonitorPtr mon,
1649 printLineSkipEmpty("\n", stdout);
1651 printLineSkipEmpty(reformatted, stdout);
1652 - printLineSkipEmpty("\n", stdout);
1653 VIR_FREE(reformatted);
1655 return realQemuMonitorSend(mon, msg);
1656 @@ -117,7 +116,6 @@ qemuMonitorJSONIOProcessLine(qemuMonitor
1657 printLineSkipEmpty("\n", stdout);
1659 printLineSkipEmpty(json, stdout);
1660 - printLineSkipEmpty("\n", stdout);
1664 diff -urNpa libvirt-4.6.0.orig/tests/qemucommandutiltest.c libvirt-4.6.0/tests/qemucommandutiltest.c
1665 --- libvirt-4.6.0.orig/tests/qemucommandutiltest.c 2018-07-28 13:26:44.484462883 +0000
1666 +++ libvirt-4.6.0/tests/qemucommandutiltest.c 2018-08-20 18:00:20.577398013 +0000
1667 @@ -76,12 +76,7 @@ mymain(void)
1669 testQemuCommandBuildObjectFromJSONData data1;
1671 -#if !WITH_STABLE_ORDERING_JANSSON
1672 - fputs("libvirt not compiled with recent enough Jansson, skipping this test\n", stderr);
1673 - return EXIT_AM_SKIP;
1678 fputs("libvirt not compiled with JSON support, skipping this test\n", stderr);
1679 return EXIT_AM_SKIP;
1681 diff -urNpa libvirt-4.6.0.orig/tests/qemuhotplugtest.c libvirt-4.6.0/tests/qemuhotplugtest.c
1682 --- libvirt-4.6.0.orig/tests/qemuhotplugtest.c 2018-07-28 13:26:44.484462883 +0000
1683 +++ libvirt-4.6.0/tests/qemuhotplugtest.c 2018-08-20 18:00:20.577398013 +0000
1684 @@ -593,12 +593,7 @@ mymain(void)
1685 struct qemuHotplugTestData data = {0};
1686 struct testQemuHotplugCpuParams cpudata;
1688 -#if !WITH_STABLE_ORDERING_JANSSON
1689 - fputs("libvirt not compiled with recent enough Jansson, skipping this test\n", stderr);
1690 - return EXIT_AM_SKIP;
1695 fputs("libvirt not compiled with JSON support, skipping this test\n", stderr);
1696 return EXIT_AM_SKIP;
1698 diff -urNpa libvirt-4.6.0.orig/tests/qemumigparamsdata/empty.json libvirt-4.6.0/tests/qemumigparamsdata/empty.json
1699 --- libvirt-4.6.0.orig/tests/qemumigparamsdata/empty.json 2018-07-28 13:26:44.484462883 +0000
1700 +++ libvirt-4.6.0/tests/qemumigparamsdata/empty.json 2018-08-20 18:00:20.577398013 +0000
1706 diff -urNpa libvirt-4.6.0.orig/tests/qemumigparamsdata/unsupported.json libvirt-4.6.0/tests/qemumigparamsdata/unsupported.json
1707 --- libvirt-4.6.0.orig/tests/qemumigparamsdata/unsupported.json 2018-07-28 13:26:44.485462874 +0000
1708 +++ libvirt-4.6.0/tests/qemumigparamsdata/unsupported.json 2018-08-20 18:00:20.577398013 +0000
1714 diff -urNpa libvirt-4.6.0.orig/tests/qemumigparamstest.c libvirt-4.6.0/tests/qemumigparamstest.c
1715 --- libvirt-4.6.0.orig/tests/qemumigparamstest.c 2018-07-28 13:26:44.485462874 +0000
1716 +++ libvirt-4.6.0/tests/qemumigparamstest.c 2018-08-20 18:00:20.577398013 +0000
1717 @@ -203,12 +203,7 @@ mymain(void)
1718 virQEMUDriver driver;
1721 -#if !WITH_STABLE_ORDERING_JANSSON
1722 - fputs("libvirt not compiled with recent enough Jansson, skipping this test\n", stderr);
1723 - return EXIT_AM_SKIP;
1728 fputs("libvirt not compiled with JSON support, skipping this test\n", stderr);
1729 return EXIT_AM_SKIP;
1731 diff -urNpa libvirt-4.6.0.orig/tests/qemumonitorjsontest.c libvirt-4.6.0/tests/qemumonitorjsontest.c
1732 --- libvirt-4.6.0.orig/tests/qemumonitorjsontest.c 2018-07-28 13:26:44.485462874 +0000
1733 +++ libvirt-4.6.0/tests/qemumonitorjsontest.c 2018-08-20 18:00:20.578398013 +0000
1734 @@ -2863,12 +2863,7 @@ mymain(void)
1735 virJSONValuePtr metaschema = NULL;
1736 char *metaschemastr = NULL;
1738 -#if !WITH_STABLE_ORDERING_JANSSON
1739 - fputs("libvirt not compiled with recent enough Jansson, skipping this test\n", stderr);
1740 - return EXIT_AM_SKIP;
1745 fputs("libvirt not compiled with JSON support, skipping this test\n", stderr);
1746 return EXIT_AM_SKIP;
1748 diff -urNpa libvirt-4.6.0.orig/tests/virjsontest.c libvirt-4.6.0/tests/virjsontest.c
1749 --- libvirt-4.6.0.orig/tests/virjsontest.c 2018-07-28 13:26:44.505462692 +0000
1750 +++ libvirt-4.6.0/tests/virjsontest.c 2018-08-20 18:00:20.578398013 +0000
1751 @@ -479,11 +479,6 @@ mymain(void)
1755 -#if !WITH_STABLE_ORDERING_JANSSON
1756 - fputs("libvirt not compiled with recent enough Jansson, skipping this test\n", stderr);
1757 - return EXIT_AM_SKIP;
1760 #define DO_TEST_FULL(name, cmd, doc, expect, pass) \
1762 struct testInfo info = { doc, expect, pass }; \
1763 diff -urNpa libvirt-4.6.0.orig/tests/virmacmaptest.c libvirt-4.6.0/tests/virmacmaptest.c
1764 --- libvirt-4.6.0.orig/tests/virmacmaptest.c 2018-07-28 13:26:44.505462692 +0000
1765 +++ libvirt-4.6.0/tests/virmacmaptest.c 2018-08-20 18:00:20.578398013 +0000
1766 @@ -157,11 +157,6 @@ mymain(void)
1768 virMacMapPtr mgr = NULL;
1770 -#if !WITH_STABLE_ORDERING_JANSSON
1771 - fputs("libvirt not compiled with recent enough Jansson, skipping this test\n", stderr);
1772 - return EXIT_AM_SKIP;
1775 #define DO_TEST_BASIC(f, d, ...) \
1777 const char * const m[] = {__VA_ARGS__, NULL }; \
1778 diff -urNpa libvirt-4.6.0.orig/tests/virmacmaptestdata/empty.json libvirt-4.6.0/tests/virmacmaptestdata/empty.json
1779 --- libvirt-4.6.0.orig/tests/virmacmaptestdata/empty.json 2018-07-28 13:26:44.505462692 +0000
1780 +++ libvirt-4.6.0/tests/virmacmaptestdata/empty.json 2018-08-20 18:00:20.578398013 +0000
1786 diff -urNpa libvirt-4.6.0.orig/tests/virmocklibxl.c libvirt-4.6.0/tests/virmocklibxl.c
1787 --- libvirt-4.6.0.orig/tests/virmocklibxl.c 2018-07-28 13:26:44.505462692 +0000
1788 +++ libvirt-4.6.0/tests/virmocklibxl.c 2018-08-20 18:00:20.578398013 +0000
1793 -#if defined(WITH_LIBXL) && defined(WITH_JANSSON)
1794 +#if defined(WITH_LIBXL) && defined(WITH_YAJL)
1795 # include "virmock.h"
1796 # include <sys/stat.h>
1797 # include <unistd.h>
1798 @@ -136,4 +136,4 @@ VIR_MOCK_IMPL_RET_ARGS(stat, int,
1799 return real_stat(path, sb);
1802 -#endif /* WITH_LIBXL && WITH_JANSSON */
1803 +#endif /* WITH_LIBXL && WITH_YAJL */
1804 diff -urNpa libvirt-4.6.0.orig/tests/virnetdaemontest.c libvirt-4.6.0/tests/virnetdaemontest.c
1805 --- libvirt-4.6.0.orig/tests/virnetdaemontest.c 2018-07-28 13:26:44.506462683 +0000
1806 +++ libvirt-4.6.0/tests/virnetdaemontest.c 2018-08-20 18:00:20.578398013 +0000
1809 #define VIR_FROM_THIS VIR_FROM_RPC
1811 -#if defined(HAVE_SOCKETPAIR) && defined(WITH_JANSSON)
1812 +#if defined(HAVE_SOCKETPAIR) && defined(WITH_YAJL)
1813 struct testClientPriv {
1816 @@ -375,11 +375,6 @@ mymain(void)
1818 const char *server_names[] = { "testServer0", "testServer1" };
1820 -# if !WITH_STABLE_ORDERING_JANSSON
1821 - fputs("libvirt not compiled with recent enough Jansson, skipping this test\n", stderr);
1822 - return EXIT_AM_SKIP;
1825 if (virInitialize() < 0 ||
1826 virEventRegisterDefaultImpl() < 0) {
1827 virDispatchError(NULL);
1828 diff -urNpa libvirt-4.6.0.orig/tests/virstoragetest.c libvirt-4.6.0/tests/virstoragetest.c
1829 --- libvirt-4.6.0.orig/tests/virstoragetest.c 2018-07-28 13:26:44.506462683 +0000
1830 +++ libvirt-4.6.0/tests/virstoragetest.c 2018-08-20 18:00:20.578398013 +0000
1831 @@ -1317,7 +1317,7 @@ mymain(void)
1832 " <host name='example.org' port='6000'/>\n"
1835 -#ifdef WITH_JANSSON
1837 TEST_BACKING_PARSE("json:", NULL);
1838 TEST_BACKING_PARSE("json:asdgsdfg", NULL);
1839 TEST_BACKING_PARSE("json:{}", NULL);
1840 @@ -1581,7 +1581,7 @@ mymain(void)
1841 "<source protocol='vxhs' name='c6718f6b-0401-441d-a8c3-1f0064d75ee0'>\n"
1842 " <host name='example.com' port='9999'/>\n"
1844 -#endif /* WITH_JANSSON */
1845 +#endif /* WITH_YAJL */