Miscellaneous patches for 2018-08-15
The following changes since commit 38441756b70eec5807b5f60dad11a93a91199866:
Update version for v3.0.0 release (2018-08-14 16:38:43 +0100)
are available in the Git repository at:
git://repo.or.cz/qemu/armbru.git tags/pull-misc-2018-08-15
for you to fetch changes up to cb9ec42f33c07cd07d2e2971422bf7636c761202:
monitor: fix oob command leak (2018-08-15 08:12:57 +0200)
----------------------------------------------------------------
Miscellaneous patches for 2018-08-15
----------------------------------------------------------------
Marc-André Lureau (4):
qmp-shell: learn to send commands with quoted arguments
tests: change /0.15/* tests to /qmp/*
tests: fix crumple/recursive leak
monitor: fix oob command leak
Markus Armbruster (1):
qapi: Fix some pycodestyle-3 complaints
monitor.c | 2 ++ scripts/qapi/common.py | 15 +++++++++------ scripts/qapi/visit.py | 2 +- scripts/qmp/qmp-shell | 3 ++- tests/check-block-qdict.c | 1 + tests/qapi-schema/test-qapi.py | 13 +++++++------ tests/test-qmp-cmds.c | 10 +++++----- 7 files changed, 27 insertions(+), 19 deletions(-)
Signature · 1 line
2.17.1
[Qemu-devel] [PULL 1/5] qmp-shell: learn to send commands with quoted arguments
From: Marc-André Lureau <[email protected]>
Use shlex to split the CLI command, respecting quoted arguments, and also comments. This allows to call for ex:
(QEMU) human-monitor-command command-line="screendump /dev/null"
{"execute": "human-monitor-command", "arguments": {"command-line": "screendump /dev/null"}}
Message-Id: <[email protected]>
--- scripts/qmp/qmp-shell | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
scripts/qmp/qmp-shell +2 -1
@@ -74,6 +74,7 @@ import sys import os import errno import atexit +import shlex class QMPCompleter(list): def complete(self, text, state):
@@ -219,7 +220,7 @@ class QMPShell(qmp.QEMUMonitorProtocol): < command-name > [ arg-name1=arg1 ] ... [ arg-nameN=argN ] """ - cmdargs = cmdline.split() + cmdargs = shlex.split(cmdline) # Transactional CLI entry/exit: if cmdargs[0] == 'transaction(':
Signature · 1 line
2.17.1
[Qemu-devel] [PULL 3/5] qapi: Fix some pycodestyle-3 complaints
In reply to Markus ArmbrusterFix the following issues:
common.py:873:13: E129 visually indented line with same indent as next logical line common.py:1766:5: E741 ambiguous variable name 'l'
common.py:1784:1: E305 expected 2 blank lines after class or function definition, found 1 common.py:1833:1: E305 expected 2 blank lines after class or function definition, found 1 common.py:1843:1: E305 expected 2 blank lines after class or function definition, found 1 visit.py:181:18: E127 continuation line over-indented for visual indent
Message-Id: <[email protected]> [Fixup squashed in:]
Message-ID: <[email protected]>
--- scripts/qapi/common.py | 15 +++++++++------ scripts/qapi/visit.py | 2 +- tests/qapi-schema/test-qapi.py | 13 +++++++------ 3 files changed, 17 insertions(+), 13 deletions(-)
scripts/qapi/common.py +9 -6
@@ -884,12 +884,12 @@ def check_keys(expr_elem, meta, required, optional=[]): if key not in required and key not in optional: raise QAPISemError(info, "Unknown key '%s' in %s '%s'" % (key, meta, name)) - if (key == 'gen' or key == 'success-response') and value is not False: + if key in ['gen', 'success-response'] and value is not False: raise QAPISemError(info, "'%s' of %s '%s' should only use false value" % (key, meta, name)) - if (key == 'boxed' or key == 'allow-oob' or - key == 'allow-preconfig') and value is not True: + if (key in ['boxed', 'allow-oob', 'allow-preconfig'] + and value is not True): raise QAPISemError(info, "'%s' of %s '%s' should only use true value" % (key, meta, name))
@@ -1845,12 +1845,12 @@ def camel_to_upper(value): return c_fun_str new_name = '' - l = len(c_fun_str) - for i in range(l): + length = len(c_fun_str) + for i in range(length): c = c_fun_str[i] # When c is upper and no '_' appears before, do more checks if c.isupper() and (i > 0) and c_fun_str[i - 1] != '_': - if i < l - 1 and c_fun_str[i + 1].islower(): + if i < length - 1 and c_fun_str[i + 1].islower(): new_name += '_' elif c_fun_str[i - 1].isdigit(): new_name += '_'
@@ -1863,6 +1863,7 @@ def c_enum_const(type_name, const_name, prefix=None): type_name = prefix return camel_to_upper(type_name) + '_' + c_name(const_name, False).upper() + if hasattr(str, 'maketrans'): c_name_trans = str.maketrans('.-', '__') else:
@@ -1912,6 +1913,7 @@ def c_name(name, protect=True): return 'q_' + name return name + eatspace = '\033EATSPACE.' pointer_suffix = ' *' + eatspace
@@ -1922,6 +1924,7 @@ def genindent(count): ret += ' ' return ret + indent_level = 0
scripts/qapi/visit.py +1 -1
@@ -187,7 +187,7 @@ void visit_type_%(c_name)s(Visitor *v, const char *name, %(c_name)s **obj, Error } switch ((*obj)->type) { ''', - c_name=c_name(name)) + c_name=c_name(name)) for var in variants.variants: ret += mcgen('''
tests/qapi-schema/test-qapi.py +7 -6
@@ -34,8 +34,8 @@ class QAPISchemaTestVisitor(QAPISchemaVisitor): if base: print(' base %s' % base.name) for m in members: - print(' member %s: %s optional=%s' % \ - (m.name, m.type.name, m.optional)) + print(' member %s: %s optional=%s' + % (m.name, m.type.name, m.optional)) self._print_variants(variants) self._print_if(ifcond)
@@ -46,10 +46,11 @@ class QAPISchemaTestVisitor(QAPISchemaVisitor): def visit_command(self, name, info, ifcond, arg_type, ret_type, gen, success_response, boxed, allow_oob, allow_preconfig): - print('command %s %s -> %s' % \ - (name, arg_type and arg_type.name, ret_type and ret_type.name)) - print(' gen=%s success_response=%s boxed=%s oob=%s preconfig=%s' % \ - (gen, success_response, boxed, allow_oob, allow_preconfig)) + print('command %s %s -> %s' + % (name, arg_type and arg_type.name, + ret_type and ret_type.name)) + print(' gen=%s success_response=%s boxed=%s oob=%s preconfig=%s' + % (gen, success_response, boxed, allow_oob, allow_preconfig)) self._print_if(ifcond) def visit_event(self, name, info, ifcond, arg_type, boxed):
Signature · 1 line
2.17.1
[Qemu-devel] [PULL 5/5] monitor: fix oob command leak
In reply to Markus ArmbrusterFrom: Marc-André Lureau <[email protected]>
Spotted by ASAN, during make check...
Direct leak of 40 byte(s) in 1 object(s) allocated from:
#0 0x7f8e27262c48 in malloc (/lib64/libasan.so.5+0xeec48)
#1 0x7f8e26a5f3c5 in g_malloc (/lib64/libglib-2.0.so.0+0x523c5)
#2 0x555ab67078a8 in qstring_from_str /home/elmarco/src/qq/qobject/qstring.c:67
#3 0x555ab67071e4 in qstring_new /home/elmarco/src/qq/qobject/qstring.c:24
#4 0x555ab6713fbf in qstring_from_escaped_str /home/elmarco/src/qq/qobject/json-parser.c:144
#5 0x555ab671738c in parse_literal /home/elmarco/src/qq/qobject/json-parser.c:506
#6 0x555ab67179c3 in parse_value /home/elmarco/src/qq/qobject/json-parser.c:569
#7 0x555ab6715123 in parse_pair /home/elmarco/src/qq/qobject/json-parser.c:306
#8 0x555ab6715483 in parse_object /home/elmarco/src/qq/qobject/json-parser.c:357
#9 0x555ab671798b in parse_value /home/elmarco/src/qq/qobject/json-parser.c:561
#10 0x555ab6717a6b in json_parser_parse_err /home/elmarco/src/qq/qobject/json-parser.c:592
#11 0x555ab4fd4dcf in handle_qmp_command /home/elmarco/src/qq/monitor.c:4257
#12 0x555ab6712c4d in json_message_process_token /home/elmarco/src/qq/qobject/json-streamer.c:105
#13 0x555ab67e01e2 in json_lexer_feed_char /home/elmarco/src/qq/qobject/json-lexer.c:323
#14 0x555ab67e0af6 in json_lexer_feed /home/elmarco/src/qq/qobject/json-lexer.c:373
#15 0x555ab6713010 in json_message_parser_feed /home/elmarco/src/qq/qobject/json-streamer.c:124
#16 0x555ab4fd58ec in monitor_qmp_read /home/elmarco/src/qq/monitor.c:4337
#17 0x555ab6559df2 in qemu_chr_be_write_impl /home/elmarco/src/qq/chardev/char.c:175
#18 0x555ab6559e95 in qemu_chr_be_write /home/elmarco/src/qq/chardev/char.c:187
#19 0x555ab6560127 in fd_chr_read /home/elmarco/src/qq/chardev/char-fd.c:66
#20 0x555ab65d9c73 in qio_channel_fd_source_dispatch /home/elmarco/src/qq/io/channel-watch.c:84
#21 0x7f8e26a598ac in g_main_context_dispatch (/lib64/libglib-2.0.so.0+0x4c8ac)Message-Id: <[email protected]>
--- monitor.c | 2 ++ 1 file changed, 2 insertions(+)
monitor.c +2 -0
@@ -4277,6 +4277,8 @@ static void handle_qmp_command(JSONMessageParser *parser, GQueue *tokens)trace_monitor_qmp_cmd_out_of_band (qobject_get_try_str (id) ?:"" );monitor_qmp_dispatch (mon, req, id); +qobject_unref (req); +qobject_unref (id);return ; }
Signature · 1 line
2.17.1
[Qemu-devel] [PULL 2/5] tests: change /0.15/* tests to /qmp/*
In reply to Markus ArmbrusterFrom: Marc-André Lureau <[email protected]>
Presumably 0.15 was the version it was first introduced, but qmp keeps evolving. There is no point in having that version as test prefix, 'qmp' makes more sense here.
Message-Id: <[email protected]>
--- tests/test-qmp-cmds.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
tests/test-qmp-cmds.c +5 -5
@@ -286,11 +286,11 @@ int main(int argc, char **argv) {g_test_init (&argc, &argv,NULL ); -g_test_add_func ("/0.15/dispatch_cmd" , test_dispatch_cmd); -g_test_add_func ("/0.15/dispatch_cmd_failure" , test_dispatch_cmd_failure); -g_test_add_func ("/0.15/dispatch_cmd_io" , test_dispatch_cmd_io); -g_test_add_func ("/0.15/dealloc_types" , test_dealloc_types); -g_test_add_func ("/0.15/dealloc_partial" , test_dealloc_partial); +g_test_add_func ("/qmp/dispatch_cmd" , test_dispatch_cmd); +g_test_add_func ("/qmp/dispatch_cmd_failure" , test_dispatch_cmd_failure); +g_test_add_func ("/qmp/dispatch_cmd_io" , test_dispatch_cmd_io); +g_test_add_func ("/qmp/dealloc_types" , test_dealloc_types); +g_test_add_func ("/qmp/dealloc_partial" , test_dealloc_partial);test_qmp_init_marshal (&qmp_commands);g_test_run ();
Signature · 1 line
2.17.1
[Qemu-devel] [PULL 4/5] tests: fix crumple/recursive leak
In reply to Markus ArmbrusterFrom: Marc-André Lureau <[email protected]>
Spotted by ASAN:
=================================================================
==27907==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 4120 byte(s) in 1 object(s) allocated from:
#0 0x7f913458ce50 in calloc (/lib64/libasan.so.5+0xeee50)
#1 0x7f9133fd641d in g_malloc0 (/lib64/libglib-2.0.so.0+0x5241d)
#2 0x5561c6643c95 in qdict_crumple_test_recursive /home/elmarco/src/qq/tests/check-block-qdict.c:438
#3 0x7f9133ff7c49 (/lib64/libglib-2.0.so.0+0x73c49)Message-Id: <[email protected]>
--- tests/check-block-qdict.c | 1 + 1 file changed, 1 insertion(+)
tests/check-block-qdict.c +1 -0
@@ -491,6 +491,7 @@ static void qdict_crumple_test_recursive(void) empty_list_0 =qobject_to (QDict,qlist_pop (empty_list));g_assert (empty_list_0); g_assert_cmpint(qdict_size(empty_list_0), ==, 0); +qobject_unref (empty_list_0);qobject_unref (src);qobject_unref (dst);
Signature · 1 line
2.17.1
Peter Maydell
AppliedQuoted 8 lines · Markus Armbruster
The following changes since commit
38441756b70eec5807b5f60dad11a93a91199866:Update version for v3.0.0 release (2018-08-14 16:38:43 +0100)
are available in the Git repository at:
git://repo.or.cz/qemu/armbru.gittags/pull-misc-2018-08-15
Quoted 8 lines
for you to fetch changes up to
cb9ec42f33c07cd07d2e2971422bf7636c761202:monitor: fix oob command leak (2018-08-15 08:12:57 +0200)
----------------------------------------------------------------
Miscellaneous patches for 2018-08-15----------------------------------------------------------------
Applied, thanks.
-- PMM