Accepting request 283061 from home:elvigia:branches:network:utilities

- fix missing pkgconfig buildRequires 
- Run make check but ignore failures.

- libsmi-exports.patch: Export only the symbols of the public 
  API, specially hide and avoid using internal
  vasprintf and asnprintf implementations that will 
  name-clash with the C library.

OBS-URL: https://build.opensuse.org/request/show/283061
OBS-URL: https://build.opensuse.org/package/show/network:utilities/libsmi?expand=0&rev=18
This commit is contained in:
Tomáš Chvátal 2015-02-04 14:32:14 +00:00 committed by Git OBS Bridge
parent ee53cd8e9f
commit 78cdff4ab2
3 changed files with 148 additions and 2 deletions

127
libsmi-exports.patch Normal file
View File

@ -0,0 +1,127 @@
--- libsmi-0.4.8.orig/lib/Makefile.am
+++ libsmi-0.4.8/lib/Makefile.am
@@ -11,6 +11,7 @@
# @(#) $Id: Makefile.am 7735 2008-02-15 08:09:17Z schoenw $
#
+AM_CFLAGS = -fvisibility=hidden
EXTRA_DIST = parser-sming.y parser-smi.y \
scanner-sming.l scanner-smi.l \
errormacros.h data.h check.h error.h util.h \
@@ -29,10 +30,14 @@ man_MANS = libsmi.3 smi_config.3 smi_mo
smi_class.3 smi_attribute.3 smi_identity.3 \
smi_event.3
lib_LTLIBRARIES = libsmi.la
-libsmi_la_SOURCES = data.c check.c error.c util.c snprintf.c smi.c \
+noinst_LTLIBRARIES = libsmi-internal.la
+
+libsmi_la_SOURCES = data.c check.c error.c util.c smi.c \
parser-smi.c scanner-smi.c \
parser-sming.c scanner-sming.c
-libsmi_la_LDFLAGS = -version-info @VERSION_LIBTOOL@
+libsmi_la_LDFLAGS = -no-undefined -version-info @VERSION_LIBTOOL@
+
+libsmi_internal_la_SOURCES = $(libsmi_la_SOURCES)
parser-smi.c parser-smi.tab.h: parser-smi.y scanner-smi.h parser-smi.h
$(BISON) --defines=parser-smi.tab.h -t -psmi -o parser-smi.c parser-smi.y
--- libsmi-0.4.8.orig/lib/smi.h
+++ libsmi-0.4.8/lib/smi.h
@@ -16,14 +16,11 @@
#include <stdlib.h>
#include <stdarg.h>
-#ifdef HAVE_STDINT_H
#include <stdint.h>
-#endif
-#ifdef HAVE_LIMITS_H
-#include "limits.h"
-#endif
+#include <limits.h>
#include <time.h>
+#pragma GCC visibility push(default)
#ifdef __cplusplus
extern "C" {
@@ -623,9 +620,9 @@ extern int smiPack(SmiNode *row, SmiValu
* to free the allocated memory.
*/
-extern int smiAsprintf(char **strp, const char *format, ...);
+extern int smiAsprintf(char **strp, const char *format, ...) __attribute__ ((format (printf, 2, 3)));
-extern int smiVasprintf(char **strp, const char *format, va_list ap);
+extern int smiVasprintf(char **strp, const char *format, va_list ap) __attribute__ ((format (printf, 2, 0)));
/*
@@ -653,8 +650,8 @@ extern void _smiFree(char *, int, void *
#define smiFree(p) _smiFree(__FILE__, __LINE__, p)
#else
-extern void *smiMalloc(size_t size);
-extern void *smiRealloc(void *ptr, size_t size);
+extern void *smiMalloc(size_t size) __attribute((malloc, alloc_size(2)));
+extern void *smiRealloc(void *ptr, size_t size) __attribute((alloc_size(2)));
extern char *smiStrdup(const char *s1);
extern char *smiStrndup(const char *s1, size_t n);
extern void smiFree(void *ptr);
@@ -664,5 +661,6 @@ extern void smiFree(void *ptr);
}
#endif
+#pragma GCC visibility pop
#endif /* _SMI_H */
--- libsmi-0.4.8.orig/lib/smi.h.in
+++ libsmi-0.4.8/lib/smi.h.in
@@ -24,6 +24,7 @@
#endif
#include <time.h>
+#pragma GCC visibility push(default)
#ifdef __cplusplus
extern "C" {
@@ -663,6 +664,6 @@ extern void smiFree(void *ptr);
#ifdef __cplusplus
}
#endif
-
+#pragma GCC visibility pop
#endif /* _SMI_H */
--- libsmi-0.4.8.orig/lib/smi.c
+++ libsmi-0.4.8/lib/smi.c
@@ -30,7 +30,6 @@
#include "data.h"
#include "error.h"
#include "util.h"
-#include "snprintf.h"
#ifdef BACKEND_SMI
#include "scanner-smi.h"
--- libsmi-0.4.8.orig/lib/util.c
+++ libsmi-0.4.8/lib/util.c
@@ -19,8 +19,8 @@
#include <string.h>
#include <time.h>
+#include "smi.h"
#include "util.h"
-#include "snprintf.h"
#ifdef HAVE_DMALLOC_H
#include <dmalloc.h>
--- libsmi-0.4.8.orig/tools/Makefile.am
+++ libsmi-0.4.8/tools/Makefile.am
@@ -29,7 +29,7 @@ smiquery_SOURCES = smiquery.c shhopt.c
smiquery_LDADD = ../lib/libsmi.la
smilint_SOURCES = smilint.c shhopt.c
-smilint_LDADD = ../lib/libsmi.la
+smilint_LDADD = ../lib/libsmi.la ../lib/libsmi-internal.la
smixlate_SOURCES = smixlate.c shhopt.c dstring.h dstring.c
smixlate_LDADD = ../lib/libsmi.la

View File

@ -1,3 +1,17 @@
-------------------------------------------------------------------
Tue Jan 27 22:09:31 UTC 2015 - crrodriguez@opensuse.org
- fix missing pkgconfig buildRequires
- Run make check but ignore failures.
-------------------------------------------------------------------
Tue Jan 27 22:05:41 UTC 2015 - crrodriguez@opensuse.org
- libsmi-exports.patch: Export only the symbols of the public
API, specially hide and avoid using internal
vasprintf and asnprintf implementations that will
name-clash with the C library.
-------------------------------------------------------------------
Wed Jan 21 09:48:31 UTC 2015 - dimstar@opensuse.org

View File

@ -1,7 +1,7 @@
#
# spec file for package libsmi
#
# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -29,10 +29,12 @@ Patch1: libsmi-0.4.8-gnu-source.patch
Patch2: libsmi-CVE-2010-2891.patch
Patch3: libsmi-flex.patch
Patch4: libsmi-bison-3.0.patch
Patch5: libsmi-exports.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: bison
BuildRequires: flex
BuildRequires: libtool
BuildRequires: pkg-config
%description
The purpose of libsmi is to
@ -82,6 +84,7 @@ libsmi.
%patch3 -p1
%endif
%patch4 -p1
%patch5 -p1
%build
autoreconf --force --install
@ -94,9 +97,11 @@ make #%{?_smp_mflags}
%install
make install DESTDIR=%buildroot
rm -f %{buildroot}%{_libdir}/*.la
%check
make check || cat test/test-suite.log && exit 0
%post -n libsmi2 -p /sbin/ldconfig
%postun -n libsmi2 -p /sbin/ldconfig