Greetings Farid
My suspicion is that they are supposed to be exported. My understanding
is that those variables tell the locale and localedef utilities exactly
what language they are dealing with.
On my machine, it appears that the pair of variables are auto-exported
to the child processes, and I have observed similar behavior to what you
observed after explicitly exporting the variables to the child processes.
I have done a little digging, and it seems to me that the issue
originates in the LC_COLLATE section of the out.1 file. Either the
logic to fill the section is incorrect, or the logic to parse the
section is incorrect.
Attached is a patch containing changes I made to the run_locale_utils.sh
script that I made while trying to track down why I was seeing test
failures building locales. This also incorporates your observations on
the missed exports. If it is to be committed, a changelog entry follows.
--Andrew Black
Log
* run_locale_utils.sh (generate_locale): Redirect stderr from localedef
utility to $dbgout
(test_locale): Export LC_ALL and LANG
echo all export directives and values to debug output
Farid Zaripov wrote:
When I ported the run_locale_utils.sh script to Windows I seen the
following lines:
run_locale_utils.sh, line 244:
# set necessary environment variables
LC_ALL=$3
LANG=$3
This lines modify the environment variables for run_locale_utils.sh
process, but not exported to the locale and localedef processes when
that processes are created. When I added the following lines:
-----------
export LC_ALL
export LANG
-----------
I got the following output:
./ru_RU.KIO8-R.sh -d
./localedef -w -c -f /usr/src/WorkingCopy/etc/nls/charmaps/KOI8-R -I
/usr/src/WorkingCopy/etc/nls/src/ru_RU /tmp/locale.14561/ru_RU.KOI8- R
2>/dev/null
./locale -ck -h LC_ALL > /tmp/locale.14561/out.1
./localedef -w -c -f /usr/src/WorkingCopy/etc/nls/charmaps/KOI8-R -I
/tmp/locale.14561/out.1 /tmp/locale.14561/ru_RU.KOI8-R 2>/dev/null
Error - localedef returned code: 4
./locale -ck -h LC_ALL > /tmp/locale.14561/out.2
./localedef -w -c -f /usr/src/WorkingCopy/etc/nls/charmaps/KOI8-R -I
/tmp/locale.14561/out.2 /tmp/locale.14561/ru_RU.KOI8-R 2>/dev/null
Error - localedef returned code: 4
./locale -ck -h LC_ALL > /tmp/locale.14561/out.3
# +-----------------------+--------+--------+--------+
# | DIAGNOSTIC | ACTIVE | TOTAL |INACTIVE|
# +-----------------------+--------+--------+--------+
# | (S7) ASSERTION | 2 | 7 | 71% |
# +-----------------------+--------+--------+--------+
## Assertions = 7
## FailedAssertions = 2
The error message from localedef calls:
Error 399: decimal value in the range [0, 255) expected: \d384
The question is: should be LANG and LC_ALL variables exported or not?
Farid.
Index: etc/config/run_locale_utils.sh
===================================================================
--- etc/config/run_locale_utils.sh (revision 431602)
+++ etc/config/run_locale_utils.sh (working copy)
@@ -167,8 +167,8 @@
assertions=`expr $assertions + 1`
# Generating the database
- echo "${localedef} -w -c -f $1 -i $2 $3 2>/dev/null" >$dbgout
- ${localedef} -w -c -f $1 -i $2 $3 2>/dev/null
+ echo "${localedef} -w -c -f $1 -i $2 $3 2>"$dbgout >$dbgout
+ ${localedef} -w -c -f $1 -i $2 $3 2>$dbgout
retcode=$?
if [ $retcode -ne 0 ] ; then
@@ -242,11 +242,19 @@
$2/$3
# set necessary environment variables
+ echo "LC_ALL="$3 >$dbgout
LC_ALL=$3
+ echo "export LC_ALL" >$dbgout
+ export LC_ALL
+ echo "LANG="$3 >$dbgout
LANG=$3
+ echo "export LANG" >$dbgout
+ export LANG
## adjust the locale root
+ echo "RWSTD_LOCALE_ROOT="$2 >$dbgout
RWSTD_LOCALE_ROOT=$2
+ echo "export RWSTD_LOCALE_ROOT" >$dbgout
export RWSTD_LOCALE_ROOT
# dump the locale database content to temporary location
@@ -361,9 +369,13 @@
fi
## checking locale functionality
+ echo "RWSTD_SRC_ROOT="$nlsdir >$dbgout
RWSTD_SRC_ROOT=$nlsdir
+ echo "export RWSTD_SRC_ROOT" >$dbgout
export RWSTD_SRC_ROOT
+ echo "RWSTD_LOCALE_ROOT="$tmpdir >$dbgout
RWSTD_LOCALE_ROOT=$tmpdir
+ echo "export RWSTD_LOCALE_ROOT" >$dbgout
export RWSTD_LOCALE_ROOT
# test only one locale