Language support quits immediately after starting

Bug #1772237 reported by Alex Shtof on 2018-05-20
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
language-selector (Ubuntu)
Medium
Gunnar Hjalmarsson
Bionic
Medium
Gunnar Hjalmarsson

Bug Description

[Impact]

When Ubuntu is installed with a locale name which Python does not understand, e.g. en_IL, Language Support crashes when you try to launch it. This is really a bug which should be fixed in the installer (bug #1646260). Awaiting the installer fix, this proposed upload prevents that Language Support crashes.

[Test Case]

1. Make sure that no ~/.xinputrc file is present.

2. Start Language Support from terminal using this command:

   LANG=en_IL gnome-language-selector

-> Find that you have reproduced the crash.

3. Install language-selector-gnome and language-selector-common from
   bionic-proposed and repeat step 2.

-> Language Support starts without crashing.

[Regression Potential]

None.

[Original description]

When I click on Language Support from the applications menu, it starts, shows a progress bar, and then immediately quits.

I do not see the crash report window open (Apport), but something seems to crash. Here is what is appended to the syslog when the phenomenon happens:

May 20 12:20:28 alex-laptop gnome-language-selector.desktop[14134]: Traceback (most recent call last):
May 20 12:20:28 alex-laptop gnome-language-selector.desktop[14134]: File "/usr/bin/gnome-language-selector", line 22, in on_activate
May 20 12:20:28 alex-laptop gnome-language-selector.desktop[14134]: options=options)
May 20 12:20:28 alex-laptop gnome-language-selector.desktop[14134]: File "/usr/lib/python3/dist-packages/LanguageSelector/gtk/GtkLanguageSelector.py", line 202, in __init__
May 20 12:20:28 alex-laptop gnome-language-selector.desktop[14134]: self.check_input_methods()
May 20 12:20:28 alex-laptop gnome-language-selector.desktop[14134]: File "/usr/lib/python3/dist-packages/LanguageSelector/gtk/GtkLanguageSelector.py", line 57, in wrapper
May 20 12:20:28 alex-laptop gnome-language-selector.desktop[14134]: res = f(*args, **kwargs)
May 20 12:20:28 alex-laptop gnome-language-selector.desktop[14134]: File "/usr/lib/python3/dist-packages/LanguageSelector/gtk/GtkLanguageSelector.py", line 453, in check_input_methods
May 20 12:20:28 alex-laptop gnome-language-selector.desktop[14134]: currentIM = self.ImConfig.getCurrentInputMethod()
May 20 12:20:28 alex-laptop gnome-language-selector.desktop[14134]: File "/usr/lib/python3/dist-packages/LanguageSelector/ImConfig.py", line 39, in getCurrentInputMethod
May 20 12:20:28 alex-laptop gnome-language-selector.desktop[14134]: loc = locale.getlocale(locale.LC_CTYPE)[0]
May 20 12:20:28 alex-laptop gnome-language-selector.desktop[14134]: File "/usr/lib/python3.6/locale.py", line 581, in getlocale
May 20 12:20:28 alex-laptop gnome-language-selector.desktop[14134]: return _parse_localename(localename)
May 20 12:20:28 alex-laptop gnome-language-selector.desktop[14134]: File "/usr/lib/python3.6/locale.py", line 490, in _parse_localename
May 20 12:20:28 alex-laptop gnome-language-selector.desktop[14134]: raise ValueError('unknown locale: %s' % localename)
May 20 12:20:28 alex-laptop gnome-language-selector.desktop[14134]: ValueError: unknown locale: en_IL

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: language-selector-gnome 0.188
ProcVersionSignature: Ubuntu 4.15.0-20.21-generic 4.15.17
Uname: Linux 4.15.0-20-generic x86_64
NonfreeKernelModules: nvidia_modeset nvidia
ApportVersion: 2.20.9-0ubuntu7
Architecture: amd64
CurrentDesktop: ubuntu:GNOME
Date: Sun May 20 12:15:21 2018
InstallationDate: Installed on 2018-05-19 (0 days ago)
InstallationMedia: Ubuntu 18.04 LTS "Bionic Beaver" - Release amd64 (20180426)
PackageArchitecture: all
ProcEnviron:
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=en_IL
 SHELL=/bin/bash
