qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 0/6]: QMP: Fix issues in parser/lexer


From: Luiz Capitulino
Subject: Re: [Qemu-devel] [PATCH 0/6]: QMP: Fix issues in parser/lexer
Date: Fri, 21 May 2010 15:06:37 -0300

On Thu, 20 May 2010 10:35:52 -0300
Luiz Capitulino <address@hidden> wrote:

> > > 2. QMP doesn't check the return of json_message_parser_feed()
> > >
> > >     Which means we don't handle JSON syntax errors. While the fix might 
> > > seem
> > >     trivial (ie. just return an error!), I'm not sure what's the best way
> > >     to handle this, because the streamer seems to return multiple errors 
> > > for
> > >     the same input string.
> > >
> > >     For example, this input:
> > >
> > >     { "execute": yy_uu }
> > >
> > >     Seems to return an error for each bad character (yy_uu), shouldn't it
> > >     return only once and stop processing the whole string?
> > >    
> > 
> > It probably should kill the connection.
> 
>  Ok.

 I was working on this and it's not that simple.

 As we talked by IRC, there isn't an easy way to just drop a qemu-char 
connection
as a char device doesn't have a notion of connect/disconnect (as you explained).

 So, another way of doing this would be to close the chardev and open it again,
however this is also complicated for two reasons:

1. qemu_chr_close() completely destroys the chardev and creating it again 
requires
   access to the original QemuOpts, created at boot time

2. Some char devices' open() method have specific boot-time only options
   (eg. socket & wait)

 It's possible to hack, we could make a copy of the QemOpts, remove boot-time
options and store it in CharDriverState. But this is ugly and fragile.

 Isn't it easier to handle this in the lexer itself? For example, couldn't it
just mark the token as bad and keep scanning?

 We handle parser's errors just fine.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]