public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* How LANG environment variable is set?
@ 2014-04-24 21:13 Angelo Graziosi
  2014-04-24 21:24 ` Larry Hall (Cygwin)
  2014-04-24 21:58 ` David Rothenberger
  0 siblings, 2 replies; 7+ messages in thread
From: Angelo Graziosi @ 2014-04-24 21:13 UTC (permalink / raw)
  To: cygwin

I remember that some time ago I had, in mintty,

$ echo $LANG
it_IT.UTF-8

Now LANG is empty ('echo $LANG' prints nothing).

I notice that /etc/profile.d has lang.sh which should set LANG when I 
start mintty. That script contains

test -z "${LC_ALL:-${LC_CTYPE:-$LANG}}" && export LANG=$(/usr/bin/locale 
-uU)

and at command line, '/usr/bin/locale -uU' prints it_IT.UTF-8...


If I start mintty (LANG empty) and the copy/paste the above lang.sh 
line, after an <ENTER> I get

$ echo $LANG
it_IT.UTF-8

It is as if the script was not executed... or not? but surely I am 
missing something..


Ciao,
  Angelo.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How LANG environment variable is set?
  2014-04-24 21:13 How LANG environment variable is set? Angelo Graziosi
@ 2014-04-24 21:24 ` Larry Hall (Cygwin)
  2014-04-24 21:58 ` David Rothenberger
  1 sibling, 0 replies; 7+ messages in thread
From: Larry Hall (Cygwin) @ 2014-04-24 21:24 UTC (permalink / raw)
  To: cygwin

On 04/24/2014 05:13 PM, Angelo Graziosi wrote:
> I remember that some time ago I had, in mintty,
>
> $ echo $LANG
> it_IT.UTF-8
>
> Now LANG is empty ('echo $LANG' prints nothing).
>
> I notice that /etc/profile.d has lang.sh which should set LANG when I start
> mintty. That script contains
>
> test -z "${LC_ALL:-${LC_CTYPE:-$LANG}}" && export LANG=$(/usr/bin/locale -uU)
>
> and at command line, '/usr/bin/locale -uU' prints it_IT.UTF-8...
>
>
> If I start mintty (LANG empty) and the copy/paste the above lang.sh line,
> after an <ENTER> I get
>
> $ echo $LANG
> it_IT.UTF-8
>
> It is as if the script was not executed... or not? but surely I am missing
> something..

WJFFM.  What's the shell you're running?  Are you setting the local and/or
character set in mintty itself?  Is '/etc/profile' or any of the other
profile scripts being run?  Perhaps cygcheck output would help if you can't
find out where things are going awry.

-- 
Larry

_____________________________________________________________________

A: Yes.
 > Q: Are you sure?
 >> A: Because it reverses the logical flow of conversation.
 >>> Q: Why is top posting annoying in email?

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How LANG environment variable is set?
  2014-04-24 21:13 How LANG environment variable is set? Angelo Graziosi
  2014-04-24 21:24 ` Larry Hall (Cygwin)
@ 2014-04-24 21:58 ` David Rothenberger
  2014-04-24 22:33   ` Larry Hall (Cygwin)
  1 sibling, 1 reply; 7+ messages in thread
From: David Rothenberger @ 2014-04-24 21:58 UTC (permalink / raw)
  To: cygwin

Angelo Graziosi wrote:
> I remember that some time ago I had, in mintty,
> 
> $ echo $LANG
> it_IT.UTF-8
> 
> Now LANG is empty ('echo $LANG' prints nothing).
> 
> I notice that /etc/profile.d has lang.sh which should set LANG when I
> start mintty. That script contains
> 
> test -z "${LC_ALL:-${LC_CTYPE:-$LANG}}" && export LANG=$(/usr/bin/locale -uU)
> 
> and at command line, '/usr/bin/locale -uU' prints it_IT.UTF-8...

It looks like /etc/profile sets LC_ALL=C before running the scripts
in /etc/profile.d, then restores it to its original setting. This
prevents LANG getting set by lang.sh.

-- 
David Rothenberger  ----  daveroth@acm.org

"It's what you learn after you know it all that counts."
                -- John Wooden

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How LANG environment variable is set?
  2014-04-24 21:58 ` David Rothenberger
