[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 1/9] monitor: report entirety of hmp command on error
From: |
Dr. David Alan Gilbert (git) |
Subject: |
[Qemu-devel] [PULL 1/9] monitor: report entirety of hmp command on error |
Date: |
Thu, 21 Jun 2018 17:47:19 +0100 |
From: Collin Walling <address@hidden>
When a user incorrectly provides an hmp command, an error response will be
printed that prompts the user to try "help <command name>". However, when
the command contains multiple parts e.g. "info uuid xyz", only the last
whitespace delimited string will be reported (in this example "info" will
be dropped and the message will read "Try "help uuid" for more information",
which is incorrect).
Let's correct this by capturing the entirety of the command from the command
line -- excluding any extraneous characters.
Reported-by: Mikhail Fokin <address@hidden>
Signed-off-by: Collin Walling <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>
---
monitor.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/monitor.c b/monitor.c
index 885e000f9b..2a8187f5d7 100644
--- a/monitor.c
+++ b/monitor.c
@@ -3431,6 +3431,7 @@ static void handle_hmp_command(Monitor *mon, const char
*cmdline)
{
QDict *qdict;
const mon_cmd_t *cmd;
+ const char *cmd_start = cmdline;
trace_handle_hmp_command(mon, cmdline);
@@ -3447,8 +3448,11 @@ static void handle_hmp_command(Monitor *mon, const char
*cmdline)
qdict = monitor_parse_arguments(mon, &cmdline, cmd);
if (!qdict) {
- monitor_printf(mon, "Try \"help %s\" for more information\n",
- cmd->name);
+ while (cmdline > cmd_start && qemu_isspace(cmdline[-1])) {
+ cmdline--;
+ }
+ monitor_printf(mon, "Try \"help %.*s\" for more information\n",
+ (int)(cmdline - cmd_start), cmd_start);
return;
}
--
2.17.1
- [Qemu-devel] [PULL 0/9] hmp queue, Dr. David Alan Gilbert (git), 2018/06/21
- [Qemu-devel] [PULL 2/9] hmp-commands: use long for begin and length in dump-guest-memory, Dr. David Alan Gilbert (git), 2018/06/21
- [Qemu-devel] [PULL 1/9] monitor: report entirety of hmp command on error,
Dr. David Alan Gilbert (git) <=
- [Qemu-devel] [PULL 3/9] hmp: Add flag for preconfig commands, Dr. David Alan Gilbert (git), 2018/06/21
- [Qemu-devel] [PULL 4/9] hmp: Allow help on preconfig commands, Dr. David Alan Gilbert (git), 2018/06/21
- [Qemu-devel] [PULL 5/9] hmp: Restrict auto-complete in preconfig, Dr. David Alan Gilbert (git), 2018/06/21
- [Qemu-devel] [PULL 6/9] qmp: Enable a few commands in preconfig state, Dr. David Alan Gilbert (git), 2018/06/21
- [Qemu-devel] [PULL 7/9] hmp: Add commands for preconfig, Dr. David Alan Gilbert (git), 2018/06/21
- [Qemu-devel] [PULL 9/9] hmp: Allow HMP in preconfig state again, Dr. David Alan Gilbert (git), 2018/06/21
- [Qemu-devel] [PULL 8/9] hmp: add exit_preconfig, Dr. David Alan Gilbert (git), 2018/06/21
- Re: [Qemu-devel] [PULL 0/9] hmp queue, Peter Maydell, 2018/06/22