gnome-language-selector crashed with Error in setlocale()

Bug #651582 reported by aar
126
This bug affects 18 people
Affects Status Importance Assigned to Milestone
language-selector (Ubuntu)
Fix Released
Undecided
Gunnar Hjalmarsson

Bug Description

Binary package hint: language-selector

Trying to change en-US to es-ES language

ProblemType: Crash
DistroRelease: Ubuntu 10.10
Package: language-selector 0.6.5
ProcVersionSignature: Ubuntu 2.6.35-22.33-generic 2.6.35.4
Uname: Linux 2.6.35-22-generic i686
Architecture: i386
Date: Wed Sep 29 23:40:12 2010
ExecutablePath: /usr/bin/gnome-language-selector
InstallationMedia: Ubuntu 10.10 "Maverick Meerkat" - Beta i386 (20100901.1)
InterpreterPath: /usr/bin/python2.6
PackageArchitecture: all
ProcCmdline: /usr/bin/python /usr/bin/gnome-language-selector
ProcEnviron:
 LANG=bn_IN.utf8
 SHELL=/bin/bash
PythonArgs: ['/usr/bin/gnome-language-selector']
SourcePackage: language-selector
Title: gnome-language-selector crashed with Error in setlocale()
UserGroups: adm admin cdrom dialout lpadmin plugdev sambashare

Revision history for this message
aar (rhaaron) wrote :
tags: removed: need-duplicate-check
visibility: private → public
Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

I'll make a try to address the setlocale() issue according to this bug and its duplicates, but since I'm not able to reproduce the crashes as reported, I'd appreciate your help.

First, could you please let us know if you are able to reproduce the crash, or was it rather a temporary glitch?

Also, I'd appreciate if you could try to edit this program file:
/usr/share/pyshared/LanguageSelector/gtk/GtkLanguageSelector.py

That file contains the updateExampleBox() function, which begins at or near line 966 (the line number can vary a little depending on the language-selector version). Can you please edit it in accordance with the diff below, and let us know whether you notice a difference.

--- old/GtkLanguageSelector.py 2011-02-14 16:59:26 +0100
+++ new/GtkLanguageSelector.py 2011-02-17 02:26:30 +0100
@@ -971,7 +971,8 @@
         (lang, code) = model[combo.get_active()]
         macr = macros.LangpackMacros(self._datadir, code)
         mylocale = macr["SYSLOCALE"]
- locale.setlocale(locale.LC_ALL, mylocale)
+ for category in locale.LC_MONETARY, locale.LC_NUMERIC, locale.LC_TIME:
+ locale.setlocale(category, mylocale)
         self.label_example_currency.set_text(locale.currency(20457.99))
         self.label_example_number.set_text(locale.format("%.2f", 1234567.89, grouping=True))
         self.label_example_date.set_text(time.strftime(locale.nl_langinfo(locale.D_T_FMT)))

If you have an own idea about what to do to make the code in question run more safely, your advice would of course be much appreciated.

Changed in language-selector (Ubuntu):
assignee: nobody → Gunnar Hjalmarsson (gunnarhj)
status: New → In Progress
Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

Ouch, the indenting did not come out right in the diff above, and since this is Python, indenting is crucial.

Consequently, if you try to edit the file as suggested, please disregard the code in the above comment, and use the GtkLanguageSelector.diff attachment instead.

Revision history for this message
Giovanni (druid-taliesin) wrote : Re: [Bug 651582] Re: gnome-language-selector crashed with Error in setlocale()

Hi, I will try it soon and I will notify you the result.

Bye

On 17 February 2011 03:26, Gunnar Hjalmarsson <email address hidden>wrote:

