[Libguestfs] [libguestfs-common PATCH 10/12] mltools/tools_utils: generalize "--key" selector parsing for OCaml utils
Richard W.M. Jones
rjones at redhat.com
Wed Jun 29 12:58:10 UTC 2022
On Wed, Jun 29, 2022 at 02:29:50PM +0200, Laszlo Ersek wrote:
> On 06/28/22 16:47, Richard W.M. Jones wrote:
> > On Tue, Jun 28, 2022 at 01:49:13PM +0200, Laszlo Ersek wrote:
> >> if key_opts then (
> >> let parse_key_selector arg =
> >> - let parts = String.nsplit ~max:3 ":" arg in
> >> + let parts = String.nsplit ":" arg in
> >
> > Doesn't this change what is parsed, ie if you need to include
> > a ":" in the third string?
>
> Ugh, yes it does -- but, regarding the C option parser, don't we have
> the same issue there already (pre-patch)?
>
> For example, "--key ID:key:foo:bar" causes guestfs_int_split_string() to
> return "foo" and "bar" separately, doesn't it?
>
> I think if a password contains a ":", the user just has to use a file
> selector.
True, so this makes the code more consistent with the C version.
[...]
> OK, I'll change the pre-patch default to abort() separately, and then
> stick with abort() in the new switch too.
Yup I think this would be better.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top
More information about the Libguestfs
mailing list