[Bug 1013387] Re: command-not-found crashes when my locale is invalid
Ma Xiaojun
damage3025 at gmail.com
Fri Dec 7 21:11:50 UTC 2012
A reliable way to reproduce is:
$ LANG=junk junk
Sorry, command-not-found has crashed! Please file a bug report at:
https://bugs.launchpad.net/command-not-found/+filebug
Please include the following information with the report:
command-not-found version: 0.3
Python version: 3.2.3 final 0
Distributor ID: Ubuntu
Description: Ubuntu 12.10
Release: 12.10
Codename: quantal
Exception information:
unsupported locale setting
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/CommandNotFound/util.py", line 24, in crash_guard
callback()
File "/usr/lib/command-not-found", line 69, in main
enable_i18n()
File "/usr/lib/command-not-found", line 40, in enable_i18n
locale.setlocale(locale.LC_ALL, '')
File "/usr/lib/python3.2/locale.py", line 541, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting
Yes, probably no one would set LANG to "junk". But people may misspell
locales and see the above daunting error message.
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to command-not-found in Ubuntu.
https://bugs.launchpad.net/bugs/1013387
Title:
command-not-found crashes when my locale is invalid
Status in command-not-found handler:
New
Status in “command-not-found” package in Ubuntu:
Confirmed
Bug description:
I've these locale vars in my environment:
$ env|grep ^LC_\\\|^LANG
LC_MESSAGES=lt_LT.UTF-8
LC_COLLATE=lt_LT.UTF-8
LANG=en_US.UTF-8
LC_CTYPE=lt_LT.UTF-8
When I ssh into a new Ubuntu 12.04 server install, that locale doesn't
exist:
$ locale charmap
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
ANSI_X3.4-1968
I was trying to generate it and misspelled the command name, when
suddenly command-not-found crashed:
# localegen lt_LT.UTF-8
Sorry, command-not-found has crashed! Please file a bug report at:
https://bugs.launchpad.net/command-not-found/+filebug
Please include the following information with the report:
command-not-found version: 0.2.44
After I generated the locale, I was no longer able to reproduce the
crash:
# locale-gen lt_LT.UTF-8
Generating locales...
lt_LT.UTF-8... done
Generation complete.
# localegen lt_LT.UTF-8
No command 'localegen' found, did you mean:
Command 'locale-gen' from package 'locales' (main)
localegen: command not found
To manage notifications about this bug go to:
https://bugs.launchpad.net/command-not-found/+bug/1013387/+subscriptions
More information about the foundations-bugs
mailing list