On Fri, Jun 08, 2018 at 07:57:55PM +0200, Lukáš Doktor wrote: > Hello guys, > > Dne 7.6.2018 v 01:06 Philippe Mathieu-Daudé napsal(a): > > On 06/06/2018 05:05 PM, Eduardo Habkost wrote: > >> On Wed, Jun 06, 2018 at 04:27:31PM -0300, Philippe Mathieu-Daudé wrote: > >>> The readline() call returns partial data. > >> > >> How can this be reproduced? Despite not being forbidden by the > >> QMP specification, QEMU normally doesn't break QMP replies in > >> multiple lines, and readline() is not supposed to return a > >> partial line unless it encounters EOF. > > > > $ git rev-parse HEAD > > c1c2a435905ae76b159c573b0c0d6f095b45ebc6 > > > > config copy/pasted from: > > https://wiki.qemu.org/index.php/Documentation/QMP#Trying_it > > (now looking at it, it seems I'm mixing configs...) > > > > $ cat qmp.conf > > [chardev "qmp"] > > backend = "socket" > > path = "/tmp/qmp.sock" > > server = "on" > > wait = "off" > > [mon "qmp"] > > mode = "control" > > chardev = "qmp" > > pretty = "on" > > > > nice, pretty printing..., didn't expected that.
Oh, so *that*'s the root cause. Thanks, I stared at this configuration for a while and I couldn't see what could cause extra newlines to appear in the output. :) [...] > >>> I'm sure there is a nicer/more pythonic way to do this, but this works > >>> for me, > >>> sorry :) > >> > >> It looks like there's no elegant solution for this: > >> https://stackoverflow.com/a/21709058 > >> > > Yep, that looks nicer, but even the original solution should > not be that bad as it should be rarely used. What troubles me > more is the possible infinite loop. Would you mind adding a > timeout? We already have a socket timeout, so I assume this is alrady covered? -- Eduardo
