[OE-core] [PATCH 1/1] qemurunner: Sanitize output from qemu and qemu pid

Mariano Lopez mariano.lopez at linux.intel.com
Mon Sep 28 20:02:25 UTC 2015



On 09/28/2015 09:42 AM, Burton, Ross wrote:
> On 25 September 2015 at 07:33, <mariano.lopez at linux.intel.com 
> <mailto:mariano.lopez at linux.intel.com>> wrote:
>
>      def log(self, msg):
>              if self.logfile:
>     +            # It is needed to sanitize the data received from qemu
>     +            # because is possible to have control characters or
>     Unicode
>     +            msg = cmdline = "".join(filter(lambda x:x in
>     string.printable, msg))
>                  with open(self.logfile, "a") as f:
>                      f.write("%s" % msg)
>
>
> cmdline looks like a copy/paste typo?

Yes it is a copy/paste typo, I'll send a v2

>
> Would it be sensible in the future to support UTF-8 for the logging?

Yes, it would be possible to use UTF-8, but the main reason to use 
printable is not Unicode characters, it is the NULL character that 
sometimes appear in the qemu output and always appear in the command 
used to run qemu. Actually, the only non ASCII character that appears is 
the copyright symbol.

>
> Ross

-- 
Mariano Lopez
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/openembedded-core/attachments/20150928/d904046e/attachment-0002.html>


More information about the Openembedded-core mailing list