summary refs log tree commit diff
path: root/pkgs/development/libraries/glibc
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/libraries/glibc')
-rw-r--r--pkgs/development/libraries/glibc/2.25-49.patch.gzbin89721 -> 0 bytes
-rw-r--r--pkgs/development/libraries/glibc/2.26-115to131.diff.gzbin0 -> 20022 bytes
-rw-r--r--pkgs/development/libraries/glibc/2.26-75.patch.gzbin0 -> 289084 bytes
-rw-r--r--pkgs/development/libraries/glibc/2.26-75to115.diff.gzbin0 -> 32865 bytes
-rw-r--r--pkgs/development/libraries/glibc/allow-kernel-2.6.32.patch39
-rw-r--r--pkgs/development/libraries/glibc/common.nix91
-rw-r--r--pkgs/development/libraries/glibc/dont-use-system-ld-so-cache.patch38
-rw-r--r--pkgs/development/libraries/glibc/locales.nix4
-rw-r--r--pkgs/development/libraries/glibc/nix-locale-archive.patch122
9 files changed, 168 insertions, 126 deletions
diff --git a/pkgs/development/libraries/glibc/2.25-49.patch.gz b/pkgs/development/libraries/glibc/2.25-49.patch.gz
deleted file mode 100644
index 6796347e3795..000000000000
--- a/pkgs/development/libraries/glibc/2.25-49.patch.gz
+++ /dev/null
Binary files differdiff --git a/pkgs/development/libraries/glibc/2.26-115to131.diff.gz b/pkgs/development/libraries/glibc/2.26-115to131.diff.gz
new file mode 100644
index 000000000000..3d866c567a79
--- /dev/null
+++ b/pkgs/development/libraries/glibc/2.26-115to131.diff.gz
Binary files differdiff --git a/pkgs/development/libraries/glibc/2.26-75.patch.gz b/pkgs/development/libraries/glibc/2.26-75.patch.gz
new file mode 100644
index 000000000000..e2a8867e4fff
--- /dev/null
+++ b/pkgs/development/libraries/glibc/2.26-75.patch.gz
Binary files differdiff --git a/pkgs/development/libraries/glibc/2.26-75to115.diff.gz b/pkgs/development/libraries/glibc/2.26-75to115.diff.gz
new file mode 100644
index 000000000000..9bf1a4f7d39b
--- /dev/null
+++ b/pkgs/development/libraries/glibc/2.26-75to115.diff.gz
Binary files differdiff --git a/pkgs/development/libraries/glibc/allow-kernel-2.6.32.patch b/pkgs/development/libraries/glibc/allow-kernel-2.6.32.patch
new file mode 100644
index 000000000000..ce18b874c427
--- /dev/null
+++ b/pkgs/development/libraries/glibc/allow-kernel-2.6.32.patch
@@ -0,0 +1,39 @@
+diff --git a/sysdeps/unix/sysv/linux/configure b/sysdeps/unix/sysv/linux/configure
+index cace758c01..38fe7fe0b0 100644
+--- a/sysdeps/unix/sysv/linux/configure
++++ b/sysdeps/unix/sysv/linux/configure
+@@ -69,7 +69,7 @@ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for kernel header at least $minimum_kernel" >&5
+ $as_echo_n "checking for kernel header at least $minimum_kernel... " >&6; }
+ decnum=`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/(\1 * 65536 + \2 * 256 + \3)/'`;
+-abinum=`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1,\2,\3/'`;
++abinum=`echo "2.6.32.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1,\2,\3/'`;
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ #include <linux/version.h>
+diff --git a/sysdeps/unix/sysv/linux/configure.ac b/sysdeps/unix/sysv/linux/configure.ac
+index 13abda0a51..6abc12eaed 100644
+--- a/sysdeps/unix/sysv/linux/configure.ac
++++ b/sysdeps/unix/sysv/linux/configure.ac
+@@ -50,7 +50,7 @@ fi
+ AC_MSG_CHECKING(for kernel header at least $minimum_kernel)
+ changequote(,)dnl
+ decnum=`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/(\1 * 65536 + \2 * 256 + \3)/'`;
+-abinum=`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1,\2,\3/'`;
++abinum=`echo "2.6.32.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1,\2,\3/'`;
+ changequote([,])dnl
+ AC_TRY_COMPILE([#include <linux/version.h>
+ #if LINUX_VERSION_CODE < $decnum
+diff --git a/sysdeps/unix/sysv/linux/dl-osinfo.h b/sysdeps/unix/sysv/linux/dl-osinfo.h
+index 823cd8224d..482caaeeec 100644
+--- a/sysdeps/unix/sysv/linux/dl-osinfo.h
++++ b/sysdeps/unix/sysv/linux/dl-osinfo.h
+@@ -39,7 +39,7 @@
+ 	  GLRO(dl_osversion) = version;					      \
+ 									      \
+ 	/* Now we can test with the required version.  */		      \
+-	if (__LINUX_KERNEL_VERSION > 0 && version < __LINUX_KERNEL_VERSION)   \
++	if (__LINUX_KERNEL_VERSION > 0 && version < __LINUX_KERNEL_VERSION && version != 0x020620)   \
+ 	  /* Not sufficent.  */						      \
+ 	  FATAL ("FATAL: kernel too old\n");				      \
+       }									      \
diff --git a/pkgs/development/libraries/glibc/common.nix b/pkgs/development/libraries/glibc/common.nix
index f0a7e5703e95..c8716bfdc796 100644
--- a/pkgs/development/libraries/glibc/common.nix
+++ b/pkgs/development/libraries/glibc/common.nix
@@ -20,9 +20,10 @@
 { stdenv, lib
 , buildPlatform, hostPlatform
 , buildPackages
-, fetchurl
+, fetchurl, fetchpatch ? null
 , linuxHeaders ? null
 , gd ? null, libpng ? null
+, bison
 }:
 
 { name
@@ -35,9 +36,9 @@
 } @ args:
 
 let
-  version = "2.25";
-  patchSuffix = "-49";
-  sha256 = "067bd9bb3390e79aa45911537d13c3721f1d9d3769931a30c2681bfee66f23a0";
+  version = "2.27";
+  patchSuffix = "";
+  sha256 = "0wpwq7gsm7sd6ysidv0z575ckqdg13cr2njyfgrbgh4f65adwwji";
   cross = if buildPlatform != hostPlatform then hostPlatform else null;
 in
 
@@ -45,7 +46,7 @@ assert withLinuxHeaders -> linuxHeaders != null;
 assert withGd -> gd != null && libpng != null;
 
 stdenv.mkDerivation ({
-  inherit  installLocales;
+  inherit version installLocales;
   linuxHeaders = if withLinuxHeaders then linuxHeaders else null;
 
   # The host/target system.
@@ -57,13 +58,6 @@ stdenv.mkDerivation ({
 
   patches =
     [
-      /*  No tarballs for stable upstream branch, only https://sourceware.org/git/?p=glibc.git
-          $ git co release/2.25/master; git describe
-          glibc-2.25-49-gbc5ace67fe
-          $ git show --reverse glibc-2.25..release/2.25/master | gzip -n -9 --rsyncable - > 2.25-49.patch.gz
-      */
-      ./2.25-49.patch.gz
-
       /* Have rpcgen(1) look for cpp(1) in $PATH.  */
       ./rpcgen-path.patch
 
@@ -80,33 +74,49 @@ stdenv.mkDerivation ({
          "/bin:/usr/bin", which is inappropriate on NixOS machines. This
          patch extends the search path by "/run/current-system/sw/bin". */
       ./fix_path_attribute_in_getconf.patch
+
+      /* Allow running with RHEL 6 -like kernels.  The patch adds an exception
+        for glibc to accept 2.6.32 and to tag the ELFs as 2.6.32-compatible
+        (otherwise the loader would refuse libc).
+        Note that glibc will fully work only on their heavily patched kernels
+        and we lose early mismatch detection on 2.6.32.
+
+        On major glibc updates we should check that the patched kernel supports
+        all the required features.  ATM it's verified up to glibc-2.26-131.
+        # HOWTO: check glibc sources for changes in kernel requirements
+        git log -p glibc-2.25.. sysdeps/unix/sysv/linux/x86_64/kernel-features.h sysdeps/unix/sysv/linux/kernel-features.h
+        # get kernel sources (update the URL)
+        mkdir tmp && cd tmp
+        curl http://vault.centos.org/6.9/os/Source/SPackages/kernel-2.6.32-696.el6.src.rpm | rpm2cpio - | cpio -idmv
+        tar xf linux-*.bz2
+        # check syscall presence, for example
+        less linux-*?/arch/x86/kernel/syscall_table_32.S
+       */
+      ./allow-kernel-2.6.32.patch
     ]
-    ++ lib.optional stdenv.isx86_64 ./fix-x64-abi.patch;
+    ++ lib.optional stdenv.isx86_64 ./fix-x64-abi.patch
+    ++ lib.optional stdenv.hostPlatform.isMusl
+      (fetchpatch {
+        name = "fix-with-musl.patch";
+        url = "https://sourceware.org/bugzilla/attachment.cgi?id=10151&action=diff&collapsed=&headers=1&format=raw";
+        sha256 = "18kk534k6da5bkbsy1ivbi77iin76lsna168mfcbwv4ik5vpziq2";
+      });
 
   postPatch =
-    # Needed for glibc to build with the gnumake 3.82
-    # http://comments.gmane.org/gmane.linux.lfs.support/31227
     ''
+      # Needed for glibc to build with the gnumake 3.82
+      # http://comments.gmane.org/gmane.linux.lfs.support/31227
       sed -i 's/ot \$/ot:\n\ttouch $@\n$/' manual/Makefile
-    ''
-    # nscd needs libgcc, and we don't want it dynamically linked
-    # because we don't want it to depend on bootstrap-tools libs.
-    + ''
+
+      # nscd needs libgcc, and we don't want it dynamically linked
+      # because we don't want it to depend on bootstrap-tools libs.
       echo "LDFLAGS-nscd += -static-libgcc" >> nscd/Makefile
-    ''
-    # Replace the date and time in nscd by a prefix of $out.
-    # It is used as a protocol compatibility check.
-    # Note: the size of the struct changes, but using only a part
-    # would break hash-rewriting. When receiving stats it does check
-    # that the struct sizes match and can't cause overflow or something.
-    + ''
-      cat ${./glibc-remove-datetime-from-nscd.patch} \
-        | sed "s,@out@,$out," | patch -p1
     '';
 
   configureFlags =
     [ "-C"
       "--enable-add-ons"
+      "--enable-obsolete-nsl"
       "--enable-obsolete-rpc"
       "--sysconfdir=/etc"
       "--enable-stackguard-randomization"
@@ -116,15 +126,11 @@ stdenv.mkDerivation ({
       (if profilingLibraries
        then "--enable-profile"
        else "--disable-profile")
-    ] ++ lib.optionals (cross == null && withLinuxHeaders) [
-      "--enable-kernel=2.6.32"
+    ] ++ lib.optionals withLinuxHeaders [
+      "--enable-kernel=3.2.0" # can't get below with glibc >= 2.26
     ] ++ lib.optionals (cross != null) [
-      (if cross.withTLS then "--with-tls" else "--without-tls")
       (if cross ? float && cross.float == "soft" then "--without-fp" else "--with-fp")
-    ] ++ lib.optionals (cross != null
-          && cross.platform ? kernelMajor
-          && cross.platform.kernelMajor == "2.6") [
-      "--enable-kernel=2.6.0"
+    ] ++ lib.optionals (cross != null) [
       "--with-__thread"
     ] ++ lib.optionals (cross == null && stdenv.isArm) [
       "--host=arm-linux-gnueabi"
@@ -139,7 +145,8 @@ stdenv.mkDerivation ({
 
   outputs = [ "out" "bin" "dev" "static" ];
 
-  nativeBuildInputs = lib.optional (cross != null) buildPackages.stdenv.cc;
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+  nativeBuildInputs = [ bison ];
   buildInputs = lib.optionals withGd [ gd libpng ];
 
   # Needed to install share/zoneinfo/zone.tab.  Set to impure /bin/sh to
@@ -151,8 +158,7 @@ stdenv.mkDerivation ({
 // (removeAttrs args [ "withLinuxHeaders" "withGd" ]) //
 
 {
-  name = name + "-${version}${patchSuffix}" +
-    lib.optionalString (cross != null) "-${cross.config}";
+  name = name + "-${version}${patchSuffix}";
 
   src = fetchurl {
     url = "mirror://gnu/glibc/glibc-${version}.tar.xz";
@@ -185,14 +191,7 @@ stdenv.mkDerivation ({
     libc_cv_forced_unwind=yes
     libc_cv_c_cleanup=yes
     libc_cv_gnu89_inline=yes
-    # Only due to a problem in gcc configure scripts:
-    libc_cv_sparc64_tls=${if cross.withTLS then "yes" else "no"}
     EOF
-
-    export BUILD_CC=gcc
-    export CC="$crossConfig-gcc"
-    export AR="$crossConfig-ar"
-    export RANLIB="$crossConfig-ranlib"
   '';
 
   preBuild = lib.optionalString withGd "unset NIX_DONT_SET_RPATH";
@@ -226,6 +225,6 @@ stdenv.mkDerivation ({
 
   # To avoid a dependency on the build system 'bash'.
   preFixup = ''
-    rm $bin/bin/{ldd,tzselect,catchsegv,xtrace}
+    rm -f $bin/bin/{ldd,tzselect,catchsegv,xtrace}
   '';
 })
diff --git a/pkgs/development/libraries/glibc/dont-use-system-ld-so-cache.patch b/pkgs/development/libraries/glibc/dont-use-system-ld-so-cache.patch
index fc14553c3ee0..f84b1049adf8 100644
--- a/pkgs/development/libraries/glibc/dont-use-system-ld-so-cache.patch
+++ b/pkgs/development/libraries/glibc/dont-use-system-ld-so-cache.patch
@@ -1,7 +1,7 @@
-diff -ru glibc-2.16.0-orig/elf/ldconfig.c glibc-2.16.0/elf/ldconfig.c
---- glibc-2.16.0-orig/elf/ldconfig.c	2012-06-30 15:12:34.000000000 -0400
-+++ glibc-2.16.0/elf/ldconfig.c	2012-09-18 11:59:27.463284814 -0400
-@@ -50,7 +50,7 @@
+diff -Naur glibc-2.27-orig/elf/ldconfig.c glibc-2.27/elf/ldconfig.c
+--- glibc-2.27-orig/elf/ldconfig.c	2018-02-01 11:17:18.000000000 -0500
++++ glibc-2.27/elf/ldconfig.c	2018-02-17 22:43:17.232175182 -0500
+@@ -51,7 +51,7 @@
  #endif
  
  #ifndef LD_SO_CONF
@@ -10,31 +10,31 @@ diff -ru glibc-2.16.0-orig/elf/ldconfig.c glibc-2.16.0/elf/ldconfig.c
  #endif
  
  /* Get libc version number.  */
-diff -ru glibc-2.16.0-orig/elf/Makefile glibc-2.16.0/elf/Makefile
---- glibc-2.16.0-orig/elf/Makefile	2012-06-30 15:12:34.000000000 -0400
-+++ glibc-2.16.0/elf/Makefile	2012-09-18 12:03:30.031955196 -0400
-@@ -415,12 +415,12 @@
+diff -Naur glibc-2.27-orig/elf/Makefile glibc-2.27/elf/Makefile
+--- glibc-2.27-orig/elf/Makefile	2018-02-01 11:17:18.000000000 -0500
++++ glibc-2.27/elf/Makefile	2018-02-17 22:44:50.334006750 -0500
+@@ -559,13 +559,13 @@
  
  $(objpfx)ldconfig: $(ldconfig-modules:%=$(objpfx)%.o)
  
 -SYSCONF-FLAGS := -D'SYSCONFDIR="$(sysconfdir)"'
--CFLAGS-ldconfig.c = $(SYSCONF-FLAGS) -D'LIBDIR="$(libdir)"' \
+-CFLAGS-ldconfig.c += $(SYSCONF-FLAGS) -D'LIBDIR="$(libdir)"' \
 +PREFIX-FLAGS := -D'PREFIX="$(prefix)"'
-+CFLAGS-ldconfig.c = $(PREFIX-FLAGS) -D'LIBDIR="$(libdir)"' \
++CFLAGS-ldconfig.c += $(PREFIX-FLAGS) -D'LIBDIR="$(libdir)"' \
  		    -D'SLIBDIR="$(slibdir)"'
  libof-ldconfig = ldconfig
--CFLAGS-dl-cache.c = $(SYSCONF-FLAGS)
--CFLAGS-cache.c = $(SYSCONF-FLAGS)
--CFLAGS-rtld.c = $(SYSCONF-FLAGS)
-+CFLAGS-dl-cache.c = $(PREFIX-FLAGS)
-+CFLAGS-cache.c = $(PREFIX-FLAGS)
-+CFLAGS-rtld.c = $(PREFIX-FLAGS)
+-CFLAGS-dl-cache.c += $(SYSCONF-FLAGS)
+-CFLAGS-cache.c += $(SYSCONF-FLAGS)
+-CFLAGS-rtld.c += $(SYSCONF-FLAGS)
++CFLAGS-dl-cache.c += $(PREFIX-FLAGS)
++CFLAGS-cache.c += $(PREFIX-FLAGS)
++CFLAGS-rtld.c += $(PREFIX-FLAGS)
  
  cpp-srcs-left := $(all-rtld-routines:=.os)
  lib := rtld
-diff -ru glibc-2.16.0-orig/sysdeps/generic/dl-cache.h glibc-2.16.0/sysdeps/generic/dl-cache.h
---- glibc-2.16.0-orig/sysdeps/generic/dl-cache.h	2012-06-30 15:12:34.000000000 -0400
-+++ glibc-2.16.0/sysdeps/generic/dl-cache.h	2012-09-18 11:59:27.465284809 -0400
+diff -Naur glibc-2.27-orig/sysdeps/generic/dl-cache.h glibc-2.27/sysdeps/generic/dl-cache.h
+--- glibc-2.27-orig/sysdeps/generic/dl-cache.h	2018-02-01 11:17:18.000000000 -0500
++++ glibc-2.27/sysdeps/generic/dl-cache.h	2018-02-17 22:45:20.471598816 -0500
 @@ -28,7 +28,7 @@
  #endif
  
diff --git a/pkgs/development/libraries/glibc/locales.nix b/pkgs/development/libraries/glibc/locales.nix
index debd7b39c86a..7090c5ceceec 100644
--- a/pkgs/development/libraries/glibc/locales.nix
+++ b/pkgs/development/libraries/glibc/locales.nix
@@ -6,7 +6,7 @@
    https://sourceware.org/git/?p=glibc.git;a=blob;f=localedata/SUPPORTED
 */
 
-{ stdenv, callPackage, writeText
+{ stdenv, buildPackages, callPackage, writeText
 , allLocales ? true, locales ? [ "en_US.UTF-8/UTF-8" ]
 }:
 
@@ -26,7 +26,7 @@ callPackage ./common.nix { inherit stdenv; } {
   # $TMPDIR/nix/store/...-glibc-.../lib/locale/locale-archive.
   buildPhase =
     ''
-      mkdir -p $TMPDIR/"${stdenv.cc.libc.out}/lib/locale"
+      mkdir -p $TMPDIR/"${buildPackages.stdenv.cc.libc.out}/lib/locale"
 
       # Hack to allow building of the locales (needed since glibc-2.12)
       sed -i -e 's,^$(rtld-prefix) $(common-objpfx)locale/localedef,localedef --prefix='$TMPDIR',' ../glibc-2*/localedata/Makefile
diff --git a/pkgs/development/libraries/glibc/nix-locale-archive.patch b/pkgs/development/libraries/glibc/nix-locale-archive.patch
index eeaf21901a39..39312951fcf9 100644
--- a/pkgs/development/libraries/glibc/nix-locale-archive.patch
+++ b/pkgs/development/libraries/glibc/nix-locale-archive.patch
@@ -1,114 +1,118 @@
-diff -ru glibc-2.16.0-orig/locale/loadarchive.c glibc-2.16.0/locale/loadarchive.c
---- glibc-2.16.0-orig/locale/loadarchive.c	2012-06-30 15:12:34.000000000 -0400
-+++ glibc-2.16.0/locale/loadarchive.c	2012-09-18 11:57:57.277515212 -0400
-@@ -123,6 +123,25 @@
+diff -Naur glibc-2.27-orig/locale/loadarchive.c glibc-2.27/locale/loadarchive.c
+--- glibc-2.27-orig/locale/loadarchive.c	2018-02-01 11:17:18.000000000 -0500
++++ glibc-2.27/locale/loadarchive.c	2018-02-17 22:32:25.680169462 -0500
+@@ -123,6 +123,23 @@
+   return MAX (namehash_end, MAX (string_end, locrectab_end));
  }
  
- 
 +static int
 +open_locale_archive (void)
 +{
 +  int fd = -1;
-+  char *path = getenv ("LOCALE_ARCHIVE_2_11");
-+  char *path2 = getenv ("LOCALE_ARCHIVE");
-+  const char *usualpath = "/usr/lib/locale/locale-archive";
-+  if (path)
-+    fd = open_not_cancel_2 (path, O_RDONLY|O_LARGEFILE|O_CLOEXEC);
-+  if (path2 && fd < 0)
-+    fd = open_not_cancel_2 (path2, O_RDONLY|O_LARGEFILE|O_CLOEXEC);
++  char *versioned_path = getenv ("LOCALE_ARCHIVE_2_27");
++  char *path = getenv ("LOCALE_ARCHIVE");
++  if (versioned_path)
++    fd = __open_nocancel (versioned_path, O_RDONLY|O_LARGEFILE|O_CLOEXEC);
++  if (path && fd < 0)
++    fd = __open_nocancel (path, O_RDONLY|O_LARGEFILE|O_CLOEXEC);
 +  if (fd < 0)
-+    fd = open_not_cancel_2 (archfname, O_RDONLY|O_LARGEFILE|O_CLOEXEC);
++    fd = __open_nocancel (archfname, O_RDONLY|O_LARGEFILE|O_CLOEXEC);
 +  if (fd < 0)
-+    fd = open_not_cancel_2 (usualpath, O_RDONLY|O_LARGEFILE|O_CLOEXEC);
++    fd = __open_nocancel ("/usr/lib/locale/locale-archive", O_RDONLY|O_LARGEFILE|O_CLOEXEC);
 +  return fd;
 +}
 +
-+
+ 
  /* Find the locale *NAMEP in the locale archive, and return the
     internalized data structure for its CATEGORY data.  If this locale has
-    already been loaded from the archive, just returns the existing data
-@@ -202,7 +221,7 @@
+@@ -202,7 +219,7 @@
        archmapped = &headmap;
  
        /* The archive has never been opened.  */
--      fd = open_not_cancel_2 (archfname, O_RDONLY|O_LARGEFILE|O_CLOEXEC);
+-      fd = __open_nocancel (archfname, O_RDONLY|O_LARGEFILE|O_CLOEXEC);
 +      fd = open_locale_archive ();
        if (fd < 0)
  	/* Cannot open the archive, for whatever reason.  */
  	return NULL;
-@@ -393,8 +412,7 @@
+@@ -397,8 +414,7 @@
  	  if (fd == -1)
  	    {
  	      struct stat64 st;
--	      fd = open_not_cancel_2 (archfname,
--				      O_RDONLY|O_LARGEFILE|O_CLOEXEC);
+-	      fd = __open_nocancel (archfname,
+-				    O_RDONLY|O_LARGEFILE|O_CLOEXEC);
 +	      fd = open_locale_archive ();
  	      if (fd == -1)
  		/* Cannot open the archive, for whatever reason.  */
  		return NULL;
-diff -ru glibc-2.16.0-orig/locale/programs/locale.c glibc-2.16.0/locale/programs/locale.c
---- glibc-2.16.0-orig/locale/programs/locale.c	2012-06-30 15:12:34.000000000 -0400
-+++ glibc-2.16.0/locale/programs/locale.c	2012-09-18 11:53:03.719920947 -0400
-@@ -628,6 +628,20 @@
- 		  ((const struct nameent *) b)->name);
- }
+diff -Naur glibc-2.27-orig/locale/programs/locale.c glibc-2.27/locale/programs/locale.c
+--- glibc-2.27-orig/locale/programs/locale.c	2018-02-01 11:17:18.000000000 -0500
++++ glibc-2.27/locale/programs/locale.c	2018-02-17 22:36:39.726293213 -0500
+@@ -633,6 +633,24 @@
  
-+static int
-+open_nix_locale_archive (const char * fname, int access)
+ 
+ static int
++open_locale_archive (void)
 +{
 +  int fd = -1;
-+  char *path = getenv ("LOCALE_ARCHIVE_2_11");
-+  char *path2 = getenv ("LOCALE_ARCHIVE");
-+  if (path)
-+    fd = open64 (path, access);
-+  if (path2 && fd < 0)
-+    fd = open64 (path2, access);
++  char *versioned_path = getenv ("LOCALE_ARCHIVE_2_27");
++  char *path = getenv ("LOCALE_ARCHIVE");
++  if (versioned_path)
++    fd = open64 (versioned_path, O_RDONLY);
++  if (path && fd < 0)
++    fd = open64 (path, O_RDONLY);
++  if (fd < 0)
++    fd = open64 (ARCHIVE_NAME, O_RDONLY);
 +  if (fd < 0)
-+    fd = open64 (fname, access);
++    fd = open64 ("/usr/lib/locale/locale-archive", O_RDONLY);
 +  return fd;
 +}
- 
- static int
++
++
++static int
  write_archive_locales (void **all_datap, char *linebuf)
-@@ -641,7 +655,7 @@
+ {
+   struct stat64 st;
+@@ -644,7 +662,7 @@
    int fd, ret = 0;
    uint32_t cnt;
  
 -  fd = open64 (ARCHIVE_NAME, O_RDONLY);
-+  fd = open_nix_locale_archive (ARCHIVE_NAME, O_RDONLY);
++  fd = open_locale_archive ();
    if (fd < 0)
      return 0;
  
-diff -ru glibc-2.16.0-orig/locale/programs/locarchive.c glibc-2.16.0/locale/programs/locarchive.c
---- glibc-2.16.0-orig/locale/programs/locarchive.c	2012-06-30 15:12:34.000000000 -0400
-+++ glibc-2.16.0/locale/programs/locarchive.c	2012-09-18 11:53:03.720920942 -0400
-@@ -509,6 +509,20 @@
-   *ah = new_ah;
+diff -Naur glibc-2.27-orig/locale/programs/locarchive.c glibc-2.27/locale/programs/locarchive.c
+--- glibc-2.27-orig/locale/programs/locarchive.c	2018-02-01 11:17:18.000000000 -0500
++++ glibc-2.27/locale/programs/locarchive.c	2018-02-17 22:40:51.245293975 -0500
+@@ -117,6 +117,22 @@
  }
  
+ 
 +static int
-+open_nix_locale_archive (const char * fname, int access)
++open_locale_archive (const char * archivefname, int flags)
 +{
 +  int fd = -1;
-+  char *path = getenv ("LOCALE_ARCHIVE_2_11");
-+  char *path2 = getenv ("LOCALE_ARCHIVE");
-+  if (path)
-+    fd = open64 (path, access);
-+  if (path2 && fd < 0)
-+    fd = open64 (path2, access);
++  char *versioned_path = getenv ("LOCALE_ARCHIVE_2_27");
++  char *path = getenv ("LOCALE_ARCHIVE");
++  if (versioned_path)
++    fd = open64 (versioned_path, flags);
++  if (path && fd < 0)
++    fd = open64 (path, flags);
 +  if (fd < 0)
-+    fd = open64 (fname, access);
++    fd = open64 (archivefname, flags);
 +  return fd;
 +}
- 
- void
- open_archive (struct locarhandle *ah, bool readonly)
-@@ -528,7 +542,7 @@
++
++
+ static void
+ create_archive (const char *archivefname, struct locarhandle *ah)
+ {
+@@ -578,7 +594,7 @@
    while (1)
      {
        /* Open the archive.  We must have exclusive write access.  */
 -      fd = open64 (archivefname, readonly ? O_RDONLY : O_RDWR);
-+      fd = open_nix_locale_archive (archivefname, readonly ? O_RDONLY : O_RDWR);
++      fd = open_locale_archive (archivefname, readonly ? O_RDONLY : O_RDWR);
        if (fd == -1)
  	{
- 	  /* Maybe the file does not yet exist.  */
+ 	  /* Maybe the file does not yet exist? If we are opening