python-guimessages guimessage.py breaks on default locales settings LANG=POSIX LANG=C

Information

ID: 625
PHID: PHID-TASK-nxg2hdrll7o66fdyihiz
Author: Patrick
Status at Migration Time: resolved
Priority at Migration Time: Normal

Description

This recently happened to me due to an update-locales / locales issue.

https://github.com/Whonix/python-guimessages/blob/master/usr/share/pyshared/guimessages/guimessage.py has a bug.

How to reproduce:

sudo LANG=POSIX usr/bin/sdwdate
sdwdate started. PID 922
Traceback (most recent call last):
  File "usr/bin/sdwdate", line 548, in <module>
    sdwdate = Sdwdate()
  File "usr/bin/sdwdate", line 108, in __init__
    translation = _translations(translations_path, 'sdwdate')
  File "/usr/lib/python2.7/dist-packages/guimessages/translations.py", line 17, in __init__
    language = locale.getdefaultlocale()[0].split('_')[0]
AttributeError: 'NoneType' object has no attribute 'split'

Also broken with another legitimate LANG value of C.

sudo LANG=C usr/bin/sdwdate

In these cases it should rather fall back to some sane default, i.e. en/us, i.e. as if running sudo LANG=en_US.UTF-8 usr/bin/sdwdate.

Comments


joysn1980

2017-02-08 15:36:23 UTC


Patrick

2017-02-08 20:46:03 UTC


Patrick

2017-02-08 21:56:43 UTC


joysn1980

2017-02-09 05:54:08 UTC