system-config-printer crashes on an unrecognised locale

Bug #225532 reported by nucc1
4
Affects Status Importance Assigned to Milestone
system-config-printer (Ubuntu)
Fix Released
Undecided
Unassigned
ubiquity (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

During installation of Hardy, I selected my location as Lagos/Nigeria. It appears that this resulted in my system locale being set to en_NG. There's nothing wrong with this, but I noticed that many system tools fail to launch unless I change my locale to a more recognised one (example en_UK).

system-config-printer fails to run and you can see the error message when launched from a terminal as:
Traceback (most recent call last):
  File "/usr/share/system-config-printer/system-config-printer.py", line 4492, in <module>
    main(start_printer, change_ppd)
  File "/usr/share/system-config-printer/system-config-printer.py", line 4466, in main
    mainwindow = GUI(start_printer, change_ppd)
  File "/usr/share/system-config-printer/system-config-printer.py", line 220, in __init__
    self.language = locale.getlocale(locale.LC_MESSAGES)
  File "/usr/lib/python2.5/locale.py", line 462, in getlocale
    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: en_NG

Revision history for this message
Lars Ljung (larslj) wrote :

This is a very trivial patch to fix the problem in system-config-printer. It just prints an error message and then continues as usual.

But maybe this should be fixed at a system level as well?

Changed in system-config-printer:
status: New → Confirmed
Revision history for this message
nucc1 (nucc1) wrote :

Better to fix this at the system level, because it affects (possibly many) other system utilities. For instance, gnome-power-manager won't shut down my laptop when the battery gets critically low, unless of course, I am running in a recognised locale. I deliberately haven't changed my default to en_UK just so I can observe the stuff that breaks.

I am not sure at all if en_NG is, for instance, a valid locale though, because as far as I know, the formal variant of english we use in Nigeria is en_UK.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package system-config-printer - 0.9.90+svn2385-0ubuntu1

---------------
system-config-printer (0.9.90+svn2385-0ubuntu1) intrepid; urgency=low

  * New upstream release
     o Subversion snapshot r2385
     o New main window layout, like gnome-cups-manager
     o Lots more of troubleshooting functionality
     o More on automatic driver download from OpenPrinting
     o Handle unknown locales gracefully (LP: #225532)
  * debian/system-config-printer-common.install,
    debian/system-config-printer-gnome.install: Added new files.
  * debian/patches/30_dont_blank_jetdirect_hostname.patch,
    debian/patches/27_crashbug_211867.patch,
    debian/patches/28_crashbug_213624.patch,
    debian/patches/29_crashbug_214579.patch,
    debian/patches/26_crashbug_195508.patch,
    debian/patches/24_crashbug_207338.patch,
    debian/patches/23_crashbug_203818.patch,
    debian/patches/25_crashbug_208305.patch,
    debian/patches/15_hpfax_queue_for_network_printer_and_hpfax2.patch,
    debian/patches/17_model-name-cleanup-improvements.patch,
    debian/patches/20_laserjet-1200-1300-no-postscript.patch: Removed
    all upstream patches introduced after Hardy's Feature Freeze, as we
    are returning to use the current SVN snapshots.

 -- Till Kamppeter <email address hidden> Fri, 02 May 2008 10:05:29 +0200

Changed in system-config-printer:
status: Confirmed → Fix Released
Revision history for this message
Pascal De Vuyst (pascal-devuyst) wrote :

fanen,
To fix this at the system level a recognized locale should be set during the Ubuntu installation process, did you use the alternate or desktop cd to install Ubuntu?

Revision history for this message
nucc1 (nucc1) wrote : Re: [Bug 225532] [NEW] system-config-printer crashes on an unrecognised locale

I used the desktop install cd. I only remember being asked to choose
my location, which is Lagos/Nigeria, and my keyboard layout, which is
US. I am aware that changing my locale at the gdm prompt fixes this,
but i'm not certain what is used to select the default locale though,
because my keyboard suggests en_US while my location suggests en_UK.
Thanks.

On 5/6/08, Pascal De Vuyst <email address hidden> wrote:
> fanen,
> To fix this at the system level a recognized locale should be set during the
> Ubuntu installation process, did you use the alternate or desktop cd to
> install Ubuntu?
>
> --
> system-config-printer crashes on an unrecognised locale
> https://bugs.launchpad.net/bugs/225532
> You received this bug notification because you are a direct subscriber
> of the bug.
>

--
Sent from Gmail for mobile | mobile.google.com

Revision history for this message
nucc1 (nucc1) wrote :

Looks like I've identified the culprit. The function
_parse_localename(localename), line 375 in
'/usr/lib/python2.5/locale.py.
I guess this affects all programs that import this module and call
this function. Gnochm is the program that clued me into this.

On 5/7/08, Fanen A. <email address hidden> wrote:
> I used the desktop install cd. I only remember being asked to choose
> my location, which is Lagos/Nigeria, and my keyboard layout, which is
> US. I am aware that changing my locale at the gdm prompt fixes this,
> but i'm not certain what is used to select the default locale though,
> because my keyboard suggests en_US while my location suggests en_UK.
> Thanks.
>
> On 5/6/08, Pascal De Vuyst <email address hidden> wrote:
> > fanen,
> > To fix this at the system level a recognized locale should be set during
> the
> > Ubuntu installation process, did you use the alternate or desktop cd to
> > install Ubuntu?
> >
> > --
> > system-config-printer crashes on an unrecognised locale
> > https://bugs.launchpad.net/bugs/225532
> > You received this bug notification because you are a direct subscriber
> > of the bug.
> >
>
> --
> Sent from Gmail for mobile | mobile.google.com
>

--
Sent from Gmail for mobile | mobile.google.com

Revision history for this message
nucc1 (nucc1) wrote :

Pardon me (fatigue). What I meant to say was, doesn't it amount to
fixing it on the system level if someone fixes that 'locale.py' ?

On 5/7/08, Fanen A. <email address hidden> wrote:
> Looks like I've identified the culprit. The function
> _parse_localename(localename), line 375 in
> '/usr/lib/python2.5/locale.py.
> I guess this affects all programs that import this module and call
> this function. Gnochm is the program that clued me into this.
>
> On 5/7/08, Fanen A. <email address hidden> wrote:
> > I used the desktop install cd. I only remember being asked to choose
> > my location, which is Lagos/Nigeria, and my keyboard layout, which is
> > US. I am aware that changing my locale at the gdm prompt fixes this,
> > but i'm not certain what is used to select the default locale though,
> > because my keyboard suggests en_US while my location suggests en_UK.
> > Thanks.
> >
> > On 5/6/08, Pascal De Vuyst <email address hidden> wrote:
> > > fanen,
> > > To fix this at the system level a recognized locale should be set during
> > the
> > > Ubuntu installation process, did you use the alternate or desktop cd to
> > > install Ubuntu?
> > >
> > > --
> > > system-config-printer crashes on an unrecognised locale
> > > https://bugs.launchpad.net/bugs/225532
> > > You received this bug notification because you are a direct subscriber
> > > of the bug.
> > >
> >
> > --
> > Sent from Gmail for mobile | mobile.google.com
> >
>
> --
> Sent from Gmail for mobile | mobile.google.com
>

--
Sent from Gmail for mobile | mobile.google.com

Revision history for this message
nucc1 (nucc1) wrote :

Does this require filing a new bug for each affected package? It also
affects gnochm and alacarte. The workaround is simple enough, but not
many people will realise they need to do that.

On 5/7/08, Pascal De Vuyst <email address hidden> wrote:
> ** Also affects: ubiquity (Ubuntu)
> Importance: Undecided
> Status: New
>
> --
> system-config-printer crashes on an unrecognised locale
> https://bugs.launchpad.net/bugs/225532
> You received this bug notification because you are a direct subscriber
> of the bug.
>

--
Sent from Gmail for mobile | mobile.google.com

Revision history for this message
Pascal De Vuyst (pascal-devuyst) wrote :

/usr/share/i18n/SUPPORTED lists all supported locales and en_NG is not listed here.
I assigned this bug to the desktop cd installer ubiquity since it should not set en_NG as your locale, since it is an unsupported locale.

Revision history for this message
Lars Ljung (larslj) wrote :

I believe there are two problems here. One is that some Python programs doesn't have proper error handling (see also bug #131205). The fact that locale.py throws an exception is fine, it's just that the applications needs to catch this. The other problem is that en_NG is not a defined locale for some reason. Have a look at "man locale-gen", it might shine some light over that issue.

On my system en_NG is listed in /usr/share/i18n/SUPPORTED, using locales 2.7.9-4

Revision history for this message
nucc1 (nucc1) wrote :

Inspecting /usr/share/i18n/SUPPORTED lists "en_NG UTF-8". I observe
that there is a missing 'period' between the en_NG part and the utf-8.
I suppose that's a syntax error, and may well be the cause of the bug?
The dots are missing in alternate entries.

On 5/7/08, Lars L <email address hidden> wrote:
> I believe there are two problems here. One is that some Python programs
> doesn't have proper error handling (see also bug #131205). The fact that
> locale.py throws an exception is fine, it's just that the applications
> needs to catch this. The other problem is that en_NG is not a defined
> locale for some reason. Have a look at "man locale-gen", it might shine
> some light over that issue.
>
> On my system en_NG is listed in /usr/share/i18n/SUPPORTED, using locales
> 2.7.9-4
>
> --
> system-config-printer crashes on an unrecognised locale
> https://bugs.launchpad.net/bugs/225532
> You received this bug notification because you are a direct subscriber
> of the bug.
>

--
Sent from Gmail for mobile | mobile.google.com

Revision history for this message
nucc1 (nucc1) wrote :

en_NG is in fact missing from /var/lib/locales/supported.d/en . After
adding it there using gedit, like so: lang_LOCALE.encoding, gnochm no
longer crashes, however, it doesn't display the document text, and
still prints the error message. It populates the contents pane fine
though.

On 5/8/08, Fanen A. <email address hidden> wrote:
> Inspecting /usr/share/i18n/SUPPORTED lists "en_NG UTF-8". I observe
> that there is a missing 'period' between the en_NG part and the utf-8.
> I suppose that's a syntax error, and may well be the cause of the bug?
> The dots are missing in alternate entries.
>
> On 5/7/08, Lars L <email address hidden> wrote:
> > I believe there are two problems here. One is that some Python programs
> > doesn't have proper error handling (see also bug #131205). The fact that
> > locale.py throws an exception is fine, it's just that the applications
> > needs to catch this. The other problem is that en_NG is not a defined
> > locale for some reason. Have a look at "man locale-gen", it might shine
> > some light over that issue.
> >
> > On my system en_NG is listed in /usr/share/i18n/SUPPORTED, using locales
> > 2.7.9-4
> >
> > --
> > system-config-printer crashes on an unrecognised locale
> > https://bugs.launchpad.net/bugs/225532
> > You received this bug notification because you are a direct subscriber
> > of the bug.
> >
>
> --
> Sent from Gmail for mobile | mobile.google.com
>

--
Sent from Gmail for mobile | mobile.google.com

Revision history for this message
Colin Watson (cjwatson) wrote :

There is a great deal of confusion in this bug report, so let me clear some things up.

en_NG is a valid locale name, and "en_NG UTF-8" is perfectly correct syntax in /usr/share/i18n/SUPPORTED. (It just doesn't mean quite what you think!)

Several people have mentioned en_UK, which is *not* a valid locale name! For British English, you want en_GB.UTF-8.

There's nothing wrong with locale.py as such, although there is an upstream Python bug about possibly improving this behaviour; however it would be a contentious change and is not appropriate to be made specifically in Ubuntu. It generally makes sense for individual Python programs in Ubuntu to ignore locale.Error exceptions from locale.setlocale, as has been done in system-config-printer. Please do file separate bugs on individual packages about this.

Did language-pack-en-base get installed on your system? That should have taken care of generating the en_NG locale automatically, so I'm confused that this doesn't seem to have happened.

Revision history for this message
nucc1 (nucc1) wrote : Re: [Bug 225532] Re: system-config-printer crashes on an unrecognised locale

language-pack-en-base is (and was) installed on my system.

After the traffic on this bug calmed down, I figured I was better off
working around the problems, and I got to the point where I couldn't
really tell if it was locale causing problems, or genuine bugs, so I
simply switched locale to en_GB.

I'll revert my locale and file bug reports as you have suggested.

Thanks.

Changed in ubiquity (Ubuntu):
status: New → Incomplete
Revision history for this message
Thomas Hotz (thotz-deactivatedaccount) wrote :

Closing until we have the information we requested.

Changed in ubiquity (Ubuntu):
status: Incomplete → Invalid
status: Invalid → Opinion
status: Opinion → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.