···11{ stdenv, fetchurl, coreutils ? null }:
2233-stdenv.mkDerivation {
44- name = "diffutils-3.2";
33+stdenv.mkDerivation rec {
44+ name = "diffutils-3.3";
5566 src = fetchurl {
77- url = mirror://gnu/diffutils/diffutils-3.2.tar.gz;
88- sha256 = "1lsf0ln0h3mnm2y0mwgrfk0lyfi7bnm4r886acvdrrsvc7pypaia";
77+ url = "mirror://gnu/diffutils/${name}.tar.xz";
88+ sha256 = "1761vymxbp4wb5rzjvabhdkskk95pghnn67464byvzb5mfl8jpm2";
99 };
1010-1111- patches = [ ./gets-undeclared.patch ];
12101311 /* If no explicit coreutils is given, use the one from stdenv. */
1412 nativeBuildInputs = [ coreutils ];
-71
pkgs/tools/text/diffutils/gets-undeclared.patch
···11-This patch is needed to allow builds with newer versions of
22-the GNU libc (2.16+).
33-44-55-commit 66712c23388e93e5c518ebc8515140fa0c807348
66-Author: Eric Blake <eblake@redhat.com>
77-Date: Thu Mar 29 13:30:41 2012 -0600
88-99- stdio: don't assume gets any more
1010-1111- Gnulib intentionally does not have a gets module, and now that C11
1212- and glibc have dropped it, we should be more proactive about warning
1313- any user on a platform that still has a declaration of this dangerous
1414- interface.
1515-1616- * m4/stdio_h.m4 (gl_STDIO_H, gl_STDIO_H_DEFAULTS): Drop gets
1717- support.
1818- * modules/stdio (Makefile.am): Likewise.
1919- * lib/stdio-read.c (gets): Likewise.
2020- * tests/test-stdio-c++.cc: Likewise.
2121- * m4/warn-on-use.m4 (gl_WARN_ON_USE_PREPARE): Fix comment.
2222- * lib/stdio.in.h (gets): Make warning occur in more places.
2323- * doc/posix-functions/gets.texi (gets): Update documentation.
2424- Reported by Christer Solskogen.
2525-2626- Signed-off-by: Eric Blake <eblake@redhat.com>
2727-2828-diff --git a/lib/stdio.in.h b/lib/stdio.in.h
2929-index aa7b599..c377b6e 100644
3030---- a/lib/stdio.in.h
3131-+++ b/lib/stdio.in.h
3232-@@ -698,22 +698,11 @@ _GL_WARN_ON_USE (getline, "getline is unportable - "
3333- # endif
3434- #endif
3535-3636--#if @GNULIB_GETS@
3737--# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
3838--# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
3939--# undef gets
4040--# define gets rpl_gets
4141--# endif
4242--_GL_FUNCDECL_RPL (gets, char *, (char *s) _GL_ARG_NONNULL ((1)));
4343--_GL_CXXALIAS_RPL (gets, char *, (char *s));
4444--# else
4545--_GL_CXXALIAS_SYS (gets, char *, (char *s));
4646--# undef gets
4747--# endif
4848--_GL_CXXALIASWARN (gets);
4949- /* It is very rare that the developer ever has full control of stdin,
5050-- so any use of gets warrants an unconditional warning. Assume it is
5151-- always declared, since it is required by C89. */
5252-+ so any use of gets warrants an unconditional warning; besides, C11
5353-+ removed it. */
5454-+#undef gets
5555-+#if HAVE_RAW_DECL_GETS
5656- _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
5757- #endif
5858-5959-@@ -1053,9 +1042,9 @@ _GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
6060- # endif
6161- #endif
6262-6363--/* Some people would argue that sprintf should be handled like gets
6464-- (for example, OpenBSD issues a link warning for both functions),
6565-- since both can cause security holes due to buffer overruns.
6666-+/* Some people would argue that all sprintf uses should be warned about
6767-+ (for example, OpenBSD issues a link warning for it),
6868-+ since it can cause security holes due to buffer overruns.
6969- However, we believe that sprintf can be used safely, and is more
7070- efficient than snprintf in those safe cases; and as proof of our
7171- belief, we use sprintf in several gnulib modules. So this header