From: "Ludovic Courtès" <ludo@gnu.org>
To: guix-devel@gnu.org
Cc: beffa@ieee.org
Subject: [PATCH 1/2] gnu: glibc: Honor 'GUIX_LOCPATH'.
Date: Thu, 1 Oct 2015 23:58:35 +0200 [thread overview]
Message-ID: <1443736716-8578-2-git-send-email-ludo@gnu.org> (raw)
In-Reply-To: <1443736716-8578-1-git-send-email-ludo@gnu.org>
In-Reply-To: <CAKrPhPOPozYpjNEQ6GBTOdcEtGsSGiMwpotbiBZvmd5T93eVzA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 703 bytes --]
* gnu/packages/patches/glibc-guix-locpath.patch: New file.
* gnu-system.am (dist_patch_DATA): Add it.
* gnu/packages/base.scm (glibc)[source]: Use it.
[native-search-paths]: Use 'GUIX_LOCPATH' instead of 'LOCPATH'.
* doc/guix.texi (Application Setup): Introduce the term "foreign
distro". Document 'GUIX_LOCPATH'.
---
doc/guix.texi | 23 +++++++++++-----
gnu-system.am | 1 +
gnu/packages/base.scm | 7 +++--
gnu/packages/patches/glibc-guix-locpath.patch | 38 +++++++++++++++++++++++++++
4 files changed, 60 insertions(+), 9 deletions(-)
create mode 100644 gnu/packages/patches/glibc-guix-locpath.patch
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-glibc-Honor-GUIX_LOCPATH.patch --]
[-- Type: text/x-patch; name="0001-gnu-glibc-Honor-GUIX_LOCPATH.patch", Size: 5372 bytes --]
diff --git a/doc/guix.texi b/doc/guix.texi
index 68ee451..1ad4229 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -933,24 +933,24 @@ daemons on the same machine.
@node Application Setup
@section Application Setup
-When using Guix on top of GNU/Linux distribution other than GuixSD, a
-few additional steps are needed to get everything in place. Here are
-some of them.
+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
+get everything in place. Here are some of them.
@subsection Locales
@anchor{locales-and-locpath}
@cindex locales, when not on GuixSD
@vindex LOCPATH
+@vindex GUIX_LOCPATH
Packages installed @i{via} Guix will not use the host system's locale
data. Instead, you must first install one of the locale packages
-available with Guix and then define the @code{LOCPATH} environment
-variable (@pxref{Locale Names, @code{LOCPATH},, libc, The GNU C Library
-Reference Manual}):
+available with Guix and then define the @code{GUIX_LOCPATH} environment
+variable:
@example
$ guix package -i glibc-locales
-$ export LOCPATH=$HOME/.guix-profile/lib/locale
+$ export GUIX_LOCPATH=$HOME/.guix-profile/lib/locale
@end example
Note that the @code{glibc-locales} package contains data for all the
@@ -958,6 +958,15 @@ locales supported by the GNU@tie{}libc and weighs in at around
110@tie{}MiB. Alternately, the @code{glibc-utf8-locales} is smaller but
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.
+
@subsection X11 Fonts
The majority of graphical applications use Fontconfig to locate and
diff --git a/gnu-system.am b/gnu-system.am
index f2f7e17..aba8f8d 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -469,6 +469,7 @@ dist_patch_DATA = \
gnu/packages/patches/glib-tests-timer.patch \
gnu/packages/patches/glib-tests-gapplication.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-locales.patch \
gnu/packages/patches/glibc-o-largefile.patch \
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index a7d9459..337fdae 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -476,6 +476,7 @@ store.")
(modules '((guix build utils)))
(patches (map search-patch
'("glibc-ldd-x86_64.patch"
+ "glibc-guix-locpath.patch"
"glibc-o-largefile.patch")))))
(build-system gnu-build-system)
@@ -606,9 +607,11 @@ store.")
(native-search-paths
;; Search path for packages that provide locale data. This is useful
- ;; primarily in build environments.
+ ;; primarily in build environments. Use 'GUIX_LOCPATH' rather than
+ ;; 'LOCPATH' to avoid interference with the host system's libc on foreign
+ ;; distros.
(list (search-path-specification
- (variable "LOCPATH")
+ (variable "GUIX_LOCPATH")
(files '("lib/locale")))))
(synopsis "The GNU C Library")
diff --git a/gnu/packages/patches/glibc-guix-locpath.patch b/gnu/packages/patches/glibc-guix-locpath.patch
new file mode 100644
index 0000000..2a814a3
--- /dev/null
+++ b/gnu/packages/patches/glibc-guix-locpath.patch
@@ -0,0 +1,38 @@
+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
+@@ -102,7 +102,9 @@ __newlocale (int category_mask, const char *locale, __locale_t base)
+ locale_path = NULL;
+ locale_path_len = 0;
+
+- locpath_var = getenv ("LOCPATH");
++ locpath_var = getenv ("GUIX_LOCPATH");
++ if (locpath_var == NULL || locpath_var[0] == '\0')
++ locpath_var = getenv ("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..ca2337d 100644
+--- a/locale/setlocale.c
++++ b/locale/setlocale.c
+@@ -251,7 +251,9 @@ setlocale (int category, const char *locale)
+ locale_path = NULL;
+ locale_path_len = 0;
+
+- locpath_var = getenv ("LOCPATH");
++ locpath_var = getenv ("GUIX_LOCPATH");
++ if (locpath_var == NULL || locpath_var[0] == '\0')
++ locpath_var = getenv ("LOCPATH");
+ if (locpath_var != NULL && locpath_var[0] != '\0')
+ {
+ if (__argz_create_sep (locpath_var, ':',
next prev parent reply other threads:[~2015-10-01 21:58 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-28 9:17 Preparing for the libc/locale upgrade Federico Beffa
2015-09-28 20:45 ` Ludovic Courtès
2015-09-30 12:35 ` Federico Beffa
2015-09-30 13:46 ` Ludovic Courtès
2015-09-30 15:53 ` Federico Beffa
2015-10-01 21:58 ` [PATCH 0/2] Avoiding incompatible locale data in LOCPATH Ludovic Courtès
2015-10-02 0:06 ` Mark H Weaver
2015-10-02 16:52 ` Ludovic Courtès
2015-10-03 22:20 ` Ludovic Courtès
2015-10-03 22:56 ` Daniel Pimentel
2015-10-04 8:09 ` Ludovic Courtès
2015-10-04 17:04 ` Mark H Weaver
2015-10-05 14:38 ` Ludovic Courtès
2015-10-04 8:32 ` Ricardo Wurmus
2015-10-04 8:39 ` Ricardo Wurmus
2015-10-04 12:32 ` Ludovic Courtès
2015-10-04 16:56 ` Mark H Weaver
2015-10-05 14:35 ` Ludovic Courtès
2015-10-05 15:38 ` Federico Beffa
2015-10-05 19:39 ` Ludovic Courtès
2015-10-05 21:09 ` Ludovic Courtès
2015-10-06 6:29 ` Federico Beffa
2015-10-01 21:58 ` Ludovic Courtès [this message]
2015-10-01 21:58 ` [PATCH 2/2] gnu: glibc: Look for locale data in versioned sub-directories Ludovic Courtès
2015-10-01 7:02 ` Preparing for the libc/locale upgrade Konrad Hinsen
2015-09-29 14:32 ` Mark H Weaver
2015-09-29 16:12 ` Federico Beffa
2015-10-01 19:57 ` Leo Famulari
2015-10-01 20:36 ` Taylan Ulrich Bayırlı/Kammer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1443736716-8578-2-git-send-email-ludo@gnu.org \
--to=ludo@gnu.org \
--cc=beffa@ieee.org \
--cc=guix-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.