Revert "gnu: glibc: Honor 'GUIX_LOCPATH'."

This reverts commits fbb909ac7e
and 2ebe938c2f.
This commit is contained in:
Ludovic Courtès 2015-10-05 22:27:23 +02:00
parent 2ebe938c2f
commit f211b2af67
4 changed files with 9 additions and 64 deletions

View file

@ -933,47 +933,31 @@ daemons on the same machine.
@node Application Setup @node Application Setup
@section Application Setup @section Application Setup
When using Guix on top of GNU/Linux distribution other than GuixSD---a When using Guix on top of GNU/Linux distribution other than GuixSD, a
so-called @dfn{foreign distro}---a few additional steps are needed to few additional steps are needed to get everything in place. Here are
get everything in place. Here are some of them. some of them.
@subsection Locales @subsection Locales
@anchor{locales-and-locpath} @anchor{locales-and-locpath}
@cindex locales, when not on GuixSD @cindex locales, when not on GuixSD
@vindex LOCPATH @vindex LOCPATH
@vindex GUIX_LOCPATH
Packages installed @i{via} Guix will not use the host system's locale Packages installed @i{via} Guix will not use the host system's locale
data. Instead, you must first install one of the locale packages data. Instead, you must first install one of the locale packages
available with Guix and then define the @code{GUIX_LOCPATH} environment available with Guix and then define the @code{LOCPATH} environment
variable: variable (@pxref{Locale Names, @code{LOCPATH},, libc, The GNU C Library
Reference Manual}):
@example @example
$ guix package -i glibc-locales $ guix package -i glibc-locales
$ export GUIX_LOCPATH=$HOME/.guix-profile/lib/locale/2.22 $ export LOCPATH=$HOME/.guix-profile/lib/locale
@end example @end example
The @file{/2.22} sub-directory is if you install locales from
@code{glibc-locales-2.22}---i.e., locales for libc version 2.22. Adjust
in accordance with the libc version being used.
Note that the @code{glibc-locales} package contains data for all the Note that the @code{glibc-locales} package contains data for all the
locales supported by the GNU@tie{}libc and weighs in at around locales supported by the GNU@tie{}libc and weighs in at around
110@tie{}MiB. Alternately, the @code{glibc-utf8-locales} is smaller but 110@tie{}MiB. Alternately, the @code{glibc-utf8-locales} is smaller but
limited to a few UTF-8 locales. limited to a few UTF-8 locales.
The @code{GUIX_LOCPATH} variable plays the exact same role as
@code{LOCPATH} (@pxref{Locale Names, @code{LOCPATH},, libc, The GNU C
Library Reference Manual}). However, since it is honored only by Guix's
libc, and not by the libc provided by foreign distros, using
@code{GUIX_LOCPATH} allows you to make sure the the foreign distro's
programs will not end up loading incompatible locale data. This is
important because the locale data format used by different libc versions
may be incompatible.
When both @code{GUIX_LOCPATH} and @code{LOCPATH} are defined, the latter
takes precedence.
@subsection X11 Fonts @subsection X11 Fonts
The majority of graphical applications use Fontconfig to locate and The majority of graphical applications use Fontconfig to locate and

View file

@ -468,7 +468,6 @@ dist_patch_DATA = \
gnu/packages/patches/glib-tests-timer.patch \ gnu/packages/patches/glib-tests-timer.patch \
gnu/packages/patches/glib-tests-gapplication.patch \ gnu/packages/patches/glib-tests-gapplication.patch \
gnu/packages/patches/glibc-bootstrap-system.patch \ gnu/packages/patches/glibc-bootstrap-system.patch \
gnu/packages/patches/glibc-guix-locpath.patch \
gnu/packages/patches/glibc-ldd-x86_64.patch \ gnu/packages/patches/glibc-ldd-x86_64.patch \
gnu/packages/patches/glibc-locales.patch \ gnu/packages/patches/glibc-locales.patch \
gnu/packages/patches/glibc-locale-incompatibility.patch \ gnu/packages/patches/glibc-locale-incompatibility.patch \

View file

@ -484,7 +484,6 @@ (define-public glibc
(patches (map search-patch (patches (map search-patch
'("glibc-ldd-x86_64.patch" '("glibc-ldd-x86_64.patch"
"glibc-locale-incompatibility.patch" "glibc-locale-incompatibility.patch"
"glibc-guix-locpath.patch"
"glibc-o-largefile.patch"))))) "glibc-o-largefile.patch")))))
(build-system gnu-build-system) (build-system gnu-build-system)
@ -615,13 +614,10 @@ (define-public glibc
(native-search-paths (native-search-paths
;; Search path for packages that provide locale data. This is useful ;; Search path for packages that provide locale data. This is useful
;; primarily in build environments. Use 'GUIX_LOCPATH' rather than ;; primarily in build environments.
;; 'LOCPATH' to avoid interference with the host system's libc on foreign
;; distros.
(list (search-path-specification (list (search-path-specification
(variable "GUIX_LOCPATH") (variable "GUIX_LOCPATH")
(files (list (string-append "lib/locale/" version) (files '("lib/locale")))))
"lib/locale")))))
(synopsis "The GNU C Library") (synopsis "The GNU C Library")
(description (description

View file

@ -1,34 +0,0 @@
Honor a special 'GUIX_LOCPATH' environment variable.
This is most useful when using Guix on top of another distro, which uses an
different libc version with incompatible locale data. In this case, setting
'GUIX_LOCPATH' rather than 'LOCPATH' allows users to tell Guix's libc where to
look for its locale data without breaking programs that use the other libc.
See <https://lists.gnu.org/archive/html/guix-devel/2015-09/msg00717.html> for
some background information.
--- a/locale/newlocale.c
+++ b/locale/newlocale.c
@@ -103,6 +103,8 @@ __newlocale (int category_mask, const char *locale, __locale_t base)
locale_path_len = 0;
locpath_var = getenv ("LOCPATH");
+ if (locpath_var == NULL || locpath_var[0] == '\0')
+ locpath_var = getenv ("GUIX_LOCPATH");
if (locpath_var != NULL && locpath_var[0] != '\0')
{
if (__argz_create_sep (locpath_var, ':',
diff --git a/locale/setlocale.c b/locale/setlocale.c
index ead030d..0e66c7b 100644
--- a/locale/setlocale.c
+++ b/locale/setlocale.c
@@ -252,6 +252,8 @@ setlocale (int category, const char *locale)
locale_path_len = 0;
locpath_var = getenv ("LOCPATH");
+ if (locpath_var == NULL || locpath_var[0] == '\0')
+ locpath_var = getenv ("GUIX_LOCPATH");
if (locpath_var != NULL && locpath_var[0] != '\0')
{
if (__argz_create_sep (locpath_var, ':',