Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 373115

Summary: app-emulation/virt-manager didn't started with Czech locale because python's "bug" in
Product: Gentoo Linux Reporter: Jiří Moravec <qjim>
Component: [OLD] DevelopmentAssignee: Python Gentoo Team <python>
Severity: normal CC: virtualization
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Package list:
Runtime testing required: ---

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/", line 467, in <module>
  File "/usr/share/virt-manager/", line 321, in main
  File "/usr/share/virt-manager/", line 80, in setup_i18n
    gettext.install(gettext_app, gettext_dir)
  File "/usr/lib64/python2.6/", line 493, in install
    t = translation(domain, localedir, fallback=True, codeset=codeset)
  File "/usr/lib64/python2.6/", line 478, in translation
    t = _translations.setdefault(key, class_(open(mofile, 'rb')))
  File "/usr/lib64/python2.6/", line 180, in __init__
  File "/usr/lib64/python2.6/", 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:

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/ and /usr/lib64/python2.7/ files.

Cole Robinson's original patch:

diff -rup Python-2.7.1/Lib/ new/Lib/
--- Python-2.7.1/Lib/ 2011-04-01 11:46:04.000000000 -0400
+++ new/Lib/  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
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 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?