> Ouch, the indenting did not come out right in the diff above, and since
> this is Python, indenting is crucial.
>
> Consequently, if you try to edit the file as suggested, please disregard
> the code in the above comment, and use the GtkLanguageSelector.diff
> attachment instead.
>
> ** Patch added: "GtkLanguageSelector.diff"
>
> https://bugs.launchpad.net/ubuntu/+source/language-selector/+bug/651582/+attachment/1855431/+files/GtkLanguageSelector.diff
>
> --
> You received this bug notification because you are a direct subscriber
> of a duplicate bug (533159).
> https://bugs.launchpad.net/bugs/651582
>
> Title:
> gnome-language-selector crashed with Error in setlocale()
>
> Status in “language-selector” package in Ubuntu:
> In Progress
>
> Bug description:
> Binary package hint: language-selector
>
> Trying to change en-US to es-ES language
>
> ProblemType: Crash
> DistroRelease: Ubuntu 10.10
> Package: language-selector 0.6.5
> ProcVersionSignature: Ubuntu 2.6.35-22.33-generic 2.6.35.4
> Uname: Linux 2.6.35-22-generic i686
> Architecture: i386
> Date: Wed Sep 29 23:40:12 2010
> ExecutablePath: /usr/bin/gnome-language-selector
> InstallationMedia: Ubuntu 10.10 "Maverick Meerkat" - Beta i386
> (20100901.1)
> InterpreterPath: /usr/bin/python2.6
> PackageArchitecture: all
> ProcCmdline: /usr/bin/python /usr/bin/gnome-language-selector
> ProcEnviron:
> LANG=bn_IN.utf8
> SHELL=/bin/bash
> PythonArgs: ['/usr/bin/gnome-language-selector']
> SourcePackage: language-selector
> Title: gnome-language-selector crashed with Error in setlocale()
> UserGroups: adm admin cdrom dialout lpadmin plugdev sambashare
>
> To unsubscribe from this bug, go to:
>
> https://bugs.launchpad.net/ubuntu/+source/language-selector/+bug/651582/+subscribe
>

Revision history for this message
Moti Ochayun (moti) wrote :

tank you for your answer

i am sorry but i can't reproduce the crashes it's like it's ok now
and i have Hebrew

tank moti

בתאריך 17/02/2011 04:18, ציטוט

  Gunnar Hjalmarsson:

> I'll make a try to address the setlocale() issue according to this bug
> and its duplicates, but since I'm not able to reproduce the crashes as
> reported, I'd appreciate your help.
>
> First, could you please let us know if you are able to reproduce the
> crash, or was it rather a temporary glitch?
>
> Also, I'd appreciate if you could try to edit this program file:
> /usr/share/pyshared/LanguageSelector/gtk/GtkLanguageSelector.py
>
> That file contains the updateExampleBox() function, which begins at or
> near line 966 (the line number can vary a little depending on the
> language-selector version). Can you please edit it in accordance with
> the diff below, and let us know whether you notice a difference.
>
> --- old/GtkLanguageSelector.py 2011-02-14 16:59:26 +0100
> +++ new/GtkLanguageSelector.py 2011-02-17 02:26:30 +0100
> @@ -971,7 +971,8 @@
> (lang, code) = model[combo.get_active()]
> macr = macros.LangpackMacros(self._datadir, code)
> mylocale = macr["SYSLOCALE"]
> - locale.setlocale(locale.LC_ALL, mylocale)
> + for category in locale.LC_MONETARY, locale.LC_NUMERIC, locale.LC_TIME:
> + locale.setlocale(category, mylocale)
> self.label_example_currency.set_text(locale.currency(20457.99))
> self.label_example_number.set_text(locale.format("%.2f", 1234567.89, grouping=True))
> self.label_example_date.set_text(time.strftime(locale.nl_langinfo(locale.D_T_FMT)))
>
> If you have an own idea about what to do to make the code in question
> run more safely, your advice would of course be much appreciated.
>
> ** Changed in: language-selector (Ubuntu)
> Status: New => In Progress
>
> ** Changed in: language-selector (Ubuntu)
> Assignee: (unassigned) => Gunnar Hjalmarsson (gunnarhj)
>

Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

Moti, don't be sorry - it may be just as useful to know that you can't reproduce the crash. Thanks! :-)

In the linked branch I propose a minor change to language-selector that might make a difference as regards this bug report and its duplicates (or some of them).

I'm still interested in your feedback and further input.

Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

Code that makes setlocale() errors non-fatal has now been added to the merge proposal, which will prevent crashes as described in this bug and its duplicates. Possible errors will make an error message be shown instead, so time will tell if language-selector may still fail to display the example box properly.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package language-selector - 0.15

---------------
language-selector (0.15) natty; urgency=low

  [ Romain Perier ]
  * LanguageSelector/qt/QtLanguageSelector.py:
   - Unapply changes on changing tab
  * data/incomplete-language-support-kde.note.in
   - Run kcontrol module

  [ Gunnar Hjalmarsson ]
  * LanguageSelector/LocaleInfo.py:
    - Ensure that generated_locales() only returns UTF-8 locales
      (LP: #533159).
  * LanguageSelector/gtk/GtkLanguageSelector.py:
    - Make setlocale() errors non-fatal (LP: #651582).
  * Changed Korean fonts settings as suggested by jincreator:
    - fontconfig/29-language-selector-ko-kr.conf removed (LP: #715742).
    - fontconfig/69-language-selector-ko-kr.conf edited (LP: #716872).
      Thanks for the patch!
 -- Michael Casadevall <email address hidden> Wed, 23 Feb 2011 13:49:05 -0800

Changed in language-selector (Ubuntu):
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.