summary refs log tree commit diff
path: root/pkgs/development/libraries/glibc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2015-12-02 10:53:41 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2015-12-02 11:27:39 +0100
commit6a766f47c22503ba0bb355547e96a64cbcb38ec6 (patch)
treeeb6ff55b57abfd880fc49760417fbab00d188461 /pkgs/development/libraries/glibc
parentc20b6846f2ec4b1fe70d62fe99d165476aed65d0 (diff)
downloadnixlib-6a766f47c22503ba0bb355547e96a64cbcb38ec6.tar
nixlib-6a766f47c22503ba0bb355547e96a64cbcb38ec6.tar.gz
nixlib-6a766f47c22503ba0bb355547e96a64cbcb38ec6.tar.bz2
nixlib-6a766f47c22503ba0bb355547e96a64cbcb38ec6.tar.lz
nixlib-6a766f47c22503ba0bb355547e96a64cbcb38ec6.tar.xz
nixlib-6a766f47c22503ba0bb355547e96a64cbcb38ec6.tar.zst
nixlib-6a766f47c22503ba0bb355547e96a64cbcb38ec6.zip
glibc: Fix assertion failure when using incompatible locale data
Borrowed from

  http://git.savannah.gnu.org/cgit/guix.git/plain/gnu/packages/patches/glibc-locale-incompatibility.patch

https://github.com/NixOS/nix/issues/599

We may also want to apply

  http://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/patches/glibc-versioned-locpath.patch

but we'll need to ditch locale-archive first. (Apparently
locale-archive is not very useful anymore anyway.)
Diffstat (limited to 'pkgs/development/libraries/glibc')
-rw-r--r--pkgs/development/libraries/glibc/common.nix2
-rw-r--r--pkgs/development/libraries/glibc/glibc-locale-incompatibility.patch25
2 files changed, 27 insertions, 0 deletions
diff --git a/pkgs/development/libraries/glibc/common.nix b/pkgs/development/libraries/glibc/common.nix
index cf356ccefbed..26d2f2454b45 100644
--- a/pkgs/development/libraries/glibc/common.nix
+++ b/pkgs/development/libraries/glibc/common.nix
@@ -61,6 +61,8 @@ stdenv.mkDerivation ({
       ./security-bdf1ff05.patch
       ./cve-2014-8121.patch
       ./cve-2015-1781.patch
+
+      ./glibc-locale-incompatibility.patch
     ];
 
   postPatch =
diff --git a/pkgs/development/libraries/glibc/glibc-locale-incompatibility.patch b/pkgs/development/libraries/glibc/glibc-locale-incompatibility.patch
new file mode 100644
index 000000000000..8ca2ce4cd88a
--- /dev/null
+++ b/pkgs/development/libraries/glibc/glibc-locale-incompatibility.patch
@@ -0,0 +1,25 @@
+http://git.savannah.gnu.org/cgit/guix.git/plain/gnu/packages/patches/glibc-locale-incompatibility.patch
+
+This patch avoids an assertion failure when incompatible locale data
+is encountered:
+
+  https://sourceware.org/ml/libc-alpha/2015-09/msg00575.html
+
+--- glibc-2.22/locale/loadlocale.c	2015-09-22 17:16:02.321981548 +0200
++++ glibc-2.22/locale/loadlocale.c	2015-09-22 17:17:34.814659064 +0200
+@@ -120,10 +120,11 @@
+ 	 _nl_value_type_LC_XYZ array.  There are all pointers.  */
+       switch (category)
+ 	{
+-#define CATTEST(cat) \
+-	case LC_##cat:							      \
+-	  assert (cnt < (sizeof (_nl_value_type_LC_##cat)		      \
+-			 / sizeof (_nl_value_type_LC_##cat[0])));	      \
++#define CATTEST(cat)						\
++	case LC_##cat:						\
++	  if (cnt >= (sizeof (_nl_value_type_LC_##cat)		\
++		      / sizeof (_nl_value_type_LC_##cat[0])))	\
++	    goto puntdata;					\
+ 	  break
+ 	  CATTEST (NUMERIC);
+ 	  CATTEST (TIME);