From 95a37c5239a2b993bfe39c057c554f512e27d6ed45055a0b38a5a740d2b87a4e Mon Sep 17 00:00:00 2001 From: Adam Majer Date: Thu, 28 Dec 2017 12:22:30 +0000 Subject: [PATCH] Accepting request 560218 from home:avindra - json-c 0.13 + Deprecated and removed features: * Internal use of bits.h has been eliminated. * lh_abort() is deprecated + Behavior changes: * Tighten the number parsing algorithm to raise errors instead of truncating the results. For example 12.3.4 or 2015-01-15, which now return null. * Use size_t for array length and size. Platforms where sizeof(size_t) != sizeof(int) may not be backwards compatible * Check for failue when allocating memory, returning NULL and errno=ENOMEM. * Change json_object_object_add() return type from void to int, and will return -1 on failures, instead of exiting. (Note: this is not an ABI change) + New features: * Aiming to follow RFC 7159 now. * Support for JSON pointer, RFC 6901 (see json_pointer.h) * Add a couple of additional option to json_object_to_json_string_ext: JSON_C_TO_STRING_PRETTY_TAB JSON_C_TO_STRING_NOSLASHESCAPE * json_object_object_add_ex() - better perf when certain constraints are known to be true * Serialization format of doubles now configurable * New functions - json_object_equal() - utility function for comparing json_objects - json_object_deep_copy() - a way to copy entire object trees - json_object_set_() - modify the value of existing json_object's without the need to recreate them. Also add a json_object_int_inc function to adjust an int's' value. - json_util_get_last_err() - retrieve the string describing the cause of errors, instead of printing to stderr. - perllike hash function for strings * json_global_set_string_hash() * json_c_visit() - a way to iterate over a tree of json-c objects. + Notable bug fixes and other improvements: * Make reference increment and decrement atomic to allow passing json objects between threads. * Fix json_object_object_foreach to avoid uninitialized variable warnings. * Improve performance by removing unneeded data items from hashtable code and reducing duplicate hash computation. * Performance: store small strings inside json_object * Performance: of json_object_to_json_string by removing variadic printf * Fix parsing of "-Infinity", and avoid needlessly copying the input when doing so. * Fix stack buffer overflow in json_object_double_to_json_string_format() * Fix various potential null ptr deref and int32 overflows * Fix a long-standing bug in array_list_put_idx() where it would attempt to free previously free'd entries due to not checking the current array length. * use uselocale() instead of setlocale() in json_tokener to behave better in threaded environments. * Fix out of bounds read when handling unicode surrogate pairs. * Ensure doubles that happen to be a whole number are emitted with ".0" * Visual Studio: use a snprintf/vsnprintf wrapper that ensures the string is terminated. * Fix double to int cast overflow in json_object_get_int64. * Clamp double to int32 when narrowing in json_object_get_int. * Use strtoll() to parse ints - instead of sscanf * usual code linting + Build changes: * Add Appveyor and Travis build support * Support for MacOS and Windows through CMake * Silent build by default * Link against libm when needed * Add support for building with AddressSanitizer * Add support for building with Clang * Add a --enable-threading configure option, and only use the (slower) __sync_add_and_fetch()/__sync_sub_and_fetch() function when it is specified. - cleanup with spec-cleaner - remove fix-set-but-not-used.patch + fixed: https://github.com/json-c/json-c/issues/240 - remove gcc7-fix.patch + fixed in 014924ba899f659917bb64392bbff7d3c803afc2 OBS-URL: https://build.opensuse.org/request/show/560218 OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/json-c?expand=0&rev=29 --- baselibs.conf | 2 +- fix-set-but-not-used.patch | 27 ------------ gcc7-fix.patch | 60 -------------------------- json-c-0.12.1.tar.gz | 3 -- json-c-0.13.tar.gz | 3 ++ json-c.changes | 86 ++++++++++++++++++++++++++++++++++++++ json-c.spec | 16 ++----- 7 files changed, 93 insertions(+), 104 deletions(-) delete mode 100644 fix-set-but-not-used.patch delete mode 100644 gcc7-fix.patch delete mode 100644 json-c-0.12.1.tar.gz create mode 100644 json-c-0.13.tar.gz diff --git a/baselibs.conf b/baselibs.conf index f3bdcff..49aa193 100644 --- a/baselibs.conf +++ b/baselibs.conf @@ -1 +1 @@ -libjson-c2 +libjson-c3 diff --git a/fix-set-but-not-used.patch b/fix-set-but-not-used.patch deleted file mode 100644 index 9d3272f..0000000 --- a/fix-set-but-not-used.patch +++ /dev/null @@ -1,27 +0,0 @@ -diff -Nur json-c-0.12.1/tests/testReplaceExisting.c new/tests/testReplaceExisting.c ---- json-c-0.12.1/tests/testReplaceExisting.c 2016-06-07 05:33:58.000000000 +0200 -+++ new/tests/testReplaceExisting.c 2016-07-18 20:13:24.101728480 +0200 -@@ -24,6 +24,7 @@ - int orig_count = 0; - json_object_object_foreach(my_object, key0, val0) - { -+ (void) val0; - printf("Key at index %d is [%s]", orig_count, key0); - if (strcmp(key0, "deleteme") == 0) - { -@@ -41,6 +42,7 @@ - orig_count = 0; - json_object_object_foreach(my_object, key, val) - { -+ (void) val; - printf("Key at index %d is [%s]\n", orig_count, key); - orig_count++; - if (strcmp(key, "foo2") != 0) -@@ -56,6 +58,7 @@ - int retval = 0; - json_object_object_foreach(my_object, key2, val2) - { -+ (void) val2; - printf("Key at index %d is [%s]\n", new_count, key2); - new_count++; - if (strcmp(key2, "foo2") != 0) diff --git a/gcc7-fix.patch b/gcc7-fix.patch deleted file mode 100644 index b390c8f..0000000 --- a/gcc7-fix.patch +++ /dev/null @@ -1,60 +0,0 @@ -diff --git a/json_object.c b/json_object.c -index 6cc73bc..6c1451e 100644 ---- a/json_object.c -+++ b/json_object.c -@@ -551,7 +551,9 @@ int64_t json_object_get_int64(struct json_object *jso) - case json_type_boolean: - return jso->o.c_boolean; - case json_type_string: -- if (json_parse_int64(jso->o.c_string.str, &cint) == 0) return cint; -+ if (json_parse_int64(jso->o.c_string.str, &cint) == 0) -+ return cint; -+ /* FALLTHRU */ - default: - return 0; - } -diff --git a/json_tokener.c b/json_tokener.c -index 9a76293..ae7b1ae 100644 ---- a/json_tokener.c -+++ b/json_tokener.c -@@ -305,6 +305,7 @@ struct json_object* json_tokener_parse_ex(struct json_tokener *tok, - tok->err = json_tokener_error_parse_unexpected; - goto out; - } -+ /* FALLTHRU */ - case '"': - state = json_tokener_state_string; - printbuf_reset(tok->pb); -diff --git a/linkhash.c b/linkhash.c -index 712c387..74e3b0f 100644 ---- a/linkhash.c -+++ b/linkhash.c -@@ -376,17 +376,17 @@ static uint32_t hashlittle( const void *key, size_t length, uint32_t initval) - /*-------------------------------- last block: affect all 32 bits of (c) */ - switch(length) /* all the case statements fall through */ - { -- case 12: c+=((uint32_t)k[11])<<24; -- case 11: c+=((uint32_t)k[10])<<16; -- case 10: c+=((uint32_t)k[9])<<8; -- case 9 : c+=k[8]; -- case 8 : b+=((uint32_t)k[7])<<24; -- case 7 : b+=((uint32_t)k[6])<<16; -- case 6 : b+=((uint32_t)k[5])<<8; -- case 5 : b+=k[4]; -- case 4 : a+=((uint32_t)k[3])<<24; -- case 3 : a+=((uint32_t)k[2])<<16; -- case 2 : a+=((uint32_t)k[1])<<8; -+ case 12: c+=((uint32_t)k[11])<<24; /* FALLTHRU */ -+ case 11: c+=((uint32_t)k[10])<<16; /* FALLTHRU */ -+ case 10: c+=((uint32_t)k[9])<<8; /* FALLTHRU */ -+ case 9 : c+=k[8]; /* FALLTHRU */ -+ case 8 : b+=((uint32_t)k[7])<<24; /* FALLTHRU */ -+ case 7 : b+=((uint32_t)k[6])<<16; /* FALLTHRU */ -+ case 6 : b+=((uint32_t)k[5])<<8; /* FALLTHRU */ -+ case 5 : b+=k[4]; /* FALLTHRU */ -+ case 4 : a+=((uint32_t)k[3])<<24; /* FALLTHRU */ -+ case 3 : a+=((uint32_t)k[2])<<16; /* FALLTHRU */ -+ case 2 : a+=((uint32_t)k[1])<<8; /* FALLTHRU */ - case 1 : a+=k[0]; - break; - case 0 : return c; diff --git a/json-c-0.12.1.tar.gz b/json-c-0.12.1.tar.gz deleted file mode 100644 index cc163ba..0000000 --- a/json-c-0.12.1.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2a136451a7932d80b7d197b10441e26e39428d67b1443ec43bbba824705e1123 -size 535086 diff --git a/json-c-0.13.tar.gz b/json-c-0.13.tar.gz new file mode 100644 index 0000000..2daa739 --- /dev/null +++ b/json-c-0.13.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0316780be9ad16c42d7c26b015a784fd5df4b0909fef0aba51cfb13e492ac24d +size 634720 diff --git a/json-c.changes b/json-c.changes index 4f8c13f..36c7c54 100644 --- a/json-c.changes +++ b/json-c.changes @@ -1,3 +1,89 @@ +------------------------------------------------------------------- +Thu Dec 28 05:17:43 UTC 2017 - avindra@opensuse.org + +- json-c 0.13 + + Deprecated and removed features: + * Internal use of bits.h has been eliminated. + * lh_abort() is deprecated + + Behavior changes: + * Tighten the number parsing algorithm to raise errors instead + of truncating the results. For example 12.3.4 or 2015-01-15, + which now return null. + * Use size_t for array length and size. Platforms where + sizeof(size_t) != sizeof(int) may not be backwards compatible + * Check for failue when allocating memory, returning NULL and + errno=ENOMEM. + * Change json_object_object_add() return type from void to int, + and will return -1 on failures, instead of exiting. (Note: + this is not an ABI change) + + New features: + * Aiming to follow RFC 7159 now. + * Support for JSON pointer, RFC 6901 (see json_pointer.h) + * Add a couple of additional option to json_object_to_json_string_ext: + JSON_C_TO_STRING_PRETTY_TAB + JSON_C_TO_STRING_NOSLASHESCAPE + * json_object_object_add_ex() - better perf when certain + constraints are known to be true + * Serialization format of doubles now configurable + * New functions + - json_object_equal() - utility function for comparing + json_objects + - json_object_deep_copy() - a way to copy entire object + trees + - json_object_set_() - modify the value of + existing json_object's without the need to recreate them. + Also add a json_object_int_inc function to adjust an int's' + value. + - json_util_get_last_err() - retrieve the string describing + the cause of errors, instead of printing to stderr. + - perllike hash function for strings + * json_global_set_string_hash() + * json_c_visit() - a way to iterate over a tree of json-c + objects. + + Notable bug fixes and other improvements: + * Make reference increment and decrement atomic to allow + passing json objects between threads. + * Fix json_object_object_foreach to avoid uninitialized + variable warnings. + * Improve performance by removing unneeded data items from + hashtable code and reducing duplicate hash computation. + * Performance: store small strings inside json_object + * Performance: of json_object_to_json_string by removing + variadic printf + * Fix parsing of "-Infinity", and avoid needlessly copying the + input when doing so. + * Fix stack buffer overflow in json_object_double_to_json_string_format() + * Fix various potential null ptr deref and int32 overflows + * Fix a long-standing bug in array_list_put_idx() where it + would attempt to free previously free'd entries due to not + checking the current array length. + * use uselocale() instead of setlocale() in json_tokener to + behave better in threaded environments. + * Fix out of bounds read when handling unicode surrogate pairs. + * Ensure doubles that happen to be a whole number are emitted + with ".0" + * Visual Studio: use a snprintf/vsnprintf wrapper that ensures + the string is terminated. + * Fix double to int cast overflow in json_object_get_int64. + * Clamp double to int32 when narrowing in json_object_get_int. + * Use strtoll() to parse ints - instead of sscanf + * usual code linting + + Build changes: + * Add Appveyor and Travis build support + * Support for MacOS and Windows through CMake + * Silent build by default + * Link against libm when needed + * Add support for building with AddressSanitizer + * Add support for building with Clang + * Add a --enable-threading configure option, and only use the + (slower) __sync_add_and_fetch()/__sync_sub_and_fetch() + function when it is specified. +- cleanup with spec-cleaner +- remove fix-set-but-not-used.patch + + fixed: https://github.com/json-c/json-c/issues/240 +- remove gcc7-fix.patch + + fixed in 014924ba899f659917bb64392bbff7d3c803afc2 + ------------------------------------------------------------------- Thu Mar 23 09:29:23 UTC 2017 - mliska@suse.cz diff --git a/json-c.spec b/json-c.spec index a891fe5..b77a55b 100644 --- a/json-c.spec +++ b/json-c.spec @@ -17,10 +17,10 @@ %define libname libjson-c -%define libsoname %{libname}2 +%define libsoname %{libname}3 %define oldlibname libjson Name: json-c -Version: 0.12.1 +Version: 0.13 Release: 0 Summary: JSON implementation in C License: MIT @@ -29,14 +29,9 @@ Url: https://github.com/json-c/json-c/wiki #Git-Clone git://github.com/json-c/json-c Source0: https://s3.amazonaws.com/json-c_releases/releases/%{name}-%{version}.tar.gz Source1: baselibs.conf -# PATCH-FIX-UPSTREAM fix-set-but-not-used.patch -- Fix set-but-not-used compile error in tests https://github.com/json-c/json-c/issues/240 -Patch0: fix-set-but-not-used.patch -# PATCH-FIX-UPSTREAM gcc7-fix.patch -- Fix new warnings seen by GCC7 -Patch1: gcc7-fix.patch BuildRequires: fdupes BuildRequires: libtool BuildRequires: pkgconfig -BuildRoot: %{_tmppath}/%{name}-%{version}-build %description JSON-C implements a reference counting object model that allows you to @@ -91,8 +86,6 @@ This package includes the json-c documentation. %prep %setup -q -%patch0 -p1 -%patch1 -p1 %build %if 0%{?suse_version} <= 1110 @@ -106,7 +99,7 @@ make %{?_smp_mflags} make %{?_smp_mflags} check %install -make DESTDIR=%{buildroot} install %{?_smp_mflags} DESTDIR=%{buildroot} libdir=%{_libdir} mandir=%{_mandir} +%make_install find %{buildroot} -type f -name "*.la" -delete -print # create a compatibilty pkg-config file for software needing it (cd %{buildroot}%{_libdir}/pkgconfig && ln -s json-c.pc json.pc) @@ -118,18 +111,15 @@ cp -R doc/html "%{buildroot}%{_docdir}/%{name}-doc" %postun -n %{libsoname} -p /sbin/ldconfig %files -n %{libsoname} -%defattr(-,root,root) %{_libdir}/%{libname}.so.* %doc COPYING %files -n %{libname}-devel -%defattr(-,root,root) %{_libdir}/%{libname}.so %{_includedir}/json-c %{_libdir}/pkgconfig/*.pc %files -n %{libname}-doc -%defattr(-,root,root) %doc AUTHORS ChangeLog COPYING README README.html %doc %{_docdir}/%{name}-doc