<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>13551</bug_id>
          
          <creation_ts>2019-09-25 09:04:46 +0000</creation_ts>
          <short_desc>runqemu script can not report error</short_desc>
          <delta_ts>2020-01-30 12:42:33 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>11</classification_id>
          <classification>Runtime</classification>
          <product>System Startup</product>
          <component>system-startup</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>3.1 M3</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Egor">pregus</reporter>
          <assigned_to name="Ross Burton">ross.burton</assigned_to>
          <cc>kevin.tian</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>85063</commentid>
    <comment_count>0</comment_count>
    <who name="Egor">pregus</who>
    <bug_when>2019-09-25 09:04:46 +0000</bug_when>
    <thetext>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 &quot;/home/ibragimov/yocto/work/poky/scripts/runqemu&quot;, line 1349, in main
    config.start_qemu()
  File &quot;/home/ibragimov/yocto/work/poky/scripts/runqemu&quot;, line 1245, in start_qemu
    logger.error(&quot;Failed to run qemu: %s&quot;, process.stderr.read().decode())
UnicodeDecodeError: &apos;utf-8&apos; codec can&apos;t decode byte 0xd1 in position 58: invalid continuation byte

this is code which causes error:

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



this command runs successfully:
runqemu qemux86 nographics


suggested fix at the line 1245:

logger.error(&quot;Failed to run qemu: %s&quot;, process.stderr.read().decode(&quot;utf-8&quot;, &quot;replace&quot;)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>85067</commentid>
    <comment_count>1</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2019-09-25 15:52:43 +0000</bug_when>
    <thetext>What locale/encoding are you using in the ssh session?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>85068</commentid>
    <comment_count>2</comment_count>
    <who name="Egor">pregus</who>
    <bug_when>2019-09-25 16:05:10 +0000</bug_when>
    <thetext>echo $LANG
en_US.UTF-8</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>85080</commentid>
    <comment_count>3</comment_count>
    <who name="Egor">pregus</who>
    <bug_when>2019-09-26 09:11:38 +0000</bug_when>
    <thetext>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.
&quot;Сетевая ошибка: В соединении отказано&quot;
It is content of process.stderr.read()</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>85081</commentid>
    <comment_count>4</comment_count>
    <who name="Egor">pregus</who>
    <bug_when>2019-09-26 09:29:59 +0000</bug_when>
    <thetext>upd: this code show the message
logger.error(&quot;Failed to run qemu: %s&quot;, err_str.decode(&quot;cp1251&quot;, &quot;replace&quot;))

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

If we just used errors=&apos;replace&apos; 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&apos;t respecting the transport encoding when sending error messages.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>