Custom Locale, LC_TYPE And Urxvt

I have a custom locale in use on our system. Consequently, Xlib does not recognize the default environment setting for LC_TYPE. To get an urxvt window opened without encountering the locale error message I am therefore constrained to use some variant of the following:

LC_TYPE=en_US.UTF-8 urxvt&

I would like to set LC_TYPE to a different value than LANG. However, based on experiment it seems that the only locale setting in
/etc/sysconfig/i18n that CentOS-6.3 responds to is LANG. I have looked at /etc/profile.d/lang.sh but my knowledge of terminal settings and system variables is insufficient to make much sense out of it.

if [ -n "$LANG" ]; then
saved_lang=”$LANG”
[ -f "$HOME/.i18n" ] && . “$HOME/.i18n” && sourced=1
LANG=”$saved_lang”
unset saved_lang else
for langfile in /etc/sysconfig/i18n “$HOME/.i18n” ; do
[ -f $langfile ] && . $langfile && sourced=1
done fi

If I am not entirely mistaken, this code checks to see if $LANG is set and saves it. Presumably this is to preserve $LANG from being overridden by the contents of ~/.i18n but it does not even seem to check /etc/sysconfig/i18n in that case. One might infer from this treatment that this is because lang.sh expects that if $LANG is set then /etc/sysconfig/i18n has already been processed.

Assuming that /etc/sysconfig/i18n is found then it processes the following statement:

if [ "$sourced" = 1 ]; then
[ -n "$LANG" ] && export LANG || unset LANG
. . .
[ -n "$LC_CTYPE" ] && export LC_CTYPE || unset LC_CTYPE
. . .

Checking in ~/.bashrc I see this:

. . .
# Source global definitions if [ -f /etc/bashrc ]; then
. /etc/bashrc fi

And checking /etc/bashrc I see this:

. . .
# Only display echos from profile.d scripts if we are no login shell
# and interactive – otherwise just process them to set envvars
for i in /etc/profile.d/*.sh; do
if [ -r "$i" ]; then
if [ "$PS1" ]; then
. “$i”
else
. “$i” >/dev/null 2>&1
fi
fi
done

unset i
unset pathmunge fi

However, when I look for the mate to that final ‘fi’ I find this:

. . . if ! shopt -q login_shell ; then # We’re not a login shell
# Need to redefine pathmunge, it get’s undefined at the end of
/etc/profile
pathmunge ()
. . .

Evidently /etc/profile.d/lang.sh only gets processed by /etc/bashrc if I am NOT in a login shell. The question then is: when does
/etc/profile.d/lang.sh get processed? Well, numerous places it seems:

/etc/csh.login
/etc/profile
/etc/rc.d/init.d/rpcbind
/etc/rc.d/rc3.d/K95firstboot
/etc/rc.d/rc
/etc/X11/xinit/xinitrc-common

Yet, despite all these calls to /etc/profile.d/lang.sh, whenever I
open a new session in gnome-terminal LC_LANG is never set but $LANG
is. If However, I do . /etc/profile.d/lang.sh in that window session, then LC_TYPE becomes set as I desire.

Either something is setting LANG and ignoring LC_TYPE in
/etc/sysconfig/i18n before lang.sh or something is unsetting everything other than $LANG after lang.sh is processed.

What is going on?

  1. No comments yet.
(will not be published)
Subscribe to comments feed