← Back to team overview

ubuntu-translations-coordinators team mailing list archive

[Bug 223281] Re: locale._parse_localename fails when localename does not contain encoding information (was: alacarte crashed with ValueError in _parse_localename() )

 

** Changed in: python
       Status: New => Incomplete

-- 
You received this bug notification because you are a member of Ubuntu
Translations Coordinators, which is subscribed to Ubuntu Translations.
Matching subscriptions: Ubuntu Translations bug mail
https://bugs.launchpad.net/bugs/223281

Title:
  locale._parse_localename fails when localename does not contain
  encoding information (was: alacarte crashed with ValueError in
  _parse_localename() )

Status in Python:
  Incomplete
Status in Ubuntu Translations:
  Fix Released
Status in “python2.6” package in Ubuntu:
  Fix Released
Status in “python2.6” source package in Karmic:
  Fix Released

Bug description:
  Binary package hint: alacarte

  "Main Menu" worked with first ubuntu 8.04 installation. After serbian
  language pack installed program did not working any more and in the
  terminal generate errors such like this:

  user@computer:~$ alacarte
  Traceback (most recent call last):
    File "/usr/bin/alacarte", line 36, in <module>
      main()
    File "/usr/bin/alacarte", line 32, in main
      app = MainWindow(datadir, version, sys.argv)
    File "/usr/lib/python2.5/site-packages/Alacarte/MainWindow.py", line 49, in __init__
      self.editor = MenuEditor()
    File "/usr/lib/python2.5/site-packages/Alacarte/MenuEditor.py", line 35, in __init__
      self.locale = locale.getdefaultlocale()[0]
    File "/usr/lib/python2.5/locale.py", line 443, in getdefaultlocale
      return _parse_localename(localename)
    File "/usr/lib/python2.5/locale.py", line 375, in _parse_localename
      raise ValueError, 'unknown locale: %s' % localename
  ValueError: unknown locale: sr_ME
  Error in sys.excepthook:
  Traceback (most recent call last):
    File "/usr/lib/python2.5/site-packages/apport_python_hook.py", line 78, in apport_excepthook
      report_file = open(pr_filename, 'wt')
  IOError: [Errno 13] Permission denied: '/var/crash/_usr_bin_alacarte.1000.crash'

  Original exception was:
  Traceback (most recent call last):
    File "/usr/bin/alacarte", line 36, in <module>
      main()
    File "/usr/bin/alacarte", line 32, in main
      app = MainWindow(datadir, version, sys.argv)
    File "/usr/lib/python2.5/site-packages/Alacarte/MainWindow.py", line 49, in __init__
      self.editor = MenuEditor()
    File "/usr/lib/python2.5/site-packages/Alacarte/MenuEditor.py", line 35, in __init__
      self.locale = locale.getdefaultlocale()[0]
    File "/usr/lib/python2.5/locale.py", line 443, in getdefaultlocale
      return _parse_localename(localename)
    File "/usr/lib/python2.5/locale.py", line 375, in _parse_localename
      raise ValueError, 'unknown locale: %s' % localename
  ValueError: unknown locale: sr_ME

  ProblemType: Crash
  Architecture: i386
  Date: Sun Apr 27 23:08:17 2008
  DistroRelease: Ubuntu 8.04
  ExecutablePath: /usr/bin/alacarte
  InterpreterPath: /usr/bin/python2.5
  Package: alacarte 0.11.5-0ubuntu1
  PackageArchitecture: all
  ProcCmdline: /usr/bin/python -OOt /usr/bin/alacarte
  ProcEnviron:
   PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin
   LANG=sr_ME
   SHELL=/bin/bash
  PythonArgs: ['/usr/bin/alacarte']
  SourcePackage: alacarte
  Title: alacarte crashed with ValueError in _parse_localename()
  Uname: Linux 2.6.24-16-generic i686
  UserGroups:

  -------------------

  INFORMATION FOR SRU CONSIDERATION FOLLOWS:

  1. A statement explaining the impact of the bug on users and
  justification for backporting the fix to the stable release:

  This bug prevents users in some locales (notable Serbia and Antigua,
  sr_ME and en_AG) from running locale-aware Python software in Ubuntu,
  including alacarte and software-center.  The latter is particularly
  problematic, as it is likely to affect many novice users.

  The proposed fix is small, clear, in the upstream bugtracker already,
  and is isolated to one function in one file, and has been used with
  success by users of Ubuntu Karmic in both the mentioned locales from a
  PPA.

  This appears to qualify as a bug ... "which represents a severe
  regression from the previous release of Ubuntu. This includes packages
  which are totally unusable, like being uninstallable or crashing on
  startup."

  It could perhaps be argued that these locales did not exist in earlier
  versions so this is not technically a regression?

  2. An explanation of how the bug has been addressed in the development
  branch, including the relevant version numbers of packages modified in
  order to implement the fix.

  An attached debdiff for Ubuntu Lucid is attached to this bug report.
  It awaits sponsorship.

  3. A minimal patch applicable to the stable version of the package.

  See attached debdiffs.  The original patch is at
  http://bugs.python.org/file14881/locale.py-parselocale-patch.diff

  4. Detailed instructions how to reproduce the bug.

  TEST CASE:

  4.1 Install Ubuntu 9.10 Karmic Desktop (i386 and amd64 have both been
  tested).

  4.2 At the GDM login screen, set the locale to English/Antigua and log
  in (start a session) in that locale.

  4.3 Click on Applications -> Ubuntu Software Center

  4.4 To see the Python traceback, open a Terminal window and run
  software-center from it.  A smaller test case would be to run

    LANG=en_AG python2.6 -c "import locale ; print
  locale.getdefaultlocale()"

  and testing all locales in this way can therefore be done by running

    sudo apt-get install ^language-pack-\*  -y    # Install all locales
    for i in $(locale -a)
    do
      echo $i
      LANG=$i python2.6 -c "import locale ; print locale.getdefaultlocale()" || break
    done

  4.5 If desired, obtain the patched python2.6 package(s) from the PPA
  at https://launchpad.net/~jmarsden/+archive/ppa/ and repeat the tests.
  software-center will now run and operate correctly.

  5. A discussion of the regression potential of the patch and how users
  could get inadvertently affected.

  This patch has been tested for every locale in Ubuntu Karmic, see 4.4
  above, but not every Python app has been tested with this patch.  So,
  by definition, there is a non-zero regression potential.

  Nevertheless, the patch is so small, and can be reviewed by anyone who
  reads Python for correctness.  It affects just one function, and then
  only in locales without a period in them (there are few such locales).
  On that basis, it is hard to see how it can really introduce a
  regression in practice.  This issue has been around for several
  versions of Ubuntu, so the current behaviour with the patch in place
  (for locale-aware Python applications at least) is an obvious
  improvement over earlier behaviour -- the applications actually run.
  So far, no Python apps have been found which this patch affects
  negatively.  The patch has been tested in several commonly used
  locales, including en_US.UTF-8, de_DE.utf8, es_ES.utf8 and fr_FR.utf8,
  as well as the affected locales sr_ME and en_AG.

  -------------------

To manage notifications about this bug go to:
https://bugs.launchpad.net/python/+bug/223281/+subscriptions