[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 07/16] qapi: Drop support for escape sequence
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v2 07/16] qapi: Drop support for escape sequences other than \\ |
Date: |
Tue, 10 Sep 2019 10:28:30 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 |
On 9/10/19 1:37 AM, Markus Armbruster wrote:
> Since the previous commit restricted strings to printable ASCII,
> \uXXXX's only use is obfuscation. Drop it.
>
> This leaves \\, \/, \', and \". Since QAPI schema strings are all
> names, and names are restricted to ASCII letters, digits, hyphen, and
> underscore, none of them is useful.
>
> The latter three have no test coverage. Drop them.
>
> Keep \\ to avoid (more) gratuitous incompatibility with JSON.
We have to parse it (to get a sane error message for someone writing
"a\b" and thinking they were getting a backspace), but we can still
reject "a\\b" as being a non-QAPI-name. An alternative might be to
reject QAPI strings the moment \ is encountered (as the only possible
use is to introduce a character that is not valid as a name), to the
point that we could check for name validity at the time we parse strings
rather than later on. Up to you.
>
> Signed-off-by: Markus Armbruster <address@hidden>
> ---
> --- a/tests/qapi-schema/escape-outside-string.err
> +++ /dev/null
> @@ -1 +0,0 @@
> -tests/qapi-schema/escape-outside-string.json:3:27: Stray "\"
Do we still want to test that \ is an invalid character outside of
strings (whether or not \ is also made invalid inside strings)?
> +++ b/tests/qapi-schema/unknown-escape.json
> @@ -1,3 +1,3 @@
> -# we only recognize JSON escape sequences, plus our \' extension (no \x)
> +# we only recognize \\
> # { 'command': 'foo', 'data': {} }
> { 'command': 'foo', 'dat\x61':{} }
>
At any rate, this change seems reasonable.
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-devel] [PATCH v2 06/16] qapi: Restrict strings to printable ASCII, (continued)
- [Qemu-devel] [PATCH v2 09/16] qapi: Permit alternates with just one branch, Markus Armbruster, 2019/09/10
- [Qemu-devel] [PATCH v2 12/16] docs/devel/qapi-code-gen: Reorder sections for readability, Markus Armbruster, 2019/09/10
- [Qemu-devel] [PATCH v2 16/16] qapi: Tweak code to match docs/devel/qapi-code-gen.txt, Markus Armbruster, 2019/09/10
- [Qemu-devel] [PATCH v2 07/16] qapi: Drop support for escape sequences other than \\, Markus Armbruster, 2019/09/10
- Re: [Qemu-devel] [PATCH v2 07/16] qapi: Drop support for escape sequences other than \\,
Eric Blake <=
- [Qemu-devel] [PATCH v2 13/16] docs/devel/qapi-code-gen: Rewrite compatibility considerations, Markus Armbruster, 2019/09/10
[Qemu-devel] [PATCH v2 14/16] docs/devel/qapi-code-gen: Rewrite introduction to schema, Markus Armbruster, 2019/09/10