locale environment variables

Hook ls at utserver.net
Sat Nov 21 18:34:54 UTC 2009


I could use some help in understanding the process which Fedora systems 
apply to the locale environment variables (specifically LANG and 
LC_ALL).  It seems that from /etc/profile.d/lang.sh, LC_ALL is unset 
unless it was already initialized to something other than the value of LANG.


     if [ -n "$LC_ALL" ]; then
        if [ "$LC_ALL" != "$LANG" ]; then
          export LC_ALL
        else
          unset LC_ALL
        fi
     else
        unset LC_ALL
     fi



I seem to have an application that requires these two variables to be 
set to the same value, so instead of modifying the system wide profile 
config, I decided to add the following to ~/.bash_profile since this app 
runs under only one account:

    if [ "$LC_ALL" != "$LANG" ]; then
        LC_ALL=$LANG
        export LC_ALL
    fi


The problem I have now is that this app generates it own job submission 
which basically runs a script that dynamically generates another script 
for execution later.  I'm not a developer so I don't understand the 
entire process, but without exporting these two variables inside the 
first script, the LC_ALL variable is still being unset by the system 
wide profile.  I don't know if this illustrates the same issue, but when 
I establish an initial SSH session, I see the values set for both 
variables as desired, however if I simply kick off another bash shell, 
the LC_ALL is unset again.

$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8
$ bash
$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=



Any explanation of why this is occurring or advise on how to change the 
behavior would be appreciated.


Thanks,
Hook




More information about the fedora-list mailing list