[issue706] zshrc: xsource "/etc/default/locale" overrides environment

Frank Terbeck bts at bts.grml.org
Wed Jul 8 12:57:04 CEST 2009


Frank Terbeck <ft at grml.org> added the comment:

Michael Prokop <bts at bts.grml.org>:
> Alright, discussing this issue in #grml Thorsten 'mira' Glaser
> brought up the following idea:
> 
> * do not source /etc/default/locale if something like
>   $ZSH_NO_DEFAULT_LOCALE is set
> * $ZSH_NO_DEFAULT_LOCALE isn't set by default, but:
> * iso-term can set $ZSH_NO_DEFAULT_LOCALE and avoid sourcing
>   /etc/default/ locale via /etc/zsh/zshrc therefore
> 
> This should prevent us from yet another change in the locale hell.
> 
> Frank, what do you think?

Since this is pretty much what I was after:
    ft » mika: kannst du steuern, wie iso-term die zsh startet?
    [...]
    mika » ft: grml-skript, das einfach utf-8 in iso wandelt im
           environment:
    [...]
    ft » mika: dann könnte man darin eine Variable setzen, die das
         Laden von default/locale verhindert. (was die Sache in der
         zshrc wieder komplizierter macht, aber hey. :))

And FWIW, I think ZSH_NO_DEFAULT_LOCALE is a good name.

The fix would look like this:

[snip]
diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc
index 43dab29..5527ec8 100644
--- a/etc/zsh/zshrc
+++ b/etc/zsh/zshrc
@@ -252,6 +252,7 @@ GRML_ZSH_CNF_HANDLER=${GRML_ZSH_CNF_HANDLER:-/usr/share/command-not-found/comman
 BATTERY=${BATTERY:-0}
 GRMLSMALL_SPECIFIC=${GRMLSMALL_SPECIFIC:-1}
 GRML_ALWAYS_LOAD_ALL=${GRML_ALWAYS_LOAD_ALL:-0}
+ZSH_NO_DEFAULT_LOCALE=${ZSH_NO_DEFAULT_LOCALE:-0}
 
 if isgrmlcd ; then
     GRML_WARN_SKEL=${GRML_WARN_SKEL:-0}
@@ -483,7 +484,10 @@ zrclocal() {
 #}}}
 
 # locale setup {{{
-xsource "/etc/default/locale"
+if (( ZSH_NO_DEFAULT_LOCALE == 0 )); then
+    echo ping
+    xsource "/etc/default/locale"
+fi
 
 for var in LANG LC_ALL LC_MESSAGES ; do
     [[ -n ${(P)var} ]] && export $var
[snap]

iso-term would need to inject ZSH_NO_DEFAULT_LOCALE=1 into its
environment.

Please ACK this and I'll push with an appropriate commit message.

Regards, Frank

----------
assignedto: ft
messages: 2341, 2342, 2343, 2346
nosy: ft, mika
priority: bug
status: chatting
title: zshrc: xsource "/etc/default/locale" overrides environment
topic: release-stopper

_____________________________________
GRML issue tracker <bts at bts.grml.org>
<http://bts.grml.org/grml/issue706>
_____________________________________


More information about the Bugs-changes mailing list