gnome-language-selector crashed with ValueError in _build_localename(): too many values to unpack

Bug #909256 reported by Mauro on 2011-12-28
42
This bug affects 5 people
Affects Status Importance Assigned to Milestone
language-selector (Ubuntu)
Undecided
Gunnar Hjalmarsson
Oneiric
Low
Gunnar Hjalmarsson
Precise
Undecided
Gunnar Hjalmarsson

Bug Description

SRU note
--------
I suggest that the linked branch is uploaded to oneiric-proposed. The change (patch attached) is identical with the change to LanguageSelector/gtk/GtkLanguageSelector.py at http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/precise/language-selector/precise/revision/146

Even if I don't know the exact reason why unicode strings may be passed to locale.setlocale() also in Oneiric, the fact that it apparently can happen is a good enough reason IMO to backport the Precise fix to Oneiric as an SRU, especially since the regression risk is zero.

/ Gunnar Hjalmarsson

Rest of description
-------------------
This bug affects Oneiric:

(gnome-language-selector:3039): Gdk-CRITICAL **: gdk_window_get_pointer: assertion `GDK_IS_WINDOW (window)' failed

(gnome-language-selector:3039): Gdk-CRITICAL **: gdk_window_get_pointer: assertion `GDK_IS_WINDOW (window)' failed

(gnome-language-selector:3039): Gdk-CRITICAL **: gdk_window_get_pointer: assertion `GDK_IS_WINDOW (window)' failed

(gnome-language-selector:3039): Gdk-CRITICAL **: gdk_window_get_pointer: assertion `GDK_IS_WINDOW (window)' failed

(gnome-language-selector:3039): Gdk-CRITICAL **: gdk_window_get_pointer: assertion `GDK_IS_WINDOW (window)' failed

(gnome-language-selector:3039): Gdk-CRITICAL **: gdk_window_get_pointer: assertion `GDK_IS_WINDOW (window)' failed
/usr/lib/python2.7/dist-packages/LanguageSelector/LocaleInfo.py:125: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  if lang_name == self._lang[lang]:
Traceback (most recent call last):
  File "/usr/bin/gnome-language-selector", line 27, in <module>
    options=options)
  File "/usr/lib/python2.7/dist-packages/LanguageSelector/gtk/GtkLanguageSelector.py", line 192, in __init__
    self.updateLocaleChooserCombo()
  File "/usr/lib/python2.7/dist-packages/LanguageSelector/gtk/GtkLanguageSelector.py", line 57, in wrapper
    res = f(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/LanguageSelector/gtk/GtkLanguageSelector.py", line 853, in updateLocaleChooserCombo
    self.updateExampleBox()
  File "/usr/lib/python2.7/dist-packages/LanguageSelector/gtk/GtkLanguageSelector.py", line 926, in updateExampleBox
    locale.setlocale(locale.LC_ALL, mylocale)
  File "/usr/lib/python2.7/locale.py", line 539, in setlocale
    locale = normalize(_build_localename(locale))
  File "/usr/lib/python2.7/locale.py", line 447, in _build_localename
    language, encoding = localetuple
ValueError: too many values to unpack

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in language-selector (Ubuntu):
status: New → Confirmed
Gunnar Hjalmarsson (gunnarhj) wrote :

Thanks for your help to improve Ubuntu by reporting this issue!

I have made an adjustment that I think fixes this bug. A language-selector build with the fix is available in my PPA at https://launchpad.net/~gunnarhj/+archive/misc
Can you please install it and let us know if it solves the issue you reported.

summary: - me-language-selector crashed with ValueError in _build_localename(): too
- many values to unpack
+ gnome-language-selector crashed with ValueError in _build_localename():
+ too many values to unpack
Changed in language-selector (Ubuntu):
assignee: nobody → Gunnar Hjalmarsson (gunnarhj)
status: Confirmed → In Progress
Mauro (jasmines) wrote :

It works! Thanks a lot!

Gunnar Hjalmarsson (gunnarhj) wrote :

Thanks for letting us know, Mauro.

Gunnar Hjalmarsson (gunnarhj) wrote :
description: updated

The attachment "diff_to_version_0.56.patch" of this bug report has been identified as being a patch in the form of a debdiff. The ubuntu-sponsors team has been subscribed to the bug report so that they can review and hopefully sponsor the debdiff. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-sponsors team please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
tags: added: oneiric-proposed sru
Sebastien Bacher (seb128) wrote :

is that bug different from bug #905429?

Gunnar Hjalmarsson (gunnarhj) wrote :

On 2012-01-02 14:47, Sebastien Bacher wrote:
> is that bug different from bug #905429?

Well, as regards bug #905429 I was able to spot why exactly the problem started (a pygobject upgrade). That's not the case here, which is the reason why I haven't duped it. OTOH, in both cases it's a shortcoming in locale.setlocale(), and the solution is identical.

Guess that makes the answer to your question a philosophical matter. :)

Martin Pitt (pitti) on 2012-01-02
Changed in language-selector (Ubuntu Oneiric):
assignee: nobody → Gunnar Hjalmarsson (gunnarhj)
status: New → In Progress
Changed in language-selector (Ubuntu Precise):
status: In Progress → Fix Released
Martin Pitt (pitti) wrote :

Thanks Gunnar, I sponsored the debdiff. Setting to Low, as oneiric's current pygobject should not expose this, but at some point it might be backported.

Changed in language-selector (Ubuntu Oneiric):
importance: Undecided → Low
status: In Progress → Fix Committed

Hello Mauro, or anyone else affected,

Accepted language-selector into oneiric-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

tags: added: verification-needed
Gunnar Hjalmarsson (gunnarhj) wrote :

I installed and run the oneiric-proposed version 0.56.1 successfully. Mauro's successfull test of the build in my PPA (which is identical with 0.56.1 except for the first line in debian/changelog) can be regarded to confirm that the package actually fixes the issue as expected.

Gunnar Hjalmarsson (gunnarhj) wrote :

On 2012-01-02 18:14, Martin Pitt wrote:
> Thanks Gunnar, I sponsored the debdiff. Setting to Low, as oneiric's
> current pygobject should not expose this,

True, but for some (to me unknown) reason locale names still seem to appear as 'unicode' type strings sometimes... Thought it was easiest to just backport the fix. :-/

> but at some point it might be backported.

Mauro (jasmines) wrote :

Jokin'? Thank YOU! :)

Martin Pitt (pitti) on 2012-01-03
tags: added: verification-done
removed: verification-needed
Donald Lhoëst (d-lhoest-y) wrote :

It works perfectly well. Thank you very much

Launchpad Janitor (janitor) wrote :

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

---------------
language-selector (0.56.1) oneiric-proposed; urgency=low

  * LanguageSelector/gtk/GtkLanguageSelector.py:
    Work around python2.7 crash when passing a unicode value to
    locale.setlocale() (LP: #909256).
    (Same solution as the solution in Precise to bug 905429.)
 -- Gunnar Hjalmarsson <email address hidden> Wed, 28 Dec 2011 19:00:00 +0100

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

Duplicates of this bug

Other bug subscribers