Browse Source

jansson package update

Signed-off-by: basebuilder_pel7x64builder0 <basebuilder@powerel.org>
master
basebuilder_pel7x64builder0 5 years ago
parent
commit
378354539c
  1. 63
      SOURCES/jansson-Call-va_end-after-va_copy-in-json_vsprintf.patch
  2. 52
      SOURCES/jansson-Deal-with-warnings-under-gcc-8.patch
  3. 122
      SPECS/jansson.spec

63
SOURCES/jansson-Call-va_end-after-va_copy-in-json_vsprintf.patch

@ -0,0 +1,63 @@ @@ -0,0 +1,63 @@
From 66e4ee795d21a30118f8503c966e9f9ae87db315 Mon Sep 17 00:00:00 2001
From: Xin Long <lucien.xin@gmail.com>
Date: Wed, 25 Jul 2018 17:39:33 +0800
Subject: [PATCH] Call va_end after va_copy in json_vsprintf

As said in man doc:
"Each invocation of va_copy() must be matched by a corresponding
invocation of va_end() in the same function."

va_copy may alloc memory in some system, it's necessay to free it by
va_end.

Fixes: efe6c7b3f2b3 ("Add json_sprintf and json_vsprintf")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
src/value.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/value.c b/src/value.c
index 29a978c..861dce8 100644
--- a/src/value.c
+++ b/src/value.c
@@ -781,26 +781,33 @@ static json_t *json_string_copy(const json_t *string)
}

json_t *json_vsprintf(const char *fmt, va_list ap) {
+ json_t *json = NULL;
int length;
char *buf;
va_list aq;
va_copy(aq, ap);

length = vsnprintf(NULL, 0, fmt, ap);
- if (length == 0)
- return json_string("");
+ if (length == 0) {
+ json = json_string("");
+ goto out;
+ }

buf = jsonp_malloc(length + 1);
if (!buf)
- return NULL;
+ goto out;

vsnprintf(buf, length + 1, fmt, aq);
if (!utf8_check_string(buf, length)) {
jsonp_free(buf);
- return NULL;
+ goto out;
}

- return jsonp_stringn_nocheck_own(buf, length);
+ json = jsonp_stringn_nocheck_own(buf, length);
+
+out:
+ va_end(aq);
+ return json;
}

