here is a rewrite of the test with variable $SHELL and $wc
put it in file (say testwc) and run it with SHELL exported to ksh93:
once with no args and once with one arg that is the full path of wc
        testwc
        testwc full-path-of-wc
I got it to fail in the first case (where the builtin wc is used)
but not in the second case (wc executable)
both wc's are the same implementation
---
wc=${1:-wc}

unset LC_CTYPE
export LANG=en_US.UTF-8
printf "\u[20ac]\u[20ac]" >two_euro_chars.txt

set -- $($SHELL -c "
        export LC_ALL=C
        $wc -C < two_euro_chars.txt
        unset LC_ALL
        $wc -C < two_euro_chars.txt
        export LC_ALL=C
        $wc -C < two_euro_chars.txt
")
got=$*
exp="6 2 6"
[[ $got == $exp ]] || print "expected '$exp', got '$got'"
---

On Thu, 24 Sep 2009 03:59:44 +0200 Roland Mainz wrote:
> Hi!

> ----

> Below is a testcase which shows a problem with the handing code for
> LC_*/LANG variables.
> AFAIK the problem looks like this:
> If I set LANG to a value, then set any of the LC_* variables to
> (partially) override LANG and then unset (or set it to '' (empty
> string)) the LC_* variable |setlocale()| is not being called to restore
> the locale settings defined via the LANG variable.

> The testcase looks like this:
> -- snip --
> export LC_ALL=en_US.UTF-8
> printf "\u[20ac]\u[20ac]" >two_euro_chars.txt

> unset \
>       LC_COLLATE \
>       LC_CTYPE \
>       LC_MESSAGES \
>       LC_MONETARY \
>       LC_NUMERIC \
>       LANG

> (
> cat <<EOF

> export LANG=en_US.UTF-8 LC_ALL=C
> wc -C < two_euro_chars.txt
> unset LC_ALL
> wc -C < two_euro_chars.txt
> export LC_ALL=C
> wc -C < two_euro_chars.txt

> EOF
> ) | x="$(/usr/bin/ksh93)"

> [[ "$x" == ~(E)[[:space:]]*6[[:space:]]*2[[:space:]]*6 ]] || \
>       printf "expected \$'       6\\\n       2\\\n       6', got %q\n" "$x"
> -- snip --

> AFAIK the output should be "6 2 6" but for ast-ksh.2009-09-08 the
> testcase above prints "6 6 6" ...

> This happens for any of the LC_* variables overriding LANG and LC_ALL
> overriding both the other LC_* variables and LANG...

_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to