@ 2014-04-24 22:33   ` Larry Hall (Cygwin)
  2014-04-25  6:37     ` Achim Gratz
  2014-04-25 23:35     ` Andrey Repin
  0 siblings, 2 replies; 7+ messages in thread
From: Larry Hall (Cygwin) @ 2014-04-24 22:33 UTC (permalink / raw)
  To: cygwin

On 04/24/2014 05:56 PM, David Rothenberger wrote:
> Angelo Graziosi wrote:
>> I remember that some time ago I had, in mintty,
>>
>> $ echo $LANG
>> it_IT.UTF-8
>>
>> Now LANG is empty ('echo $LANG' prints nothing).
>>
>> I notice that /etc/profile.d has lang.sh which should set LANG when I
>> start mintty. That script contains
>>
>> test -z "${LC_ALL:-${LC_CTYPE:-$LANG}}" && export LANG=$(/usr/bin/locale -uU)
>>
>> and at command line, '/usr/bin/locale -uU' prints it_IT.UTF-8...
>
> It looks like /etc/profile sets LC_ALL=C before running the scripts
> in /etc/profile.d, then restores it to its original setting. This
> prevents LANG getting set by lang.sh.
>

Good catch.  Yes, the latest version of base_files makes this change to
the profile_d() function.  Looks like the easiest interim solution is to
downgrade to base_files-4.1-2.

-- 
Larry

_____________________________________________________________________

A: Yes.
 > Q: Are you sure?
 >> A: Because it reverses the logical flow of conversation.
 >>> Q: Why is top posting annoying in email?

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How LANG environment variable is set?
  2014-04-24 22:33   ` Larry Hall (Cygwin)
@ 2014-04-25  6:37     ` Achim Gratz
  2014-04-25 23:35     ` Andrey Repin
  1 sibling, 0 replies; 7+ messages in thread
From: Achim Gratz @ 2014-04-25  6:37 UTC (permalink / raw)
  To: cygwin

Larry Hall (Cygwin <reply-to-list-only-lh <at> cygwin.com> writes:
> Good catch.  Yes, the latest version of base_files makes this change to
> the profile_d() function.  Looks like the easiest interim solution is to
> downgrade to base_files-4.1-2.

The easiest interim solution is probably to unset LC_ALL or revert to
_LC_SAVE_ if set in lang.sh -- I'll have to think about this some more, but
that's probably the solution I'll use for the bugfix release as well (I
should manage to get it out over the weekend).

See http://cygwin.com/ml/cygwin/2012-08/msg00489.html and the discussion
leading up to it.  This just goes to show that nobody tested the test
version that was out there for almost two years.


Regards,
Achim.




--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How LANG environment variable is set?
  2014-04-24 22:33   ` Larry Hall (Cygwin)
  2014-04-25  6:37     ` Achim Gratz
@ 2014-04-25 23:35     ` Andrey Repin
  1 sibling, 0 replies; 7+ messages in thread
From: Andrey Repin @ 2014-04-25 23:35 UTC (permalink / raw)
  To: Larry Hall (Cygwin)

Greetings, Larry Hall (Cygwin)!

>> It looks like /etc/profile sets LC_ALL=C before running the scripts
>> in /etc/profile.d, then restores it to its original setting. This
>> prevents LANG getting set by lang.sh.
>>

> Good catch.  Yes, the latest version of base_files makes this change to
> the profile_d() function.  Looks like the easiest interim solution is to
> downgrade to base_files-4.1-2.

Actually, it might help to set LANG in user's profile instead.
I have this bit of code, working quite well:

case "$TERM" in
  xterm*)
    LANG=ru_RU.UTF-8
    ;;
  *)
    LANG=ru_RU.CP866
    ;;
esac

(mintty sets "xterm", so does xterm itself and other shells I connect to this
system with.)


--
WBR,
Andrey Repin (anrdaemon@yandex.ru) 26.04.2014, <03:11>

Sorry for my terrible english...


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How LANG environment variable is set?
@ 2014-04-24 22:45 Angelo Graziosi
  0 siblings, 0 replies; 7+ messages in thread
From: Angelo Graziosi @ 2014-04-24 22:45 UTC (permalink / raw)
  To: cygwin

David Rothenberger wrote:
> It looks like /etc/profile sets LC_ALL=C before running the scripts
> in /etc/profile.d, then restores it to its original setting. This
> prevents LANG getting set by lang.sh.

The statement LC_ALL=C has been introduced in /et/profile with the 
recent upgrade of base-file 4.2 (and indeed I was sure with base-fle 4.1 
LANG was correctly set..)

So, is this how things should work or we have caught a bug in the new 
base-file 4.2 release?


Ciao,
Angelo.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-04-25 23:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-24 21:13 How LANG environment variable is set? Angelo Graziosi
2014-04-24 21:24 ` Larry Hall (Cygwin)
2014-04-24 21:58 ` David Rothenberger
2014-04-24 22:33   ` Larry Hall (Cygwin)
2014-04-25  6:37     ` Achim Gratz
2014-04-25 23:35     ` Andrey Repin
2014-04-24 22:45 Angelo Graziosi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).