Public bug reported:

gnome-language-selector crashes if LANG is not set in either
/etc/default/locale or /etc/environment.

The error message is:

line 59, in getMissingLangPacks
    if "_" in default_lang:
TypeError: argument of type 'NoneType' is not iterable

where lines 57-60 of /usr/lib/python2.6/dist-
packages/LanguageSelector/LanguageSelector.py read:

57:        # now check for a missing default language support
58:        default_lang = self.getSystemDefaultLanguage()
59:        if "_" in default_lang:
60:            default_lang = default_lang.split("_")[0]

and getSystemDefaultLanguage reads:

    def getSystemDefaultLanguage(self):
        conffiles = ["/etc/default/locale", "/etc/environment"]
        for fname in conffiles:
            if os.path.exists(fname):
                for line in open(fname):
                    match = re.match(r'LANG="(.*)"$',line)
                    if match:
                        if "." in match.group(1):
                            return match.group(1).split(".")[0]
                        else:
                            return match.group(1)
        return None

Because of the way this function is used, it MAY NOT return None.  It
should instead return a graceful default: presumably, it should return
what is currently returned by the command 'locale' if it is not the C
locale, or some graceful default value like en_US.UTF-8.

** Affects: language-selector (Ubuntu)
     Importance: Undecided
         Status: New

-- 
Crashes when LANG not set in /etc/default/locale
https://bugs.launchpad.net/bugs/346363
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to