Description of problem: Starting beaker-wizard client for the first time may lead to traceback if system user's name (GECOS) contains non-ascii letters. This happen only in interactive mode. Version-Release number of selected component (if applicable): beaker-client-25.4-1.fc28.noarch beaker-client-25.5-1.el7bkr.noarch How reproducible: always User name in passwd (GECOS field) contains non-ascii letters, e.g. 'čřžýáí'. beaker-wizard is run interactively Steps to Reproduce: rm ~/.beaker_client/wizard chfn -f 'čř' beaker-wizard accept everything (interactively) Actual results: Time for test to run ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The time must be in format [1-99][m|h|d] for 1-99 minutes/hours/days (e.g. 3m, 2h, 1d) [5m?] Author's name ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Put your name [middle name] and surname here, abbreviations allowed. Traceback (most recent call last): File "/usr/bin/beaker-wizard", line 11, in <module> load_entry_point('beaker-client==25.4', 'console_scripts', 'beaker-wizard')() File "/usr/lib/python2.7/site-packages/bkr/client/wizard.py", line 3065, in main test = Test(options) File "/usr/lib/python2.7/site-packages/bkr/client/wizard.py", line 1130, in __init__ self.init() File "/usr/lib/python2.7/site-packages/bkr/client/wizard.py", line 2760, in init self.author = Author(self.options) File "/usr/lib/python2.7/site-packages/bkr/client/wizard.py", line 1135, in __init__ self.ask() File "/usr/lib/python2.7/site-packages/bkr/client/wizard.py", line 1272, in ask sys.stdout.write("[%s] " % self.suggestion().encode("utf-8")) UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 2: ordinal not in range(128) Expected results: test is created from skeleton Additional info:
Thanks for the detailed report Jiři. I wonder if we should interpret GECOS as UTF-8 unconditionally, or according to the current locale... I am assuming, like all these UNIX APIs, it is historically defined as just bytes with encoding at the discretion of the sysadmin. I see that Python 3 decodes the bytes from getpwuid() using PyUnicode_DecodeFSDefault(), which means it uses the "filesystem encoding" which has itself been fraught with problems... https://docs.python.org/2/library/sys.html#sys.getfilesystemencoding Not sure if that is better or worse than just hardcoding UTF-8. In all sane cases it will just be UTF-8 anyway. I guess the best option while we are still on Python 2 is to explicitly decode using sys.getfilesystemencoding(), to match what the behaviour will be when we switch it to Python 3 eventually.
https://gerrit.beaker-project.org/#/c/beaker/+/6229
This bug fix is included in beaker-25.6-0.git.5.2f61d7f9f which is available for download here: https://beaker-project.org/nightlies/release-25/
Changed username using chfn, ran beaker wizard. Confirmed that the old beaker-client crashes on the unicode username. Installed the new beaker-client RPM and ran beaker-wizard again. Beaker wizard succeeded with the new unicode username.
This has been released with Beaker 25.6. Release Notes: https://beaker-project.org/docs/whats-new/release-25.html#beaker-25-6