From fcc18aad0a3f24c281a3b046e946378b303dd3fd Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 18 Sep 2012 14:05:23 -0400 Subject: [PATCH] Fix some packages that referred to gets() Glibc no longer defines gets() if _GNU_SOURCE is defined. --- .../development/libraries/gettext/default.nix | 2 + .../libraries/gettext/no-gets.patch | 42 +++++++++++++++++++ pkgs/development/tools/misc/gnum4/default.nix | 2 +- .../tools/misc/gnum4/no-gets.patch | 26 ++++++++++++ 4 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 pkgs/development/libraries/gettext/no-gets.patch create mode 100644 pkgs/development/tools/misc/gnum4/no-gets.patch diff --git a/pkgs/development/libraries/gettext/default.nix b/pkgs/development/libraries/gettext/default.nix index 73366b2bdc95..9947cf580a0d 100644 --- a/pkgs/development/libraries/gettext/default.nix +++ b/pkgs/development/libraries/gettext/default.nix @@ -8,6 +8,8 @@ stdenv.mkDerivation (rec { sha256 = "1sa3ch12qxa4h3ya6hkz119yclcccmincl9j20dhrdx5mykp3b4k"; }; + patches = [ ./no-gets.patch ]; + configureFlags = [ "--disable-csharp" ] ++ (stdenv.lib.optionals stdenv.isCygwin [ # We have a static libiconv, so we can only build the static lib. diff --git a/pkgs/development/libraries/gettext/no-gets.patch b/pkgs/development/libraries/gettext/no-gets.patch new file mode 100644 index 000000000000..9daa48eae649 --- /dev/null +++ b/pkgs/development/libraries/gettext/no-gets.patch @@ -0,0 +1,42 @@ +hack until gzip pulls a newer gnulib version + +From 66712c23388e93e5c518ebc8515140fa0c807348 Mon Sep 17 00:00:00 2001 +From: Eric Blake +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. + +--- a/gettext-tools/libgettextpo/stdio.in.h ++++ b/gettext-tools/libgettextpo/stdio.in.h +@@ -125,7 +125,6 @@ + so any use of gets warrants an unconditional warning. Assume it is + always declared, since it is required by C89. */ + #undef gets +-_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); + + #if @GNULIB_FOPEN@ + # if @REPLACE_FOPEN@ +--- a/gettext-tools/gnulib-lib/stdio.in.h ++++ b/gettext-tools/gnulib-lib/stdio.in.h +@@ -125,7 +125,6 @@ + so any use of gets warrants an unconditional warning. Assume it is + always declared, since it is required by C89. */ + #undef gets +-_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); + + #if @GNULIB_FOPEN@ + # if @REPLACE_FOPEN@ +--- a/gettext-runtime/gnulib-lib/stdio.in.h ++++ b/gettext-runtime/gnulib-lib/stdio.in.h +@@ -125,7 +125,6 @@ + so any use of gets warrants an unconditional warning. Assume it is + always declared, since it is required by C89. */ + #undef gets +-_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); + + #if @GNULIB_FOPEN@ + # if @REPLACE_FOPEN@ diff --git a/pkgs/development/tools/misc/gnum4/default.nix b/pkgs/development/tools/misc/gnum4/default.nix index 1f026f12f523..d1b0d0e376ed 100644 --- a/pkgs/development/tools/misc/gnum4/default.nix +++ b/pkgs/development/tools/misc/gnum4/default.nix @@ -13,7 +13,7 @@ stdenv.mkDerivation { && !stdenv.isSunOS; # XXX: `test-setlocale2.sh' fails # Upstream is aware of it; it may be in the next release. - patches = [ ./s_isdir.patch ./readlink-EINVAL.patch ]; + patches = [ ./s_isdir.patch ./readlink-EINVAL.patch ./no-gets.patch ]; meta = { homepage = http://www.gnu.org/software/m4/; diff --git a/pkgs/development/tools/misc/gnum4/no-gets.patch b/pkgs/development/tools/misc/gnum4/no-gets.patch new file mode 100644 index 000000000000..456c08b56c34 --- /dev/null +++ b/pkgs/development/tools/misc/gnum4/no-gets.patch @@ -0,0 +1,26 @@ +http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-devel/m4/files/m4-1.4.16-no-gets.patch?revision=1.1 + +https://bugs.gentoo.org/424978 + +hack until m4 pulls a newer gnulib version + +From 66712c23388e93e5c518ebc8515140fa0c807348 Mon Sep 17 00:00:00 2001 +From: Eric Blake +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. + +--- a/lib/stdio.in.h ++++ b/lib/stdio.in.h +@@ -125,7 +125,6 @@ + so any use of gets warrants an unconditional warning. Assume it is + always declared, since it is required by C89. */ + #undef gets +-_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); + + #if @GNULIB_FOPEN@ + # if @REPLACE_FOPEN@