diff --git a/libsmi-c99.patch b/libsmi-c99.patch new file mode 100644 index 0000000..6ffead5 --- /dev/null +++ b/libsmi-c99.patch @@ -0,0 +1,36 @@ +Do not define _ISOC11_SOURCE in parser-sming.y + +It overrides _DEFAULT_SOURCE, thereby hiding the declaration of timegm +in . This will result in build failures with future compilers +that do not support implicit function declarations. + +Submitted upstream: + + + +diff --git a/lib/parser-sming.c b/lib/parser-sming.c +index 823b5a73773275f7..00a1391820f21a16 100644 +--- a/lib/parser-sming.c ++++ b/lib/parser-sming.c +@@ -227,7 +227,7 @@ + + #ifdef BACKEND_SMING + +-#define _ISOC99_SOURCE ++ + #include + #include + #include +diff --git a/lib/parser-sming.y b/lib/parser-sming.y +index 555e570613ad689f..32bddeac93eac7e8 100644 +--- a/lib/parser-sming.y ++++ b/lib/parser-sming.y +@@ -17,7 +17,7 @@ + + #ifdef BACKEND_SMING + +-#define _ISOC99_SOURCE ++ + #include + #include + #include diff --git a/libsmi-configure-c99.patch b/libsmi-configure-c99.patch new file mode 100644 index 0000000..10f7e00 --- /dev/null +++ b/libsmi-configure-c99.patch @@ -0,0 +1,60 @@ +Avoid implicit ints and implicit function declarations, to prevent +build failures with future compilers. + +It's not clear if old compilers really use for the exit +function. Most of these checks would be better served by using +#error, so that they can use AC_TRY_LINK and be compatible with +cross-compilation. + +Submitted upstream: + + + +diff --git a/configure.in b/configure.in +index 9b678e2d915a789d..c032538163bd05ab 100644 +--- a/configure.in ++++ b/configure.in +@@ -42,8 +42,8 @@ AC_ARG_WITH(cc, + CC="$withval") + + AC_MSG_CHECKING([for additional required compiler flags]) +-AC_TRY_RUN([#include +- main() { ++AC_TRY_RUN([#include ++ int main(void) { + #ifdef __SUNPRO_C + exit(0); + #else +@@ -100,8 +100,8 @@ dirseparator="$withval", dirseparator="") + + AC_MSG_CHECKING([for path separator character]) + if test "$pathseparator" = "" ; then +- AC_TRY_RUN([#include +- main() { ++ AC_TRY_RUN([#include ++ int main(void) { + #ifdef _WIN32 + exit(0); + #else +@@ -114,8 +114,8 @@ echo $pathseparator + + AC_MSG_CHECKING([for dir separator character]) + if test "$dirseparator" = "" ; then +- AC_TRY_RUN([#include +- main() { ++ AC_TRY_RUN([#include ++ int main(void) { + #ifdef _WIN32 + exit(0); + #else +@@ -140,8 +140,8 @@ AC_MSG_CHECKING([for 64 bit types]) + # "warning: decimal constant is so large that it is unsigned" + # if used with the (correct) value -9223372036854775808LL. + # +-AC_TRY_RUN([#include +- main() { ++AC_TRY_RUN([#include ++ int main(void) { + long long ll; + unsigned long long ull; + exit(0); diff --git a/libsmi.spec b/libsmi.spec index b97b181..dab7240 100644 --- a/libsmi.spec +++ b/libsmi.spec @@ -1,6 +1,6 @@ Name: libsmi Version: 0.4.8 -Release: 32%{?dist} +Release: 33%{?dist} Summary: A library to access SMI MIB information License: GPLv2+ and BSD @@ -12,6 +12,8 @@ Patch0: libsmi-0.4.8-wget111.patch Patch1: libsmi-0.4.8-CVE-2010-2891.patch Patch2: libsmi-0.4.8-symbols-clash.patch Patch3: libsmi-0.4.8-format-security-fix.patch +Patch4: libsmi-configure-c99.patch +Patch5: libsmi-c99.patch BuildRequires: libtool BuildRequires: flex, bison @@ -47,9 +49,15 @@ libsmi-based applications. %patch1 -p1 -b .CVE-2010-2891 %patch2 -p1 -b .clash %patch3 -p1 -b .format-security +%patch4 -p1 +%patch5 -p1 +# Avoid re-running bison. The regeneration appears to break the generated +# C code. +touch -r lib/parser-sming.y lib/parser-sming.c cp %{SOURCE2} . %build +autoreconf -iv %configure \ --enable-smi \ --enable-sming \ @@ -98,6 +106,9 @@ make check ||: %changelog +* Fri Apr 14 2023 Florian Weimer - 0.4.8-33 +- Port to C99 + * Thu Jan 19 2023 Fedora Release Engineering - 0.4.8-32 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild