public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] More locale oddness
@ 2011-01-07  1:49 Stroller
  2011-01-07  2:29 ` Dale
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Stroller @ 2011-01-07  1:49 UTC (permalink / raw
  To: gentoo-user

Hi there,

Can anyone else reproduce this, please, or tell me what behaviour is expected?

$ locale 
LANG=en_GB.UTF-8
LC_CTYPE="en_GB.UTF-8"
LC_NUMERIC="en_GB.UTF-8"
LC_TIME=en_GB.UTF-8
LC_COLLATE="en_GB.UTF-8"
LC_MONETARY="en_GB.UTF-8"
LC_MESSAGES="en_GB.UTF-8"
LC_PAPER="en_GB.UTF-8"
LC_NAME="en_GB.UTF-8"
LC_ADDRESS="en_GB.UTF-8"
LC_TELEPHONE="en_GB.UTF-8"
LC_MEASUREMENT="en_GB.UTF-8"
LC_IDENTIFICATION="en_GB.UTF-8"
LC_ALL=
$ date +"%l:%M%P"
 1:39
$ LC_TIME="POSIX"
$ date +"%l:%M%P"
 1:39am
$

I had a single line of only LANG="en_GB.UTF-8" in /etc/env.d/02locale; adding LC_TIME="POSIX" allows various scripts and stuff (I've written) to show the date properly, but I think I read somewhere that this is bad.

Thanks for any advice,

Stroller.




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

* Re: [gentoo-user] More locale oddness
  2011-01-07  1:49 [gentoo-user] More locale oddness Stroller
@ 2011-01-07  2:29 ` Dale
  2011-01-07  6:26 ` Alan McKinnon
  2011-01-07  8:21 ` Steffen Loos
  2 siblings, 0 replies; 8+ messages in thread
From: Dale @ 2011-01-07  2:29 UTC (permalink / raw
  To: gentoo-user

Stroller wrote:
> Hi there,
>
> Can anyone else reproduce this, please, or tell me what behaviour is expected?
>
> $ locale
> LANG=en_GB.UTF-8
> LC_CTYPE="en_GB.UTF-8"
> LC_NUMERIC="en_GB.UTF-8"
> LC_TIME=en_GB.UTF-8
> LC_COLLATE="en_GB.UTF-8"
> LC_MONETARY="en_GB.UTF-8"
> LC_MESSAGES="en_GB.UTF-8"
> LC_PAPER="en_GB.UTF-8"
> LC_NAME="en_GB.UTF-8"
> LC_ADDRESS="en_GB.UTF-8"
> LC_TELEPHONE="en_GB.UTF-8"
> LC_MEASUREMENT="en_GB.UTF-8"
> LC_IDENTIFICATION="en_GB.UTF-8"
> LC_ALL=
> $ date +"%l:%M%P"
>   1:39
> $ LC_TIME="POSIX"
> $ date +"%l:%M%P"
>   1:39am
> $
>
> I had a single line of only LANG="en_GB.UTF-8" in /etc/env.d/02locale; adding LC_TIME="POSIX" allows various scripts and stuff (I've written) to show the date properly, but I think I read somewhere that this is bad.
>
> Thanks for any advice,
>
> Stroller.
>
>    

This is mine:

root@fireball / # locale
LANG=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=
root@fireball / #

No idea about anything bad tho.  Just for comparison.

Dale

:-)  :-)



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

* Re: [gentoo-user] More locale oddness
  2011-01-07  1:49 [gentoo-user] More locale oddness Stroller
  2011-01-07  2:29 ` Dale
@ 2011-01-07  6:26 ` Alan McKinnon
  2011-01-07 16:33   ` Stroller
  2011-01-07  8:21 ` Steffen Loos
  2 siblings, 1 reply; 8+ messages in thread
