Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 373115 - app-emulation/virt-manager didn't started with Czech locale because python's "bug" in gettext.py
Summary: app-emulation/virt-manager didn't started with Czech locale because python's ...
Status: RESOLVED NEEDINFO
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Python Gentoo Team
URL: http://bugs.python.org/issue12425
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-26 14:02 UTC by Jiří Moravec
Modified: 2015-12-12 06:44 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jiří Moravec 2011-06-26 14:02:59 UTC
virt-manager exited with error:

Traceback (most recent call last):
  File "/usr/share/virt-manager/virt-manager.py", line 467, in <module>
    main()
  File "/usr/share/virt-manager/virt-manager.py", line 321, in main
    setup_i18n()
  File "/usr/share/virt-manager/virt-manager.py", line 80, in setup_i18n
    gettext.install(gettext_app, gettext_dir)
  File "/usr/lib64/python2.6/gettext.py", line 493, in install
    t = translation(domain, localedir, fallback=True, codeset=codeset)
  File "/usr/lib64/python2.6/gettext.py", line 478, in translation
    t = _translations.setdefault(key, class_(open(mofile, 'rb')))
  File "/usr/lib64/python2.6/gettext.py", line 180, in __init__
    self._parse(fp)
  File "/usr/lib64/python2.6/gettext.py", line 314, in _parse
    plural = v[1].split('plural=')[1]
IndexError: list index out of range

This problem was actually resolved in RedHat almost 3 month ago: https://bugzilla.redhat.com/show_bug.cgi?id=692632.

As Ignacio Vazquez-Abrams pointed out, this is actually virt-manager problem with buggy po/cs.po, but python solved this problem "ungracefully".

Patch created by Cole Robinson is present in redhat bugzilla and is functional for python-2.6 which I'm using now. Redhat bugzilla complaint was about python-2.7 which is probably affected too on Gentoo according no important difference between /usr/lib64/python2.6/gettext.py and /usr/lib64/python2.7/gettext.py files.

Cole Robinson's original patch:

diff -rup Python-2.7.1/Lib/gettext.py new/Lib/gettext.py
--- Python-2.7.1/Lib/gettext.py 2011-04-01 11:46:04.000000000 -0400
+++ new/Lib/gettext.py  2011-04-01 11:53:09.000000000 -0400
@@ -313,7 +313,12 @@ class GNUTranslations(NullTranslations):
                         self._charset = v.split('charset=')[1]
                     elif k == 'plural-forms':
                         v = v.split(';')
-                        plural = v[1].split('plural=')[1]
+                        if len(v) < 2:
+                            continue
+                        v = v[1].split('plural=')
+                        if len(v) < 2:
+                            continue
+                        plural = v[1]
                         self.plural = c2py(plural)
             # Note: we unconditionally convert both msgids and msgstrs to
             # Unicode using the character encoding specified in the charset
----------------------------------------------------------------------------

Reproducible: Always

Steps to Reproduce:
1. run virt-manager with Czech locale
2.
3.
Actual Results:  
python's traceback and no virt-manager at all.

Expected Results:  
virt-manager running
Comment 1 Dirkjan Ochtman (RETIRED) gentoo-dev 2011-06-27 07:31:10 UTC
I'm going to see if upstream wants to take something like this. (I've commented on http://bugs.python.org/issue1475523 for now.)
Comment 2 Matthias Maier gentoo-dev 2015-12-12 06:44:10 UTC
Is this bug still present in current virt-viewer-3.0 and currently stable python?