SourcePackage: language-selector
UpgradeStatus: No upgrade log present (probably fresh install)

Alex Shtof (alex-shtf) wrote :
Alex Shtof (alex-shtf) wrote :

After some research, it seems like a Python bug. I can reproduce the same problem by running the python3 interpreter:

Python 3.6.5 (default, Apr 1 2018, 05:46:30)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> locale.setlocale(locale.LC_CTYPE, 'en_IL')
'en_IL'
>>> mylocale = locale.getlocale(locale.LC_CTYPE)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.6/locale.py", line 581, in getlocale
    return _parse_localename(localename)
  File "/usr/lib/python3.6/locale.py", line 490, in _parse_localename
    raise ValueError('unknown locale: %s' % localename)
ValueError: unknown locale: en_IL
>>>

Gunnar Hjalmarsson (gunnarhj) wrote :

Thanks for your report!

Right, Python is the culprit; more precisely python and glibc have different ideas about what's a correct locale name.

Probably your /etc/default/locale file includes this line:

LANG=en_IL

To fix this for yourself, open the file for editing and change that line to:

LANG=en_IL.UTF-8

See also bug #1646260. I think I'll fix language-selector so it at least does not crash in cases like this.

Changed in language-selector (Ubuntu):
importance: Undecided → Medium
status: New → Triaged
Changed in language-selector (Ubuntu Bionic):
importance: Undecided → Medium
status: New → Triaged
description: updated
Changed in language-selector (Ubuntu):
assignee: nobody → Gunnar Hjalmarsson (gunnarhj)
status: Triaged → Fix Committed
Changed in language-selector (Ubuntu Bionic):
assignee: nobody → Gunnar Hjalmarsson (gunnarhj)
status: Triaged → In Progress
Launchpad Janitor (janitor) wrote :

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

---------------
language-selector (0.189) cosmic; urgency=medium

  * LanguageSelector/ImConfig.py:
    Prevent crash if LC_CTYPE has a value which Python does not
    understand (LP: #1772237).
  * debian/control:
    Drop obsolete X-Python3-Version field.

 -- Gunnar Hjalmarsson <email address hidden> Sun, 20 May 2018 21:56:00 +0200

Changed in language-selector (Ubuntu):
status: Fix Committed → Fix Released
Łukasz Zemczak (sil2100) wrote :

I was actually hesitating whether or not it makes sense to get this fix into bionic. Yes, the fix is legit and I think this is how it should be in language-selector from the beginning - an invalid locale string should not cause a crash but should be handled as you proposed. I was a bit worried since I think we anyway need to get localechooser fixed, as this fix here will only eliminate the crash - certain new locales still won't work as they should because of the missing codeset component. And every update carries a risk, so potentially we'd like to avoid unnecessary updates.

But... I decided that in this case we should just do it. I might pick up and get localechooser do the right thing, but language-selector binaries are anyway quite small and who knows when we'll encounter the issue again.

Changed in language-selector (Ubuntu Bionic):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-bionic

Hello Alex, or anyone else affected,

Accepted language-selector into bionic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/language-selector/0.188.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed.Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-bionic to verification-done-bionic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-bionic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Gunnar Hjalmarsson (gunnarhj) wrote :

Verified the test case with version 0.188.1 of language-selector-{common,gnome} from bionic-proposed.

tags: added: verification-done verification-done-bionic
removed: verification-needed verification-needed-bionic
Alex Shtof (alex-shtf) wrote :

Indeed fixes the problem.

Launchpad Janitor (janitor) wrote :

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

---------------
language-selector (0.188.1) bionic-proposed; urgency=medium

  * LanguageSelector/ImConfig.py:
    Prevent crash if LC_CTYPE has a value which Python does not
    understand (LP: #1772237).
  * debian/control:
    Drop obsolete X-Python3-Version field.

 -- Gunnar Hjalmarsson <email address hidden> Sun, 20 May 2018 21:56:00 +0200

Changed in language-selector (Ubuntu Bionic):
status: Fix Committed → Fix Released

The verification of the Stable Release Update for language-selector has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers