* [gentoo-portage-dev] [PATCH] emerge: Don't die when the user has an invalid locale setting
@ 2014-08-04 19:45 Mike Gilbert
2014-08-05 19:23 ` Alec Warner
2014-08-06 21:39 ` [gentoo-portage-dev] [PATCHv2] " Mike Gilbert
0 siblings, 2 replies; 8+ messages in thread
From: Mike Gilbert @ 2014-08-04 19:45 UTC (permalink / raw
To: gentoo-portage-dev
---
pym/_emerge/main.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index 1a920f7..722da84 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -999,7 +999,10 @@ def emerge_main(args=None):
args = portage._decode_argv(args)
# Use system locale.
- locale.setlocale(locale.LC_ALL, '')
+ try:
+ locale.setlocale(locale.LC_ALL, '')
+ except locale.Error as e:
+ print(e)
# Disable color until we're sure that it should be enabled (after
# EMERGE_DEFAULT_OPTS has been parsed).
--
2.0.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] emerge: Don't die when the user has an invalid locale setting
2014-08-04 19:45 [gentoo-portage-dev] [PATCH] emerge: Don't die when the user has an invalid locale setting Mike Gilbert
@ 2014-08-05 19:23 ` Alec Warner
2014-08-06 1:00 ` Mike Gilbert
2014-08-06 21:39 ` [gentoo-portage-dev] [PATCHv2] " Mike Gilbert
1 sibling, 1 reply; 8+ messages in thread
From: Alec Warner @ 2014-08-05 19:23 UTC (permalink / raw
To: gentoo-portage-dev
[-- Attachment #1: Type: text/plain, Size: 920 bytes --]
On Mon, Aug 4, 2014 at 12:45 PM, Mike Gilbert <floppym@gentoo.org> wrote:
> ---
> pym/_emerge/main.py | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
> index 1a920f7..722da84 100644
> --- a/pym/_emerge/main.py
> +++ b/pym/_emerge/main.py
> @@ -999,7 +999,10 @@ def emerge_main(args=None):
> args = portage._decode_argv(args)
>
> # Use system locale.
> - locale.setlocale(locale.LC_ALL, '')
> + try:
> + locale.setlocale(locale.LC_ALL, '')
> + except locale.Error as e:
> + print(e)
>
Portage has its own output functions (writemsg?)
You need to decide if this should be printed even if -q is passed, should
it be colorized, etc...
-A
>
> # Disable color until we're sure that it should be enabled (after
> # EMERGE_DEFAULT_OPTS has been parsed).
> --
> 2.0.4
>
>
>
[-- Attachment #2: Type: text/html, Size: 1590 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] emerge: Don't die when the user has an invalid locale setting
2014-08-05 19:23 ` Alec Warner
@ 2014-08-06 1:00 ` Mike Gilbert
0 siblings, 0 replies; 8+ messages in thread
From: Mike Gilbert @ 2014-08-06 1:00 UTC (permalink / raw
To: gentoo-portage-dev
On Tue, Aug 5, 2014 at 3:23 PM, Alec Warner <antarus@gentoo.org> wrote:
> On Mon, Aug 4, 2014 at 12:45 PM, Mike Gilbert <floppym@gentoo.org> wrote:
>>
>> ---
>> pym/_emerge/main.py | 5 ++++-
>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
>> index 1a920f7..722da84 100644
>> --- a/pym/_emerge/main.py
>> +++ b/pym/_emerge/main.py
>> @@ -999,7 +999,10 @@ def emerge_main(args=None):
>> args = portage._decode_argv(args)
>>
>> # Use system locale.
>> - locale.setlocale(locale.LC_ALL, '')
>> + try:
>> + locale.setlocale(locale.LC_ALL, '')
>> + except locale.Error as e:
>> + print(e)
>
>
> Portage has its own output functions (writemsg?)
> You need to decide if this should be printed even if -q is passed, should it
> be colorized, etc...
>
> -A
I would appreciate it if someone more familiar with portage could make
that decision and replace the print(e) with something better. Please
don't wait for me to familiarize myself with the code to fix this
rather annoying behavior.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [gentoo-portage-dev] [PATCHv2] emerge: Don't die when the user has an invalid locale setting
2014-08-04 19:45 [gentoo-portage-dev] [PATCH] emerge: Don't die when the user has an invalid locale setting Mike Gilbert
2014-08-05 19:23 ` Alec Warner
@ 2014-08-06 21:39 ` Mike Gilbert
2014-08-06 21:55 ` Sebastian Luther
2014-08-10 0:10 ` Brian Dolbec
1 sibling, 2 replies; 8+ messages in thread
From: Mike Gilbert @ 2014-08-06 21:39 UTC (permalink / raw
To: gentoo-portage-dev
Resolves bug 519074.
---
pym/_emerge/main.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index 1a920f7..52aa9c5 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -999,7 +999,10 @@ def emerge_main(args=None):
args = portage._decode_argv(args)
# Use system locale.
- locale.setlocale(locale.LC_ALL, '')
+ try:
+ locale.setlocale(locale.LC_ALL, '')
+ except locale.Error as e:
+ writemsg_level("setlocale: %s\n" % e, level=logging.WARN)
# Disable color until we're sure that it should be enabled (after
# EMERGE_DEFAULT_OPTS has been parsed).
--
2.0.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [gentoo-portage-dev] [PATCHv2] emerge: Don't die when the user has an invalid locale setting
2014-08-06 21:39 ` [gentoo-portage-dev] [PATCHv2] " Mike Gilbert
@ 2014-08-06 21:55 ` Sebastian Luther
2014-08-06 22:20 ` Mike Gilbert
2014-08-10 0:10 ` Brian Dolbec
1 sibling, 1 reply; 8+ messages in thread
From: Sebastian Luther @ 2014-08-06 21:55 UTC (permalink / raw
To: gentoo-portage-dev
Am 06.08.2014 23:39, schrieb Mike Gilbert:
> Resolves bug 519074.
> ---
> pym/_emerge/main.py | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
> index 1a920f7..52aa9c5 100644
> --- a/pym/_emerge/main.py
> +++ b/pym/_emerge/main.py
> @@ -999,7 +999,10 @@ def emerge_main(args=None):
> args = portage._decode_argv(args)
>
> # Use system locale.
> - locale.setlocale(locale.LC_ALL, '')
> + try:
> + locale.setlocale(locale.LC_ALL, '')
> + except locale.Error as e:
> + writemsg_level("setlocale: %s\n" % e, level=logging.WARN)
>
> # Disable color until we're sure that it should be enabled (after
> # EMERGE_DEFAULT_OPTS has been parsed).
>
Which locale does it use if this fails? Is it reasonable to continue?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [gentoo-portage-dev] [PATCHv2] emerge: Don't die when the user has an invalid locale setting
2014-08-06 21:55 ` Sebastian Luther
@ 2014-08-06 22:20 ` Mike Gilbert
2014-08-06 22:23 ` Mike Gilbert
0 siblings, 1 reply; 8+ messages in thread
From: Mike Gilbert @ 2014-08-06 22:20 UTC (permalink / raw
To: gentoo-portage-dev
On Wed, Aug 6, 2014 at 5:55 PM, Sebastian Luther <SebastianLuther@gmx.de> wrote:
> Am 06.08.2014 23:39, schrieb Mike Gilbert:
>> Resolves bug 519074.
>> ---
>> pym/_emerge/main.py | 5 ++++-
>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
>> index 1a920f7..52aa9c5 100644
>> --- a/pym/_emerge/main.py
>> +++ b/pym/_emerge/main.py
>> @@ -999,7 +999,10 @@ def emerge_main(args=None):
>> args = portage._decode_argv(args)
>>
>> # Use system locale.
>> - locale.setlocale(locale.LC_ALL, '')
>> + try:
>> + locale.setlocale(locale.LC_ALL, '')
>> + except locale.Error as e:
>> + writemsg_level("setlocale: %s\n" % e, level=logging.WARN)
>>
>> # Disable color until we're sure that it should be enabled (after
>> # EMERGE_DEFAULT_OPTS has been parsed).
>>
>
> Which locale does it use if this fails? Is it reasonable to continue?
>
As far as I can tell, it uses POSIX/C, just as if the call had never
taken place.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [gentoo-portage-dev] [PATCHv2] emerge: Don't die when the user has an invalid locale setting
2014-08-06 22:20 ` Mike Gilbert
@ 2014-08-06 22:23 ` Mike Gilbert
0 siblings, 0 replies; 8+ messages in thread
From: Mike Gilbert @ 2014-08-06 22:23 UTC (permalink / raw
To: gentoo-portage-dev
On Wed, Aug 6, 2014 at 6:20 PM, Mike Gilbert <floppym@gentoo.org> wrote:
> On Wed, Aug 6, 2014 at 5:55 PM, Sebastian Luther <SebastianLuther@gmx.de> wrote:
>> Am 06.08.2014 23:39, schrieb Mike Gilbert:
>>> Resolves bug 519074.
>>> ---
>>> pym/_emerge/main.py | 5 ++++-
>>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
>>> index 1a920f7..52aa9c5 100644
>>> --- a/pym/_emerge/main.py
>>> +++ b/pym/_emerge/main.py
>>> @@ -999,7 +999,10 @@ def emerge_main(args=None):
>>> args = portage._decode_argv(args)
>>>
>>> # Use system locale.
>>> - locale.setlocale(locale.LC_ALL, '')
>>> + try:
>>> + locale.setlocale(locale.LC_ALL, '')
>>> + except locale.Error as e:
>>> + writemsg_level("setlocale: %s\n" % e, level=logging.WARN)
>>>
>>> # Disable color until we're sure that it should be enabled (after
>>> # EMERGE_DEFAULT_OPTS has been parsed).
>>>
>>
>> Which locale does it use if this fails? Is it reasonable to continue?
>>
>
> As far as I can tell, it uses POSIX/C, just as if the call had never
> taken place.
From setlocale(3):
If its value is not a valid locale specification, the locale is
unchanged, and setlocale()
returns NULL.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [gentoo-portage-dev] [PATCHv2] emerge: Don't die when the user has an invalid locale setting
2014-08-06 21:39 ` [gentoo-portage-dev] [PATCHv2] " Mike Gilbert
2014-08-06 21:55 ` Sebastian Luther
@ 2014-08-10 0:10 ` Brian Dolbec
1 sibling, 0 replies; 8+ messages in thread
From: Brian Dolbec @ 2014-08-10 0:10 UTC (permalink / raw
To: gentoo-portage-dev
On Wed, 6 Aug 2014 17:39:14 -0400
Mike Gilbert <floppym@gentoo.org> wrote:
> Resolves bug 519074.
> ---
> pym/_emerge/main.py | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
Applied, thank you for the patch.
I edited the commit message a bit to conform to our preferred style.
----
emerge: fix invalid locale setting (bug 519074)
Don't die when the user has an invalid locale setting.
Resolves bug 519074.
--
Brian Dolbec <dolsen>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-08-10 0:11 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-04 19:45 [gentoo-portage-dev] [PATCH] emerge: Don't die when the user has an invalid locale setting Mike Gilbert
2014-08-05 19:23 ` Alec Warner
2014-08-06 1:00 ` Mike Gilbert
2014-08-06 21:39 ` [gentoo-portage-dev] [PATCHv2] " Mike Gilbert
2014-08-06 21:55 ` Sebastian Luther
2014-08-06 22:20 ` Mike Gilbert
2014-08-06 22:23 ` Mike Gilbert
2014-08-10 0:10 ` Brian Dolbec
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox