All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] monitor: print message when using 'help' with an unknown command
@ 2018-07-19 15:03 Collin Walling
  2018-07-19 16:31 ` Markus Armbruster
  2018-07-19 19:18 ` Dr. David Alan Gilbert
  0 siblings, 2 replies; 9+ messages in thread
From: Collin Walling @ 2018-07-19 15:03 UTC (permalink / raw)
  To: qemu-devel

When typing 'help' followed by an unknown command, QEMU will
not print anything to the command line to let the user know
they typed a bad command. Let's fix this by printing a message
to the monitor when this happens. For example:

    (qemu) help xyz
    unknown command: 'xyz'

Reported-by: Stefan Zimmermann <stzi@linux.ibm.com>
Signed-off-by: Collin Walling <walling@linux.ibm.com>
---
 monitor.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/monitor.c b/monitor.c
index 7af1f18..7942f9f 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1034,9 +1034,12 @@ static void help_cmd_dump(Monitor *mon, const mon_cmd_t *cmds,
             } else {
                 help_cmd_dump_one(mon, cmd, args, arg_index);
             }
-            break;
+            return;
         }
     }
+
+    /* Entry not found */
+    monitor_printf(mon, "unknown command: '%s'\n", args[arg_index]);
 }
 
 static void help_cmd(Monitor *mon, const char *name)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH] monitor: print message when using 'help' with an unknown command
  2018-07-19 15:03 [Qemu-devel] [PATCH] monitor: print message when using 'help' with an unknown command Collin Walling
@ 2018-07-19 16:31 ` Markus Armbruster
  2018-07-19 16:39   ` Collin Walling
  2018-07-19 19:11   ` Dr. David Alan Gilbert
  2018-07-19 19:18 ` Dr. David Alan Gilbert
  1 sibling, 2 replies; 9+ messages in thread
From: Markus Armbruster @ 2018-07-19 16:31 UTC (permalink / raw)
  To: Collin Walling; +Cc: qemu-devel, David Alan Gilbert

You neglected to cc: maintainers.  Cc'ing them increases the odds your
patch will be noticed and picked up.  You can use
scripts/get_maintainer.pl to find maintainers.  You don't have to do
anything for this patch; it got noticed anyway.

David, this is yours :)

Collin Walling <walling@linux.ibm.com> writes:

> When typing 'help' followed by an unknown command, QEMU will
> not print anything to the command line to let the user know
> they typed a bad command. Let's fix this by printing a message
> to the monitor when this happens. For example:
>
>     (qemu) help xyz
>     unknown command: 'xyz'
>
> Reported-by: Stefan Zimmermann <stzi@linux.ibm.com>
> Signed-off-by: Collin Walling <walling@linux.ibm.com>
> ---
>  monitor.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/monitor.c b/monitor.c
> index 7af1f18..7942f9f 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -1034,9 +1034,12 @@ static void help_cmd_dump(Monitor *mon, const mon_cmd_t *cmds,
>              } else {
>                  help_cmd_dump_one(mon, cmd, args, arg_index);
>              }
> -            break;
> +            return;
>          }
>      }
> +
> +    /* Entry not found */
> +    monitor_printf(mon, "unknown command: '%s'\n", args[arg_index]);
>  }
>  
>  static void help_cmd(Monitor *mon, const char *name)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH] monitor: print message when using 'help' with an unknown command
  2018-07-19 16:31 ` Markus Armbruster
@ 2018-07-19 16:39   ` Collin Walling
  2018-07-20 16:40     ` Eric Blake
  2018-07-19 19:11   ` Dr. David Alan Gilbert
  1 sibling, 1 reply; 9+ messages in thread
From: Collin Walling @ 2018-07-19 16:39 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: qemu-devel, David Alan Gilbert

On 07/19/2018 12:31 PM, Markus Armbruster wrote:
> You neglected to cc: maintainers.  Cc'ing them increases the odds your
> patch will be noticed and picked up.  You can use
> scripts/get_maintainer.pl to find maintainers.  You don't have to do
> anything for this patch; it got noticed anyway.
> 
> David, this is yours :)

Very true. Was a minor fix that I thought I'd just toss it out there and 
let anyone view it if they had the time. Will be more aware of who to CC
next time around.

Thanks :)

> 
> Collin Walling <walling@linux.ibm.com> writes:
> 
>> When typing 'help' followed by an unknown command, QEMU will
>> not print anything to the command line to let the user know
>> they typed a bad command. Let's fix this by printing a message
>> to the monitor when this happens. For example:
>>
>>     (qemu) help xyz
>>     unknown command: 'xyz'
>>
>> Reported-by: Stefan Zimmermann <stzi@linux.ibm.com>
>> Signed-off-by: Collin Walling <walling@linux.ibm.com>
>> ---
>>  monitor.c | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/monitor.c b/monitor.c
>> index 7af1f18..7942f9f 100644
>> --- a/monitor.c
>> +++ b/monitor.c
>> @@ -1034,9 +1034,12 @@ static void help_cmd_dump(Monitor *mon, const mon_cmd_t *cmds,
>>              } else {
>>                  help_cmd_dump_one(mon, cmd, args, arg_index);
>>              }
>> -            break;
>> +            return;
>>          }
>>      }
>> +
>> +    /* Entry not found */
>> +    monitor_printf(mon, "unknown command: '%s'\n", args[arg_index]);
>>  }
>>  
>>  static void help_cmd(Monitor *mon, const char *name)
> 


-- 
Respectfully,
- Collin Walling

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH] monitor: print message when using 'help' with an unknown command
  2018-07-19 16:31 ` Markus Armbruster
  2018-07-19 16:39   ` Collin Walling
@ 2018-07-19 19:11   ` Dr. David Alan Gilbert
  1 sibling, 0 replies; 9+ messages in thread
From: Dr. David Alan Gilbert @ 2018-07-19 19:11 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: Collin Walling, qemu-devel

* Markus Armbruster (armbru@redhat.com) wrote:
> You neglected to cc: maintainers.  Cc'ing them increases the odds your
> patch will be noticed and picked up.  You can use
> scripts/get_maintainer.pl to find maintainers.  You don't have to do
> anything for this patch; it got noticed anyway.
> 
> David, this is yours :)

Thanks!

Dave

> Collin Walling <walling@linux.ibm.com> writes:
> 
> > When typing 'help' followed by an unknown command, QEMU will
> > not print anything to the command line to let the user know
> > they typed a bad command. Let's fix this by printing a message
> > to the monitor when this happens. For example:
> >
> >     (qemu) help xyz
> >     unknown command: 'xyz'
> >
> > Reported-by: Stefan Zimmermann <stzi@linux.ibm.com>
> > Signed-off-by: Collin Walling <walling@linux.ibm.com>
> > ---
> >  monitor.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/monitor.c b/monitor.c
> > index 7af1f18..7942f9f 100644
> > --- a/monitor.c
> > +++ b/monitor.c
> > @@ -1034,9 +1034,12 @@ static void help_cmd_dump(Monitor *mon, const mon_cmd_t *cmds,
> >              } else {
> >                  help_cmd_dump_one(mon, cmd, args, arg_index);
> >              }
> > -            break;
> > +            return;
> >          }
> >      }
> > +
> > +    /* Entry not found */
> > +    monitor_printf(mon, "unknown command: '%s'\n", args[arg_index]);
> >  }
> >  
> >  static void help_cmd(Monitor *mon, const char *name)
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH] monitor: print message when using 'help' with an unknown command
  2018-07-19 15:03 [Qemu-devel] [PATCH] monitor: print message when using 'help' with an unknown command Collin Walling
  2018-07-19 16:31 ` Markus Armbruster
@ 2018-07-19 19:18 ` Dr. David Alan Gilbert
  2018-07-19 20:34   ` Collin Walling
  1 sibling, 1 reply; 9+ messages in thread
From: Dr. David Alan Gilbert @ 2018-07-19 19:18 UTC (permalink / raw)
  To: Collin Walling; +Cc: qemu-devel

* Collin Walling (walling@linux.ibm.com) wrote:
> When typing 'help' followed by an unknown command, QEMU will
> not print anything to the command line to let the user know
> they typed a bad command. Let's fix this by printing a message
> to the monitor when this happens. For example:
> 
>     (qemu) help xyz
>     unknown command: 'xyz'
> 
> Reported-by: Stefan Zimmermann <stzi@linux.ibm.com>
> Signed-off-by: Collin Walling <walling@linux.ibm.com>
> ---
>  monitor.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/monitor.c b/monitor.c
> index 7af1f18..7942f9f 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -1034,9 +1034,12 @@ static void help_cmd_dump(Monitor *mon, const mon_cmd_t *cmds,
>              } else {
>                  help_cmd_dump_one(mon, cmd, args, arg_index);
>              }
> -            break;
> +            return;
>          }
>      }
> +
> +    /* Entry not found */
> +    monitor_printf(mon, "unknown command: '%s'\n", args[arg_index]);

Thanks, that does suffer from a similar bug to the one you fixed a
few months back in  317c52cc6aa0d ('monitor: report entirety of hmp
command on error'):

(qemu) help foo
unknown command: 'foo'
(qemu) help info foo
unknown command: 'foo'

Dave
(And yes, please cc me, otherwise I can miss them)

>  }
>  
>  static void help_cmd(Monitor *mon, const char *name)
> -- 
> 2.7.4
> 
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH] monitor: print message when using 'help' with an unknown command
  2018-07-19 19:18 ` Dr. David Alan Gilbert
@ 2018-07-19 20:34   ` Collin Walling
  2018-07-20 18:44     ` Dr. David Alan Gilbert
  0 siblings, 1 reply; 9+ messages in thread
From: Collin Walling @ 2018-07-19 20:34 UTC (permalink / raw)
  To: Dr. David Alan Gilbert; +Cc: qemu-devel

On 07/19/2018 03:18 PM, Dr. David Alan Gilbert wrote:
> * Collin Walling (walling@linux.ibm.com) wrote:
>> When typing 'help' followed by an unknown command, QEMU will
>> not print anything to the command line to let the user know
>> they typed a bad command. Let's fix this by printing a message
>> to the monitor when this happens. For example:
>>
>>     (qemu) help xyz
>>     unknown command: 'xyz'
>>
>> Reported-by: Stefan Zimmermann <stzi@linux.ibm.com>
>> Signed-off-by: Collin Walling <walling@linux.ibm.com>
>> ---
>>  monitor.c | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/monitor.c b/monitor.c
>> index 7af1f18..7942f9f 100644
>> --- a/monitor.c
>> +++ b/monitor.c
>> @@ -1034,9 +1034,12 @@ static void help_cmd_dump(Monitor *mon, const mon_cmd_t *cmds,
>>              } else {
>>                  help_cmd_dump_one(mon, cmd, args, arg_index);
>>              }
>> -            break;
>> +            return;
>>          }
>>      }
>> +
>> +    /* Entry not found */
>> +    monitor_printf(mon, "unknown command: '%s'\n", args[arg_index]);
> 
> Thanks, that does suffer from a similar bug to the one you fixed a
> few months back in  317c52cc6aa0d ('monitor: report entirety of hmp
> command on error'):
> 
> (qemu) help foo
> unknown command: 'foo'
> (qemu) help info foo
> unknown command: 'foo'

Yeah... my thinking was that "info" is a correct command, so let's instead only
report to the user just the piece that was incorrect.

If it makes better sense to include the whole "info foo" piece, it's certainly
doable... whichever makes the most sense. Thoughts?

> 
> Dave
> (And yes, please cc me, otherwise I can miss them)
> 

Will do :)

>>  }
>>  
>>  static void help_cmd(Monitor *mon, const char *name)
>> -- 
>> 2.7.4
>>
>>
> --
> Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
> 


-- 
Respectfully,
- Collin Walling

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH] monitor: print message when using 'help' with an unknown command
  2018-07-19 16:39   ` Collin Walling
@ 2018-07-20 16:40     ` Eric Blake
  2018-07-20 19:37       ` Collin Walling
  0 siblings, 1 reply; 9+ messages in thread
From: Eric Blake @ 2018-07-20 16:40 UTC (permalink / raw)
  To: Collin Walling, Markus Armbruster; +Cc: qemu-devel, David Alan Gilbert

On 07/19/2018 11:39 AM, Collin Walling wrote:
> On 07/19/2018 12:31 PM, Markus Armbruster wrote:
>> You neglected to cc: maintainers.  Cc'ing them increases the odds your
>> patch will be noticed and picked up.  You can use
>> scripts/get_maintainer.pl to find maintainers.  You don't have to do
>> anything for this patch; it got noticed anyway.
>>
>> David, this is yours :)
> 
> Very true. Was a minor fix that I thought I'd just toss it out there and
> let anyone view it if they had the time. Will be more aware of who to CC
> next time around.

Or automate it: 
https://wiki.qemu.org/Contribute/SubmitAPatch#CC_the_relevant_maintainer 
suggests:

git config sendemail.cccmd 'scripts/get_maintainer.pl --nogit-fallback'

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH] monitor: print message when using 'help' with an unknown command
  2018-07-19 20:34   ` Collin Walling
@ 2018-07-20 18:44     ` Dr. David Alan Gilbert
  0 siblings, 0 replies; 9+ messages in thread
From: Dr. David Alan Gilbert @ 2018-07-20 18:44 UTC (permalink / raw)
  To: Collin Walling; +Cc: qemu-devel

* Collin Walling (walling@linux.ibm.com) wrote:
> On 07/19/2018 03:18 PM, Dr. David Alan Gilbert wrote:
> > * Collin Walling (walling@linux.ibm.com) wrote:
> >> When typing 'help' followed by an unknown command, QEMU will
> >> not print anything to the command line to let the user know
> >> they typed a bad command. Let's fix this by printing a message
> >> to the monitor when this happens. For example:
> >>
> >>     (qemu) help xyz
> >>     unknown command: 'xyz'
> >>
> >> Reported-by: Stefan Zimmermann <stzi@linux.ibm.com>
> >> Signed-off-by: Collin Walling <walling@linux.ibm.com>
> >> ---
> >>  monitor.c | 5 ++++-
> >>  1 file changed, 4 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/monitor.c b/monitor.c
> >> index 7af1f18..7942f9f 100644
> >> --- a/monitor.c
> >> +++ b/monitor.c
> >> @@ -1034,9 +1034,12 @@ static void help_cmd_dump(Monitor *mon, const mon_cmd_t *cmds,
> >>              } else {
> >>                  help_cmd_dump_one(mon, cmd, args, arg_index);
> >>              }
> >> -            break;
> >> +            return;
> >>          }
> >>      }
> >> +
> >> +    /* Entry not found */
> >> +    monitor_printf(mon, "unknown command: '%s'\n", args[arg_index]);
> > 
> > Thanks, that does suffer from a similar bug to the one you fixed a
> > few months back in  317c52cc6aa0d ('monitor: report entirety of hmp
> > command on error'):
> > 
> > (qemu) help foo
> > unknown command: 'foo'
> > (qemu) help info foo
> > unknown command: 'foo'
> 
> Yeah... my thinking was that "info" is a correct command, so let's instead only
> report to the user just the piece that was incorrect.
> 
> If it makes better sense to include the whole "info foo" piece, it's certainly
> doable... whichever makes the most sense. Thoughts?

Yes, I'd prefer the full version; unless it makes it particularly
complicated.


> > 
> > Dave
> > (And yes, please cc me, otherwise I can miss them)
> > 
> 
> Will do :)

Thanks,

Dave

> >>  }
> >>  
> >>  static void help_cmd(Monitor *mon, const char *name)
> >> -- 
> >> 2.7.4
> >>
> >>
> > --
> > Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
> > 
> 
> 
> -- 
> Respectfully,
> - Collin Walling
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH] monitor: print message when using 'help' with an unknown command
  2018-07-20 16:40     ` Eric Blake
@ 2018-07-20 19:37       ` Collin Walling
  0 siblings, 0 replies; 9+ messages in thread
From: Collin Walling @ 2018-07-20 19:37 UTC (permalink / raw)
  To: Eric Blake, Markus Armbruster; +Cc: qemu-devel, David Alan Gilbert

On 07/20/2018 12:40 PM, Eric Blake wrote:
> On 07/19/2018 11:39 AM, Collin Walling wrote:
>> On 07/19/2018 12:31 PM, Markus Armbruster wrote:
>>> You neglected to cc: maintainers.  Cc'ing them increases the odds your
>>> patch will be noticed and picked up.  You can use
>>> scripts/get_maintainer.pl to find maintainers.  You don't have to do
>>> anything for this patch; it got noticed anyway.
>>>
>>> David, this is yours :)
>>
>> Very true. Was a minor fix that I thought I'd just toss it out there and
>> let anyone view it if they had the time. Will be more aware of who to CC
>> next time around.
> 
> Or automate it: https://wiki.qemu.org/Contribute/SubmitAPatch#CC_the_relevant_maintainer suggests:
> 
> git config sendemail.cccmd 'scripts/get_maintainer.pl --nogit-fallback'
> 

This is very helpful, thank you.


-- 
Respectfully,
- Collin Walling

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-07-20 19:37 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-19 15:03 [Qemu-devel] [PATCH] monitor: print message when using 'help' with an unknown command Collin Walling
2018-07-19 16:31 ` Markus Armbruster
2018-07-19 16:39   ` Collin Walling
2018-07-20 16:40     ` Eric Blake
2018-07-20 19:37       ` Collin Walling
2018-07-19 19:11   ` Dr. David Alan Gilbert
2018-07-19 19:18 ` Dr. David Alan Gilbert
2018-07-19 20:34   ` Collin Walling
2018-07-20 18:44     ` Dr. David Alan Gilbert

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.