On Thu, Nov 15, 2012 at 04:33:43PM +0000, Wookey wrote:
> Diffutils doesn't build with eglibc2.16 due to gets finally being
> removed but the gnulib in the package not knowing about this. The
> patch has links to upstream bugs.
> 
> A new diffutils release with new gnulib is the right fix for this, but
> this simple nobbling works in the meantime (and allows the arm64
> bootstrap to progress)

Here's a somewhat different nobbling which I applied in Ubuntu.  I think
this is a bit closer to the upstream gnulib fix.

  * Avoid assuming that gets is declared.

diff -Nru diffutils-3.2/debian/patches/gnulib-gets 
diffutils-3.2/debian/patches/gnulib-gets
--- diffutils-3.2/debian/patches/gnulib-gets    1970-01-01 01:00:00.000000000 
+0100
+++ diffutils-3.2/debian/patches/gnulib-gets    2012-10-30 16:39:44.000000000 
+0000
@@ -0,0 +1,141 @@
+Description: Avoid assuming that gets is declared
+Origin: backport, 
http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=commitdiff;h=66712c23388e93e5c518ebc8515140fa0c807348
+Forwarded: no
+Last-Update: 2012-10-30
+
+Index: b/lib/stdio.in.h
+===================================================================
+--- a/lib/stdio.in.h
++++ b/lib/stdio.in.h
+@@ -681,22 +681,11 @@
+ # endif
+ #endif
+ 
+-#if @GNULIB_GETS@
+-# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
+-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+-#   undef gets
+-#   define gets rpl_gets
+-#  endif
+-_GL_FUNCDECL_RPL (gets, char *, (char *s) _GL_ARG_NONNULL ((1)));
+-_GL_CXXALIAS_RPL (gets, char *, (char *s));
+-# else
+-_GL_CXXALIAS_SYS (gets, char *, (char *s));
+-#  undef gets
+-# endif
+-_GL_CXXALIASWARN (gets);
+ /* 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
+ 
+@@ -1018,9 +1007,9 @@
+ # endif
+ #endif
+ 
+-/* Some people would argue that sprintf should be handled like gets
+-   (for example, OpenBSD issues a link warning for both functions),
+-   since both can cause security holes due to buffer overruns.
++/* Some people would argue that all sprintf uses should be warned about
++   (for example, OpenBSD issues a link warning for it),
++   since it can cause security holes due to buffer overruns.
+    However, we believe that sprintf can be used safely, and is more
+    efficient than snprintf in those safe cases; and as proof of our
+    belief, we use sprintf in several gnulib modules.  So this header
+Index: b/m4/stdio_h.m4
+===================================================================
+--- a/m4/stdio_h.m4
++++ b/m4/stdio_h.m4
+@@ -18,7 +18,6 @@
+   GNULIB_GETC=1
+   GNULIB_GETCHAR=1
+   GNULIB_FGETS=1
+-  GNULIB_GETS=1
+   GNULIB_FREAD=1
+   dnl This ifdef is necessary to avoid an error "missing file 
lib/stdio-read.c"
+   dnl "expected source file, required through AC_LIBSOURCES, not found". It is
+@@ -72,9 +71,9 @@
+ 
+   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 tmpfile vdprintf vsnprintf])
+ ])
+ 
+@@ -112,7 +111,6 @@
+   GNULIB_GETCHAR=0;              AC_SUBST([GNULIB_GETCHAR])
+   GNULIB_GETDELIM=0;             AC_SUBST([GNULIB_GETDELIM])
+   GNULIB_GETLINE=0;              AC_SUBST([GNULIB_GETLINE])
+-  GNULIB_GETS=0;                 AC_SUBST([GNULIB_GETS])
+   GNULIB_OBSTACK_PRINTF=0;       AC_SUBST([GNULIB_OBSTACK_PRINTF])
+   GNULIB_OBSTACK_PRINTF_POSIX=0; AC_SUBST([GNULIB_OBSTACK_PRINTF_POSIX])
+   GNULIB_PERROR=0;               AC_SUBST([GNULIB_PERROR])
+Index: b/m4/warn-on-use.m4
+===================================================================
+--- a/m4/warn-on-use.m4
++++ b/m4/warn-on-use.m4
+@@ -1,5 +1,5 @@
+-# warn-on-use.m4 serial 4
+-dnl Copyright (C) 2010-2011 Free Software Foundation, Inc.
++# warn-on-use.m4 serial 5
++dnl Copyright (C) 2010-2012 Free Software Foundation, Inc.
+ dnl This file is free software; the Free Software Foundation
+ dnl gives unlimited permission to copy and/or distribute it,
+ dnl with or without modifications, as long as this notice is preserved.
+@@ -18,8 +18,8 @@
+ # 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],
+ [
+Index: b/configure
+===================================================================
+--- a/configure
++++ b/configure
+@@ -1078,7 +1078,6 @@
+ GNULIB_PERROR
+ GNULIB_OBSTACK_PRINTF_POSIX
+ GNULIB_OBSTACK_PRINTF
+-GNULIB_GETS
+ GNULIB_GETLINE
+ GNULIB_GETDELIM
+ GNULIB_GETCHAR
+@@ -10006,7 +10005,6 @@
+   GNULIB_GETCHAR=0;
+   GNULIB_GETDELIM=0;
+   GNULIB_GETLINE=0;
+-  GNULIB_GETS=0;
+   GNULIB_OBSTACK_PRINTF=0;
+   GNULIB_OBSTACK_PRINTF_POSIX=0;
+   GNULIB_PERROR=0;
+@@ -22530,7 +22528,6 @@
+   GNULIB_GETC=1
+   GNULIB_GETCHAR=1
+   GNULIB_FGETS=1
+-  GNULIB_GETS=1
+   GNULIB_FREAD=1
+ 
+ 
+@@ -22548,7 +22545,7 @@
+ 
+ 
+ 
+-    for gl_func in dprintf fpurge fseeko ftello getdelim getline popen 
renameat     snprintf tmpfile vdprintf vsnprintf; do
++    for gl_func in dprintf fpurge fseeko ftello getdelim getline gets popen 
renameat     snprintf tmpfile vdprintf vsnprintf; do
+     as_gl_Symbol=`$as_echo "gl_cv_have_raw_decl_$gl_func" | $as_tr_sh`
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $gl_func is 
declared without a macro" >&5
+ $as_echo_n "checking whether $gl_func is declared without a macro... " >&6; }
diff -Nru diffutils-3.2/debian/patches/series 
diffutils-3.2/debian/patches/series
--- diffutils-3.2/debian/patches/series 2012-10-04 17:14:44.000000000 +0100
+++ diffutils-3.2/debian/patches/series 2012-10-30 16:31:45.000000000 +0000
@@ -1,3 +1,4 @@
 01-no-usr-share-info-dir-gz
 02-gnulib-fix-for-float-in-powerpc
 99-config-guess-config-sub
+gnulib-gets

-- 
Colin Watson                                       [[email protected]]


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to