[libvirt] [PATCH 2/2] virsh: fix regression in parsing optional integer

Jiri Denemark jdenemar at redhat.com
Fri Apr 15 21:35:45 UTC 2011


On Tue, Apr 12, 2011 at 15:35:07 -0600, Eric Blake wrote:
> Regression introduced in 0.8.5, commit c1564268.  The command
> 'virsh freecell 0' quit working when it changed from an optional
> string to an optional integer.
> 
> This patch introduces a slight change that specifying an option
> twice is now detected as an error.
> 
> * tools/virsh.c (vshCmddefGetData, vshCmddefGetOption)
> (vshCommandCheckOpts): Alter parameters to use bitmaps.
> (vshCmddefOptParse): New function.
> (vshCommandParse): Update for better handling of positional
> arguments.
> (vshCmddefHelp): Allow unit tests to validate options.
> ---
>  tools/virsh.c |  149 +++++++++++++++++++++++++++++++++++++++-----------------
>  1 files changed, 104 insertions(+), 45 deletions(-)

100iI hate command line parsing in virsh.
^[

The code looks like it does what it's supposed to do and I guess we should be
fine with the limit for 32 arguments for a single virsh command :-) If not,
there's clearly something wrong about the command which would need more.

ACK

Jirka




More information about the libvir-list mailing list