qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: aliguori@us.ibm.com, akong@redhat.com, mdroth@linux.vnet.ibm.com
Subject: [Qemu-devel] [PATCH v2 5/9] qapi.py: Reject invalid characters in schema file
Date: Sat, 27 Jul 2013 17:41:57 +0200	[thread overview]
Message-ID: <1374939721-7876-6-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1374939721-7876-1-git-send-email-armbru@redhat.com>

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
 scripts/qapi.py                   | 2 ++
 tests/qapi-schema/comments.err    | 1 +
 tests/qapi-schema/comments.exit   | 2 +-
 tests/qapi-schema/comments.out    | 3 ---
 tests/qapi-schema/funny-char.err  | 1 +
 tests/qapi-schema/funny-char.exit | 2 +-
 tests/qapi-schema/funny-char.out  | 3 ---
 7 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/scripts/qapi.py b/scripts/qapi.py
index 342d16c..0b48a1e 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -101,6 +101,8 @@ class QAPISchema:
                 if self.cursor == len(self.src):
                     self.tok = None
                     return
+            elif not self.tok.isspace():
+                raise QAPISchemaError(self, 'Stray "%s"' % self.tok)
 
     def get_members(self):
         expr = OrderedDict()
diff --git a/tests/qapi-schema/comments.err b/tests/qapi-schema/comments.err
index e69de29..4a82b26 100644
--- a/tests/qapi-schema/comments.err
+++ b/tests/qapi-schema/comments.err
@@ -0,0 +1 @@
+<stdin>:2:33: Stray "#"
diff --git a/tests/qapi-schema/comments.exit b/tests/qapi-schema/comments.exit
index 573541a..d00491f 100644
--- a/tests/qapi-schema/comments.exit
+++ b/tests/qapi-schema/comments.exit
@@ -1 +1 @@
-0
+1
diff --git a/tests/qapi-schema/comments.out b/tests/qapi-schema/comments.out
index e3bd904..e69de29 100644
--- a/tests/qapi-schema/comments.out
+++ b/tests/qapi-schema/comments.out
@@ -1,3 +0,0 @@
-[OrderedDict([('enum', 'Status'), ('data', ['good', 'bad', 'ugly'])])]
-['Status']
-[]
diff --git a/tests/qapi-schema/funny-char.err b/tests/qapi-schema/funny-char.err
index e69de29..d3dd293 100644
--- a/tests/qapi-schema/funny-char.err
+++ b/tests/qapi-schema/funny-char.err
@@ -0,0 +1 @@
+<stdin>:2:36: Stray ";"
diff --git a/tests/qapi-schema/funny-char.exit b/tests/qapi-schema/funny-char.exit
index 573541a..d00491f 100644
--- a/tests/qapi-schema/funny-char.exit
+++ b/tests/qapi-schema/funny-char.exit
@@ -1 +1 @@
-0
+1
diff --git a/tests/qapi-schema/funny-char.out b/tests/qapi-schema/funny-char.out
index e3bd904..e69de29 100644
--- a/tests/qapi-schema/funny-char.out
+++ b/tests/qapi-schema/funny-char.out
@@ -1,3 +0,0 @@
-[OrderedDict([('enum', 'Status'), ('data', ['good', 'bad', 'ugly'])])]
-['Status']
-[]
-- 
1.7.11.7

  parent reply	other threads:[~2013-07-27 17:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-27 15:41 [Qemu-devel] [PATCH v2 0/9] Our QAPI parser is a hack, replace it Markus Armbruster
2013-07-27 15:41 ` [Qemu-devel] [PATCH v2 1/9] tests: QAPI schema parser tests Markus Armbruster
2013-08-19 22:02   ` Laszlo Ersek
2013-08-20  6:58     ` Markus Armbruster
2013-07-27 15:41 ` [Qemu-devel] [PATCH v2 2/9] tests: Use qapi-schema-test.json as schema parser test Markus Armbruster
2013-07-27 15:41 ` [Qemu-devel] [PATCH v2 3/9] qapi.py: Restructure lexer and parser Markus Armbruster
2013-07-27 15:41 ` [Qemu-devel] [PATCH v2 4/9] qapi.py: Decent syntax error reporting Markus Armbruster
2013-07-27 15:41 ` Markus Armbruster [this message]
2013-07-27 15:41 ` [Qemu-devel] [PATCH v2 6/9] qapi.py: Fix schema parser to check syntax systematically Markus Armbruster
2013-07-27 15:41 ` [Qemu-devel] [PATCH v2 7/9] qapi.py: Fix diagnosing non-objects at a schema's top-level Markus Armbruster
2013-07-27 15:42 ` [Qemu-devel] [PATCH v2 8/9] qapi.py: Rename expr_eval to expr in parse_schema() Markus Armbruster
2013-07-27 15:42 ` [Qemu-devel] [PATCH v2 9/9] qapi.py: Permit comments starting anywhere on the line Markus Armbruster
2013-07-29 20:24 ` [Qemu-devel] [PATCH v2 0/9] Our QAPI parser is a hack, replace it Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1374939721-7876-6-git-send-email-armbru@redhat.com \
    --to=armbru@redhat.com \
    --cc=akong@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).