json_t *json_sprintf(const char *fmt, ...) {
--
2.1.0

52
SOURCES/jansson-Deal-with-warnings-under-gcc-8.patch

@ -0,0 +1,52 @@ @@ -0,0 +1,52 @@
From 81fe13eeed91d5c973db63d2f662ae766a8832c4 Mon Sep 17 00:00:00 2001
From: Corey Farrell <git@cfware.com>
Date: Sat, 14 Jul 2018 13:24:55 -0400
Subject: [PATCH] Deal with warnings under gcc 8.

Recent versions of gcc have introduced compiler warnings for string
operations that could be truncated. This caused problems with -Werror.
src/error.c used strncpy to write "..." to a string, but skipped writing
the NUL terminator. Switch this to use memcpy. src/load.c produced
warnings from snprintf writing error strings that could be truncated.
Added code to autotools build to detect `-Wno-format-truncation', add it
to AM_CFLAGS if supported.
---
configure.ac | 9 ++++++++-
src/error.c | 2 +-
2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 4ab9d3d..ca12b59 100644
--- a/configure.ac
+++ b/configure.ac
@@ -108,7 +108,14 @@ AC_DEFINE_UNQUOTED([INITIAL_HASHTABLE_ORDER], [$initial_hashtable_order],
[Number of buckets new object hashtables contain is 2 raised to this power. E.g. 3 -> 2^3 = 8.])

if test x$GCC = xyes; then
- AM_CFLAGS="-Wall -Wextra -Wdeclaration-after-statement"
+ AC_MSG_CHECKING(for -Wno-format-truncation)
+ wnoformat_truncation="-Wno-format-truncation"
+ AS_IF([${CC} -Wno-format-truncation -Werror -S -o /dev/null -xc /dev/null > /dev/null 2>&1],
+ [AC_MSG_RESULT(yes)],
+ [AC_MSG_RESULT(no)
+ wnoformat_truncation=""])
+
+ AM_CFLAGS="-Wall -Wextra -Wdeclaration-after-statement ${wnoformat_truncation}"
fi
AC_SUBST([AM_CFLAGS])

diff --git a/src/error.c b/src/error.c
index cbd50d7..f5da6b9 100644
--- a/src/error.c
+++ b/src/error.c
@@ -28,7 +28,7 @@ void jsonp_error_set_source(json_error_t *error, const char *source)
strncpy(error->source, source, length + 1);
else {
size_t extra = length - JSON_ERROR_SOURCE_LENGTH + 4;
- strncpy(error->source, "...", 3);
+ memcpy(error->source, "...", 3);
strncpy(error->source + 3, source + extra, length - extra + 1);
}
}
--
2.1.0

122
SPECS/jansson.spec

@ -1,84 +1,136 @@ @@ -1,84 +1,136 @@
Name: jansson
Version: 2.10
Release: 1%{?dist}
Version: 2.11
Release: 3%{?dist}
Summary: C library for encoding, decoding and manipulating JSON data

Group: System Environment/Libraries
License: MIT
URL: http://www.digip.org/jansson/
Source0: http://www.digip.org/jansson/releases/jansson-%{version}.tar.bz2
Patch1: jansson-Deal-with-warnings-under-gcc-8.patch
Patch2: jansson-Call-va_end-after-va_copy-in-json_vsprintf.patch
BuildRequires: gcc
BuildRequires: autoconf automake libtool

BuildRequires: python-sphinx

%description
Small library for parsing and writing JSON documents.


%package devel
Summary: Header files for jansson
Group: Development/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}

%description devel
Header files for developing applications making use of jansson.

%package devel-doc
Summary: Development documentation for jansson
BuildArch: noarch

%description devel-doc
Development documentation for jansson.

%prep
%setup -q
%autosetup -p1
autoreconf --force --install -I m4

%if 0%{?rhel} == 6
%{__sed} -i 's/code-block:: shell/code-block:: none/g' doc/*.rst
%endif

%build
%configure --disable-static
make %{?_smp_mflags}
make html


%check
make check


%install
make install INSTALL="install -p" DESTDIR="$RPM_BUILD_ROOT"
rm "$RPM_BUILD_ROOT%{_libdir}"/*.la

%post -p /sbin/ldconfig

%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig


%files
%doc LICENSE CHANGES
%{_libdir}/*.so.*


%files devel
%{_libdir}/*.so
%{_libdir}/pkgconfig/%{name}.pc
%{_includedir}/*

%files devel-doc
%doc doc/_build/html/*

%changelog
* Fri Mar 10 2017 Nathaniel McCallum <npmccallum@redhat.com> - 2.10-1
- Update to 2.10 [1389805]
- Merge spec file with Fedora
* Fri Aug 03 2018 Xin Long <lxin@redhat.com> - 2.11-3
- Deal with warnings under gcc 8
- Call va_end after va_copy in json_vsprintf
- Fix bogus date in jansson.spec

* Mon Jul 09 2018 Charalampos Stratakis <cstratak@redhat.com> - 2.11-2
- Change to python3-sphinx

* Sat Mar 10 2018 Corey Farrell <git@cfware.com> - 2.11-1
- Update to Jansson 2.11

* Mon Feb 19 2018 Jared Smith <jsmith@fedoraproject.org> - 2.10-7
- Add missing BuildRequires on gcc

* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.10-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Sat Feb 03 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 2.10-5
- Switch to %%ldconfig_scriptlets

* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.10-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild

* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.10-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Sat Jun 10 2017 Nathaniel McCallum <npmccallum@redhat.com> - 2.10-2
- Add upstream patch for optional arguments to json_pack()
- Migrate to use autosetup macro

* Thu Mar 02 2017 Nathaniel McCallum <npmccallum@redhat.com> - 2.10-1
- Update to Jansson 2.10

* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.9-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Tue Sep 20 2016 Nathaniel McCallum <npmccallum@redhat.com> - 2.9-1
- Update to Jansson 2.9

* Fri Sep 16 2016 Nathaniel McCallum <npmccallum@redhat.com> - 2.8-1
- Update to Jansson 2.8
- Add json_auto_t patch

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.7-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.7-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Mon Jan 05 2015 Jiri Pirko <jpirko@redhat.com> 2.7-1
- Update to Jansson 2.7

* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.6-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.6-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Sat Mar 15 2014 Jiri Pirko <jpirko@redhat.com> 2.6-3
- Create devel-doc package

* Fri Mar 14 2014 Jiri Pirko <jpirko@redhat.com> 2.4-6
- Fix multilib conflicts by creating devel-doc package [1076415]
* Tue Mar 11 2014 Peter Robinson <pbrobinson@fedoraproject.org> 2.6-2
- Package cleanups

* Thu Feb 13 2014 Jiri Pirko <jpirko@redhat.com> 2.4-5
- Change hash function, randomize hashes [1063831]
* Thu Feb 13 2014 Jared Smith <jsmith@fedoraproject.org> - 2.6-1
- Update to Jansson 2.6 for CVE-2013-6401

* Fri Jan 24 2014 Daniel Mach <dmach@redhat.com> - 2.4-4
- Mass rebuild 2014-01-24
* Sat Jan 25 2014 Jiri Pirko <jpirko@redhat.com> 2.5-1
- Update to Jansson 2.5.

* Fri Dec 27 2013 Daniel Mach <dmach@redhat.com> - 2.4-3
- Mass rebuild 2013-12-27
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.4-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
@ -95,28 +147,28 @@ rm "$RPM_BUILD_ROOT%{_libdir}"/*.la @@ -95,28 +147,28 @@ rm "$RPM_BUILD_ROOT%{_libdir}"/*.la
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Thu Jun 11 2011 Sean Middleditch <sean@middleditch.us> 2.1-1
* Sat Jun 11 2011 Sean Middleditch <sean@middleditch.us> 2.1-1
- Update to Jansson 2.1.
- Drop Sphinx patch, no longer necessary.

* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Thu Jul 03 2010 Sean Middleditch <sean@middleditch.us> 1.3-1
* Sat Jul 03 2010 Sean Middleditch <sean@middleditch.us> 1.3-1
- Update to Jansson 1.3.
- Disable warnings-as-errors for Sphinx documentation.

* Thu Jan 21 2010 Sean Middleditch <sean@middleditch.us> 1.2-1
- Update to Jansson 1.2.

* Thu Jan 11 2010 Sean Middleditch <sean@middleditch.us> 1.1.3-4
* Mon Jan 11 2010 Sean Middleditch <sean@middleditch.us> 1.1.3-4
- Update jansson description per upstream's suggestions.
- Removed README from docs.

* Thu Jan 09 2010 Sean Middleditch <sean@middleditch.us> 1.1.3-3
* Sat Jan 09 2010 Sean Middleditch <sean@middleditch.us> 1.1.3-3
- Correct misspelling of jansson in the pkg-config file.

* Thu Jan 09 2010 Sean Middleditch <sean@middleditch.us> 1.1.3-2
* Sat Jan 09 2010 Sean Middleditch <sean@middleditch.us> 1.1.3-2
- Fix Changelog dates.
- Mix autoheader warning.
- Added make check.

Loading…
Cancel
Save