From: Alan McKinnon @ 2011-01-07  6:26 UTC (permalink / raw
  To: gentoo-user

Apparently, though unproven, at 03:49 on Friday 07 January 2011, Stroller did 
opine thusly:

> Hi there,
> 
> Can anyone else reproduce this, please, or tell me what behaviour is
> expected?
> 
> $ locale
> LANG=en_GB.UTF-8
> LC_CTYPE="en_GB.UTF-8"
> LC_NUMERIC="en_GB.UTF-8"
> LC_TIME=en_GB.UTF-8
> LC_COLLATE="en_GB.UTF-8"
> LC_MONETARY="en_GB.UTF-8"
> LC_MESSAGES="en_GB.UTF-8"
> LC_PAPER="en_GB.UTF-8"
> LC_NAME="en_GB.UTF-8"
> LC_ADDRESS="en_GB.UTF-8"
> LC_TELEPHONE="en_GB.UTF-8"
> LC_MEASUREMENT="en_GB.UTF-8"
> LC_IDENTIFICATION="en_GB.UTF-8"
> LC_ALL=
> $ date +"%l:%M%P"
>  1:39
> $ LC_TIME="POSIX"
> $ date +"%l:%M%P"
>  1:39am
> $
> 
> I had a single line of only LANG="en_GB.UTF-8" in /etc/env.d/02locale;
> adding LC_TIME="POSIX" allows various scripts and stuff (I've written) to
> show the date properly, but I think I read somewhere that this is bad.

Your output looks fine, except for the last two commands. LC_TIME is an 
envvar, you have set it without exporting it, then ran data again and got a 
change. I don't understand how you managed that as LC_TIME would no longer be 
POSIX at that stage:

$ cat /etc/env.d/02locale
LANG="en_GB.utf8"
$ locale
LANG=en_GB.utf8
LC_CTYPE="en_GB.utf8"
LC_NUMERIC="en_GB.utf8"
LC_TIME="en_GB.utf8"
LC_COLLATE="en_GB.utf8"
LC_MONETARY="en_GB.utf8"
LC_MESSAGES="en_GB.utf8"
LC_PAPER="en_GB.utf8"
LC_NAME="en_GB.utf8"
LC_ADDRESS="en_GB.utf8"
LC_TELEPHONE="en_GB.utf8"
LC_MEASUREMENT="en_GB.utf8"
LC_IDENTIFICATION="en_GB.utf8"
LC_ALL=
$ date +"%l:%M%P"
 8:16
$ LC_TIME="POSIX"
$ date +"%l:%M%P"
 8:17
$ LC_TIME="POSIX" date +"%l:%M%P"
 8:18am


As for the "correct" way and what is "bad", I've also read stuff. I've read 
lots and lots and lots of opinions, but not much fact. So here's my own mere 
opinion:

It doesn't really matter where you set it as long as it gets the job done.
Put it in conf.d to have it global.
Put it in /etc/profile* to have it global for a shell
Put it in ~/.profile* to set it for a single user.

Or maybe you meant that you've read some people opine that setting just 
LC_TIME is bad?

-- 
alan dot mckinnon at gmail dot com



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

* Re: [gentoo-user] More locale oddness
  2011-01-07  1:49 [gentoo-user] More locale oddness Stroller
  2011-01-07  2:29 ` Dale
  2011-01-07  6:26 ` Alan McKinnon
@ 2011-01-07  8:21 ` Steffen Loos
  2 siblings, 0 replies; 8+ messages in thread
From: Steffen Loos @ 2011-01-07  8:21 UTC (permalink / raw
  To: gentoo-user

Am 07.01.2011 02:49, schrieb Stroller:
> Hi there,
>
> Can anyone else reproduce this, please, or tell me what behaviour is expected?
>
> $ locale
> LANG=en_GB.UTF-8
> LC_CTYPE="en_GB.UTF-8"
> LC_NUMERIC="en_GB.UTF-8"
> LC_TIME=en_GB.UTF-8
> LC_COLLATE="en_GB.UTF-8"
> LC_MONETARY="en_GB.UTF-8"
> LC_MESSAGES="en_GB.UTF-8"
> LC_PAPER="en_GB.UTF-8"
> LC_NAME="en_GB.UTF-8"
> LC_ADDRESS="en_GB.UTF-8"
> LC_TELEPHONE="en_GB.UTF-8"
> LC_MEASUREMENT="en_GB.UTF-8"
> LC_IDENTIFICATION="en_GB.UTF-8"
> LC_ALL=
> $ date +"%l:%M%P"
>   1:39
> $ LC_TIME="POSIX"
> $ date +"%l:%M%P"
>   1:39am
> $
On my host it looks the same.
It's based on the definitions in   /usr/share/i18n/locales/*.

If you are asking why just have a look on the files there and search for am_pm.
Eg. for en_GB this is the decisive line:
user@host /usr/share/i18n/locales $ grep am_pm en_GB
am_pm       "";""
which means: write nothing. And for POSIX:
user@host /usr/share/i18n/locales $ grep am_pm POSIX
am_pm   "<U0041><U004D>";"<U0050><U004D>"
which represents "AM;PM" in Unicode.


>
> I had a single line of only LANG="en_GB.UTF-8" in /etc/env.d/02locale; adding LC_TIME="POSIX" allows various scripts and stuff (I've written) to show the date properly, but I think I read somewhere that this is bad.
>
Hm, it's up to you which locales matches your needs. Maybe a more portable(in sense of locales) timestamp format in your scripts could also be a way.


Steffen





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

* Re: [gentoo-user] More locale oddness
  2011-01-07  6:26 ` Alan McKinnon
@ 2011-01-07 16:33   ` Stroller
  2011-01-08 13:24     ` Alan McKinnon
  0 siblings, 1 reply; 8+ messages in thread
From: Stroller @ 2011-01-07 16:33 UTC (permalink / raw
  To: gentoo-user


On 7/1/2011, at 6:26am, Alan McKinnon wrote:
>> ...
>> Can anyone else reproduce this, please, or tell me what behaviour is
>> expected?
>> 
>> $ locale
>> LANG=en_GB.UTF-8
>> LC_CTYPE="en_GB.UTF-8"
>> LC_NUMERIC="en_GB.UTF-8"
>> ...
>> $ date +"%l:%M%P"
>> 1:39
>> $ LC_TIME="POSIX"
>> $ date +"%l:%M%P"
>> 1:39am
>> $
> 
> Your output looks fine, except for the last two commands. LC_TIME is an 
> envvar, you have set it without exporting it, then ran data again and got a 
> change. I don't understand how you managed that as LC_TIME would no longer be 
> POSIX at that stage:
> 
> $ cat /etc/env.d/02locale
> LANG="en_GB.utf8"
> $ locale
> LANG=en_GB.utf8
> LC_CTYPE="en_GB.utf8"
> LC_NUMERIC="en_GB.utf8"
> LC_TIME="en_GB.utf8"
> ...
> $ date +"%l:%M%P"
> 8:16
> $ LC_TIME="POSIX"
> $ date +"%l:%M%P"
> 8:17
> $ LC_TIME="POSIX" date +"%l:%M%P"
> 8:18am

I've just tested on another machine. It seems like if I set it to match the first machine with both environments in the /etc/env.d/02locale:

$ cat /etc/env.d/02locale
LANG="en_GB.UTF-8"
LC_TIME="POSIX"
$ sudo env-update && source /etc/profile
$ source ~/.bashrc

Then I can reproduce switching LC_TIME without exporting or anything else:

$ date +"%l:%M%P"
 4:01pm
$ LC_TIME="en_GB.utf8"
$ date +"%l:%M%P"
 4:02
$ LC_TIME="POSIX"
$ date +"%l:%M%P"
 4:02pm
$ 

Removing either (& rebooting, because I don't really understand this stuff) removes the ability.

I don't know whether this is supposed to be correct or not; with both environments in /etc/env.d/02locale:

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

The variable is lacking quotes in the `locale` output above; I have no idea whether or not this makes any difference.

Stroller.





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

* Re: [gentoo-user] More locale oddness
  2011-01-07 16:33   ` Stroller
@ 2011-01-08 13:24     ` Alan McKinnon
  2011-01-08 14:13       ` Stroller
  2011-01-10 13:48       ` Steffen Loos
  0 siblings, 2 replies; 8+ messages in thread
From: Alan McKinnon @ 2011-01-08 13:24 UTC (permalink / raw
  To: gentoo-user; +Cc: Stroller

Apparently, though unproven, at 18:33 on Friday 07 January 2011, Stroller did 
opine thusly:

> On 7/1/2011, at 6:26am, Alan McKinnon wrote:
> >> ...
> >> Can anyone else reproduce this, please, or tell me what behaviour is
> >> expected?
> >> 
> >> $ locale
> >> LANG=en_GB.UTF-8
> >> LC_CTYPE="en_GB.UTF-8"
> >> LC_NUMERIC="en_GB.UTF-8"
> >> ...
> >> $ date +"%l:%M%P"
> >> 1:39
> >> $ LC_TIME="POSIX"
> >> $ date +"%l:%M%P"
> >> 1:39am
> >> $
> > 
> > Your output looks fine, except for the last two commands. LC_TIME is an
> > envvar, you have set it without exporting it, then ran data again and got
> > a change. I don't understand how you managed that as LC_TIME would no
> > longer be POSIX at that stage:
> > 
> > $ cat /etc/env.d/02locale
> > LANG="en_GB.utf8"
> > $ locale
> > LANG=en_GB.utf8
> > LC_CTYPE="en_GB.utf8"
> > LC_NUMERIC="en_GB.utf8"
> > LC_TIME="en_GB.utf8"
> > ...
> > $ date +"%l:%M%P"
> > 8:16
> > $ LC_TIME="POSIX"
> > $ date +"%l:%M%P"
> > 8:17
> > $ LC_TIME="POSIX" date +"%l:%M%P"
> > 8:18am
> 
> I've just tested on another machine. It seems like if I set it to match the
> first machine with both environments in the /etc/env.d/02locale:
> 
> $ cat /etc/env.d/02locale
> LANG="en_GB.UTF-8"
> LC_TIME="POSIX"
> $ sudo env-update && source /etc/profile
> $ source ~/.bashrc
> 
> Then I can reproduce switching LC_TIME without exporting or anything else:
> 
> $ date +"%l:%M%P"
>  4:01pm
> $ LC_TIME="en_GB.utf8"
> $ date +"%l:%M%P"
>  4:02
> $ LC_TIME="POSIX"
> $ date +"%l:%M%P"
>  4:02pm
> $
> 
> Removing either (& rebooting, because I don't really understand this stuff)
> removes the ability.
> 
> I don't know whether this is supposed to be correct or not; with both
> environments in /etc/env.d/02locale:
> 
> $ LC_TIME="POSIX"
> $ locale
> LANG=en_GB.UTF-8
> LC_CTYPE="en_GB.UTF-8"
> LC_NUMERIC="en_GB.UTF-8"
> LC_TIME=POSIX
> LC_COLLATE="en_GB.UTF-8"
> LC_MONETARY="en_GB.UTF-8"
> LC_MESSAGES="en_GB.UTF-8"
> LC_PAPER="en_GB.UTF-8"
> LC_NAME="en_GB.UTF-8"
> LC_ADDRESS="en_GB.UTF-8"
> LC_TELEPHONE="en_GB.UTF-8"
> LC_MEASUREMENT="en_GB.UTF-8"
> LC_IDENTIFICATION="en_GB.UTF-8"
> LC_ALL=
> $ LC_TIME="en_GB.utf8"
> $ locale
> LANG=en_GB.UTF-8
> LC_CTYPE="en_GB.UTF-8"
> LC_NUMERIC="en_GB.UTF-8"
> LC_TIME=en_GB.utf8
> LC_COLLATE="en_GB.UTF-8"
> LC_MONETARY="en_GB.UTF-8"
> LC_MESSAGES="en_GB.UTF-8"
> LC_PAPER="en_GB.UTF-8"
> LC_NAME="en_GB.UTF-8"
> LC_ADDRESS="en_GB.UTF-8"
> LC_TELEPHONE="en_GB.UTF-8"
> LC_MEASUREMENT="en_GB.UTF-8"
> LC_IDENTIFICATION="en_GB.UTF-8"
> LC_ALL=
> $
> 
> The variable is lacking quotes in the `locale` output above; I have no idea
> whether or not this makes any difference.
> 
> Stroller.


The effect of LC_TIME= on your machines doesn't make sense to me.

What shell are you running?


-- 
alan dot mckinnon at gmail dot com



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

* Re: [gentoo-user] More locale oddness
  2011-01-08 13:24     ` Alan McKinnon
@ 2011-01-08 14:13       ` Stroller
  2011-01-10 13:48       ` Steffen Loos
  1 sibling, 0 replies; 8+ messages in thread
From: Stroller @ 2011-01-08 14:13 UTC (permalink / raw
  To: gentoo-user


On 8/1/2011, at 1:24pm, Alan McKinnon wrote:
>> ...
>> I've just tested on another machine. It seems like if I set it to match the
>> first machine with both environments in the /etc/env.d/02locale:
>> 
>> $ cat /etc/env.d/02locale
>> LANG="en_GB.UTF-8"
>> LC_TIME="POSIX"
>> $ sudo env-update && source /etc/profile
>> $ source ~/.bashrc
>> 
>> Then I can reproduce switching LC_TIME without exporting or anything else:
>> 
>> $ date +"%l:%M%P"
>> 4:01pm
>> $ LC_TIME="en_GB.utf8"
>> $ date +"%l:%M%P"
>> 4:02
>> $ LC_TIME="POSIX"
>> $ date +"%l:%M%P"
>> 4:02pm
>> $
>> 
>> Removing either (& rebooting, because I don't really understand this stuff)
>> removes the ability.
>> 
>> I don't know whether this is supposed to be correct or not; with both
>> environments in /etc/env.d/02locale:
>> ...
> 
> The effect of LC_TIME= on your machines doesn't make sense to me.
> 
> What shell are you running?

Bash.

Stroller.




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

* Re: [gentoo-user] More locale oddness
  2011-01-08 13:24     ` Alan McKinnon
  2011-01-08 14:13       ` Stroller
@ 2011-01-10 13:48       ` Steffen Loos
  1 sibling, 0 replies; 8+ messages in thread
From: Steffen Loos @ 2011-01-10 13:48 UTC (permalink / raw
  To: gentoo-user

Am 08.01.2011 14:24, schrieb Alan McKinnon:
> Apparently, though unproven, at 18:33 on Friday 07 January 2011, Stroller did
> opine thusly:
>
>> On 7/1/2011, at 6:26am, Alan McKinnon wrote:
>>>> ...
>>>> Can anyone else reproduce this, please, or tell me what behaviour is
>>>> expected?
>>>>
>>>> $ locale
>>>> LANG=en_GB.UTF-8
>>>> LC_CTYPE="en_GB.UTF-8"
>>>> LC_NUMERIC="en_GB.UTF-8"
>>>> ...
>>>> $ date +"%l:%M%P"
>>>> 1:39
>>>> $ LC_TIME="POSIX"
>>>> $ date +"%l:%M%P"
>>>> 1:39am
>>>> $
>>>
>>> Your output looks fine, except for the last two commands. LC_TIME is an
>>> envvar, you have set it without exporting it, then ran data again and got
>>> a change. I don't understand how you managed that as LC_TIME would no
>>> longer be POSIX at that stage:
because: LC_TIME is exported already as it was set via /etc/env.d/02locale.


>> ...
>> Removing either (&  rebooting, because I don't really understand this stuff)
>> removes the ability.
Only unset LANG and LC_TIME is sufficient to reproduce the behaviour.



>> The variable is lacking quotes in the `locale` output above; I have no idea
>> whether or not this makes any difference.
I think it doesn't.

Steffen



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

end of thread, other threads:[~2011-01-10 14:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-07  1:49 [gentoo-user] More locale oddness Stroller
2011-01-07  2:29 ` Dale
2011-01-07  6:26 ` Alan McKinnon
2011-01-07 16:33   ` Stroller
2011-01-08 13:24     ` Alan McKinnon
2011-01-08 14:13       ` Stroller
2011-01-10 13:48       ` Steffen Loos
2011-01-07  8:21 ` Steffen Loos

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox