Patchwork [STABLE,0.12] QMP: Drop wrong assert()

login
register
mail settings
Submitter Luiz Capitulino
Date Dec. 22, 2009, 3:09 a.m.
Message ID <20091222010906.4a42ab1d@doriath>
Download mbox | patch
Permalink /patch/41583/
State New
Headers show

Comments

Luiz Capitulino - Dec. 22, 2009, 3:09 a.m.
Some commands return a QList of QDicts, which is valid,
but will trig the assert().

Just drop it.

Reported-by: Nathan Baum <nathan@parenthephobia.org.uk>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 monitor.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
Markus Armbruster - Dec. 22, 2009, 7:50 a.m.
Luiz Capitulino <lcapitulino@redhat.com> writes:

> Some commands return a QList of QDicts, which is valid,
> but will trig the assert().
>
> Just drop it.
>
> Reported-by: Nathan Baum <nathan@parenthephobia.org.uk>
> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
> ---
>  monitor.c |    1 -
>  1 files changed, 0 insertions(+), 1 deletions(-)
>
> diff --git a/monitor.c b/monitor.c
> index c0dc48e..3af1d5c 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -283,7 +283,6 @@ static void monitor_protocol_emitter(Monitor *mon, QObject *data)
>      if (!monitor_has_error(mon)) {
>          /* success response */
>          if (data) {
> -            assert(qobject_type(data) == QTYPE_QDICT);
>              qobject_incref(data);
>              qdict_put_obj(qmp, "return", data);
>          } else {

Yes, let's drop the assertion for now.

qmp-spec.txt specifies "json-object", so it needs fixing as well.
I figure what we want is either a dictionary (json-object), or a list of
dictionaries (json-array of json-object).
Luiz Capitulino - Dec. 29, 2009, 12:23 p.m.
On Tue, 22 Dec 2009 08:50:30 +0100
Markus Armbruster <armbru@redhat.com> wrote:

> Luiz Capitulino <lcapitulino@redhat.com> writes:
> 
> > Some commands return a QList of QDicts, which is valid,
> > but will trig the assert().
> >
> > Just drop it.
> >
> > Reported-by: Nathan Baum <nathan@parenthephobia.org.uk>
> > Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
> > ---
> >  monitor.c |    1 -
> >  1 files changed, 0 insertions(+), 1 deletions(-)
> >
> > diff --git a/monitor.c b/monitor.c
> > index c0dc48e..3af1d5c 100644
> > --- a/monitor.c
> > +++ b/monitor.c
> > @@ -283,7 +283,6 @@ static void monitor_protocol_emitter(Monitor *mon, QObject *data)
> >      if (!monitor_has_error(mon)) {
> >          /* success response */
> >          if (data) {
> > -            assert(qobject_type(data) == QTYPE_QDICT);
> >              qobject_incref(data);
> >              qdict_put_obj(qmp, "return", data);
> >          } else {
> 
> Yes, let's drop the assertion for now.
> 
> qmp-spec.txt specifies "json-object", so it needs fixing as well.
> I figure what we want is either a dictionary (json-object), or a list of
> dictionaries (json-array of json-object).

 Right, fixed in my tree. I've introduced the 'or' keyword.
Anthony Liguori - Jan. 8, 2010, 4:34 p.m.
On 12/21/2009 09:09 PM, Luiz Capitulino wrote:
> Some commands return a QList of QDicts, which is valid,
> but will trig the assert().
>
> Just drop it.
>
> Reported-by: Nathan Baum<nathan@parenthephobia.org.uk>
> Signed-off-by: Luiz Capitulino<lcapitulino@redhat.com>
>    

Applied.  Thanks.

Regards,

Anthony Liguori

> ---
>   monitor.c |    1 -
>   1 files changed, 0 insertions(+), 1 deletions(-)
>
> diff --git a/monitor.c b/monitor.c
> index c0dc48e..3af1d5c 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -283,7 +283,6 @@ static void monitor_protocol_emitter(Monitor *mon, QObject *data)
>       if (!monitor_has_error(mon)) {
>           /* success response */
>           if (data) {
> -            assert(qobject_type(data) == QTYPE_QDICT);
>               qobject_incref(data);
>               qdict_put_obj(qmp, "return", data);
>           } else {
>

Patch

diff --git a/monitor.c b/monitor.c
index c0dc48e..3af1d5c 100644
--- a/monitor.c
+++ b/monitor.c
@@ -283,7 +283,6 @@  static void monitor_protocol_emitter(Monitor *mon, QObject *data)
     if (!monitor_has_error(mon)) {
         /* success response */
         if (data) {
-            assert(qobject_type(data) == QTYPE_QDICT);
             qobject_incref(data);
             qdict_put_obj(qmp, "return", data);
         } else {