More effort put into this problem yielded a likely solution (i.e.
'hack'). First of all, the Python Exception was
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in
position 0: ordinal not in range(128)
This was with the bogus Simplified Chinese command 我。The expected way
command-not-found should have handled this would be something like:
root@u-VirtualBox:~# mgcc
未找到 'mgcc' 命令,您要输入的是否是:
命令 'mlcc' 来自于包 'mlterm-tools' (universe)
命令 'cgcc' 来自于包 'sparse' (multiverse)
命令 'gcc' 来自于包 'gcc' (main)
命令 'gcc' 来自于包 'pentium-builder' (universe)
mgcc:找不到命令
Now the hack involves updating two Python files in the package:
(1) /usr/lib/command-not-found (line 24) :
cnf.install(unicode=True) ==> cnf.install(unicode=False)
(2) /usr/share/pyshared/CommandNotFound/util.py (line 9):
_ = gettext.translation("command-not-found", fallback=True).ugettext ==>
_ = gettext.translation("command-not-found", fallback=True).lgettext
With these edits in place, command-not-found can now handle the test
case:
root@u-VirtualBox:~# 我
我:找不到命令
root@u-VirtualBox:~# mgcc
未找到 'mgcc' 命令,您要输入的是否是:
命令 'mlcc' 来自于包 'mlterm-tools' (universe)
命令 'cgcc' 来自于包 'sparse' (multiverse)
命令 'gcc' 来自于包 'gcc' (main)
命令 'gcc' 来自于包 'pentium-builder' (universe)
mgcc:找不到命令
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/839609
Title:
[11.10 beta1] UnicodeDecodeError crash on simplified chinese input of
fake command
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/command-not-found/+bug/839609/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs