Bug 13551 - runqemu script can not report error
Summary: runqemu script can not report error
Status: RESOLVED WONTFIX
Alias: None
Product: System Startup
Classification: Runtime
Component: system-startup (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Medium normal
Target Milestone: 3.1 M3
Assignee: Ross Burton
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2019-09-25 09:04 UTC by Egor
Modified: 2020-01-30 12:42 UTC (History)
1 user (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Egor 2019-09-25 09:04:46 UTC
on machine without display (ssh session) trying to run

runqemu qemux86

this action leads to the error

runqemu script meet error in handling this error:

Traceback (most recent call last):
  File "/home/ibragimov/yocto/work/poky/scripts/runqemu", line 1349, in main
    config.start_qemu()
  File "/home/ibragimov/yocto/work/poky/scripts/runqemu", line 1245, in start_qemu
    logger.error("Failed to run qemu: %s", process.stderr.read().decode())
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd1 in position 58: invalid continuation byte

this is code which causes error:

        if retcode:
            if retcode == -signal.SIGTERM:
                logger.info("Qemu terminated by SIGTERM")
            else:
                logger.error("Failed to run qemu: %s", process.stderr.read().decode()) #< error here



this command runs successfully:
runqemu qemux86 nographics


suggested fix at the line 1245:

logger.error("Failed to run qemu: %s", process.stderr.read().decode("utf-8", "replace")
Comment 1 Ross Burton 2019-09-25 15:52:43 UTC
What locale/encoding are you using in the ssh session?
Comment 2 Egor 2019-09-25 16:05:10 UTC
echo $LANG
en_US.UTF-8
Comment 3 Egor 2019-09-26 09:11:38 UTC
I used putty in Windows to connect to remote host with Yocto.
I suggest, runqemu got message from Windows in CP-1251 encoding, it is Cyrillic.
"Сетевая ошибка: В соединении отказано"
It is content of process.stderr.read()
Comment 4 Egor 2019-09-26 09:29:59 UTC
upd: this code show the message
logger.error("Failed to run qemu: %s", err_str.decode("cp1251", "replace"))

runqemu - ERROR - Failed to run qemu: PuTTY X11 proxy: unable to connect to forwarded X server: Сетевая ошибка: В соединении отказано
Could not initialize SDL(x11 not available) - exiting
Comment 5 Ross Burton 2019-09-26 10:09:31 UTC
Can't you just tell putty to use UTF-8?  There's lots of places where we expect UTF-8 and if random other encodings can appear then they'll break too.
Comment 6 Egor 2019-09-26 10:59:19 UTC
Yes, I tell putty to use utf-8 in the beginning.
But probably cp-1251 appears in responce to X11 request.
Comment 7 Egor 2019-09-26 13:26:04 UTC
I mean, it is X11-server-dependent message, independent of ssh client.
Comment 8 Ross Burton 2020-01-30 12:42:33 UTC
$ iconv -f utf-8 -t cp1251
Сетевая ошибка: В соединении отказано
������� ������: � ���������� ��������

If we just used errors='replace' the entire string would be question marks. Not sure how to solve this problem in runqemu, the problem is that the Putty X11 proxy isn't respecting the transport encoding when sending error messages.