Fix building with glibc-2.16.6

This commit is contained in:
Petr Písař 2012-08-08 14:42:02 +02:00
parent 3bd2e5b0b4
commit 86ed2bd0d6
2 changed files with 86 additions and 1 deletions

View File

@ -0,0 +1,75 @@
From f5fab01434b096b3bc2b058fec41123392eb3dcb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Wed, 8 Aug 2012 14:13:16 +0200
Subject: [PATCH] Fix building with glibc-2.16.6
Ported to libprelude-1.0.0 from gnulib commit:
From 66712c23388e93e5c518ebc8515140fa0c807348 Mon Sep 17 00:00:00 2001
From: Eric Blake <eblake@redhat.com>
Date: Thu, 29 Mar 2012 13:30:41 -0600
Subject: [PATCH] stdio: don't assume gets any more
Gnulib intentionally does not have a gets module, and now that C11
and glibc have dropped it, we should be more proactive about warning
any user on a platform that still has a declaration of this dangerous
interface.
---
libmissing/m4/stdio_h.m4 | 4 ++--
libmissing/m4/warn-on-use.m4 | 4 ++--
libmissing/stdio.in.h | 6 ++++--
3 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/libmissing/m4/stdio_h.m4 b/libmissing/m4/stdio_h.m4
index 781fa8d..fc65d37 100644
--- a/libmissing/m4/stdio_h.m4
+++ b/libmissing/m4/stdio_h.m4
@@ -34,9 +34,9 @@ AC_DEFUN([gl_STDIO_H],
dnl Check for declarations of anything we want to poison if the
dnl corresponding gnulib module is not in use, and which is not
- dnl guaranteed by C89.
+ dnl guaranteed by both C89 and C11.
gl_WARN_ON_USE_PREPARE([[#include <stdio.h>
- ]], [dprintf fpurge fseeko ftello getdelim getline popen renameat
+ ]], [dprintf fpurge fseeko ftello getdelim getline gets popen renameat
snprintf vdprintf vsnprintf])
])
diff --git a/libmissing/m4/warn-on-use.m4 b/libmissing/m4/warn-on-use.m4
index ab46422..494e00b 100644
--- a/libmissing/m4/warn-on-use.m4
+++ b/libmissing/m4/warn-on-use.m4
@@ -18,8 +18,8 @@ dnl with or without modifications, as long as this notice is preserved.
# some systems declare functions in the wrong header, then INCLUDES
# should do likewise.
#
-# If you assume C89, then it is generally safe to assume declarations
-# for functions declared in that standard (such as gets) without
+# It is generally safe to assume declarations for functions declared
+# in the intersection of C89 and C11 (such as printf) without
# needing gl_WARN_ON_USE_PREPARE.
AC_DEFUN([gl_WARN_ON_USE_PREPARE],
[
diff --git a/libmissing/stdio.in.h b/libmissing/stdio.in.h
index f5d5d88..6924ef2 100644
--- a/libmissing/stdio.in.h
+++ b/libmissing/stdio.in.h
@@ -114,10 +114,12 @@ _GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - "
#endif
/* It is very rare that the developer ever has full control of stdin,
- so any use of gets warrants an unconditional warning. Assume it is
- always declared, since it is required by C89. */
+ so any use of gets warrants an unconditional warning; besides, C11
+ removed it. */
#undef gets
+#if HAVE_RAW_DECL_GETS
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+#endif
#if @GNULIB_FOPEN@
# if @REPLACE_FOPEN@
--
1.7.11.2

View File

@ -4,15 +4,19 @@
Name: libpreludedb
Epoch: 1
Version: 1.0.0
Release: 12%{?dist}
Release: 13%{?dist}
Summary: Provide the framework for easy access to the Prelude database
Group: System Environment/Libraries
License: GPLv2+
URL: http://prelude-ids.org/
Source0: http://prelude-ids.org/download/releases/%{name}/%{name}-%{version}.tar.gz
# Adjust bundled gnulib to pass compilation with glibc-2.16.6, bug #839607
Patch0: libprelude-1.0.0-Fix-building-with-glibc-2.16.6.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: libprelude-devel python-devel perl-devel
BuildRequires: sqlite-devel mysql-devel, postgresql-devel
# For libprelude-1.0.0-Fix-building-with-glibc-2.16.6.patch:
BuildRequires: autoconf, automake
%description
The PreludeDB Library provides an abstraction layer upon the type and the
@ -77,6 +81,9 @@ Perl bindings for libpreludedb.
%prep
%setup -q
# For libprelude-1.0.0-Fix-building-with-glibc-2.16.6.patch
%patch0 -p1
autoreconf
%build
@ -164,6 +171,9 @@ rm -rf %{buildroot}
%changelog
* Wed Aug 08 2012 Petr Pisar <ppisar@redhat.com> - 1:1.0.0-13
- Fix building with glibc-2.16.6 (bug #839607)
* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1:1.0.0-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild