Making glibc build without any LOCALE_ARCHIVE* environment variable anymore,

setting glibc to look for the locale-archive in the usual nixos
/var/run/current-system/sw/lib/locale path.
This solution may give us less problems.
The last problem involved was the lack of locale-archive in setuid/setgid
programs, due to the risk of letting them take the LOCALE_ARCHIVE variable
contents from the caller.

svn path=/nixpkgs/branches/stdenv-updates/; revision=21249
This commit is contained in:
Lluís Batlle i Rossell 2010-04-22 21:17:57 +00:00
parent 99d51d0e92
commit 6d62947d71
2 changed files with 1 additions and 75 deletions

View File

@ -44,9 +44,6 @@ stdenv.mkDerivation ({
failure to find mdns4_minimal. */
./nss-skip-unavail.patch
/* Make it possible to override the locale-archive in NixOS. */
./locale-override.patch
/* Have rpcgen(1) look for cpp(1) in $PATH. */
./rpcgen-path.patch
@ -60,6 +57,7 @@ stdenv.mkDerivation ({
configureFlags = [
"-C"
"--enable-add-ons"
"--localedir=/var/run/current-system/sw/lib/locale"
(if kernelHeaders != null
then "--with-headers=${kernelHeaders}/include"
else "--without-headers")

View File

@ -1,72 +0,0 @@
diff -rc glibc-2.9-20081208-orig/locale/loadarchive.c glibc-2.9-20081208/locale/loadarchive.c
*** glibc-2.9-20081208-orig/locale/loadarchive.c 2005-09-09 18:56:52.000000000 +0200
--- glibc-2.9-20081208/locale/loadarchive.c 2009-04-19 13:54:26.000000000 +0200
***************
*** 124,129 ****
--- 124,142 ----
}
+ static int
+ open_locale_archive ()
+ {
+ int fd = -1;
+ char *path = getenv ("LOCALE_ARCHIVE_2_11");
+ if (path)
+ fd = open_not_cancel_2 (path, O_RDONLY|O_LARGEFILE);
+ if (fd < 0)
+ fd = open_not_cancel_2 (archfname, O_RDONLY|O_LARGEFILE);
+ 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
***************
*** 203,209 ****
archmapped = &headmap;
/* The archive has never been opened. */
! fd = open_not_cancel_2 (archfname, O_RDONLY|O_LARGEFILE);
if (fd < 0)
/* Cannot open the archive, for whatever reason. */
return NULL;
--- 216,222 ----
archmapped = &headmap;
/* The archive has never been opened. */
! fd = open_locale_archive ();
if (fd < 0)
/* Cannot open the archive, for whatever reason. */
return NULL;
***************
*** 394,400 ****
if (fd == -1)
{
struct stat64 st;
! fd = open_not_cancel_2 (archfname, O_RDONLY|O_LARGEFILE);
if (fd == -1)
/* Cannot open the archive, for whatever reason. */
return NULL;
--- 407,413 ----
if (fd == -1)
{
struct stat64 st;
! fd = open_locale_archive ();
if (fd == -1)
/* Cannot open the archive, for whatever reason. */
return NULL;
diff -rc glibc-2.9-20081208-orig/sysdeps/generic/unsecvars.h glibc-2.9-20081208/sysdeps/generic/unsecvars.h
*** glibc-2.9-20081208-orig/sysdeps/generic/unsecvars.h 2006-10-11 18:24:05.000000000 +0200
--- glibc-2.9-20081208/sysdeps/generic/unsecvars.h 2009-04-19 13:55:34.000000000 +0200
***************
*** 16,21 ****
--- 16,22 ----
"LD_SHOW_AUXV\0" \
"LD_USE_LOAD_BIAS\0" \
"LOCALDOMAIN\0" \
+ "LOCALE_ARCHIVE_2_11\0" \
"LOCPATH\0" \
"MALLOC_TRACE\0" \
"NIS_PATH\0" \