On 3/8/21 10:54 AM, Kevin Wolf wrote: > This switches qemu-img from a QemuOpts-based parser for --object to > user_creatable_process_cmdline() which uses a keyval parser and enforces > the QAPI schema. > > Apart from being a cleanup, this makes non-scalar properties accessible. > > Signed-off-by: Kevin Wolf <kwolf@xxxxxxxxxx> > Acked-by: Peter Krempa <pkrempa@xxxxxxxxxx> > --- > qemu-img.c | 251 ++++++++++------------------------------------------- > 1 file changed, 45 insertions(+), 206 deletions(-) > > @@ -1353,7 +1303,7 @@ static int check_empty_sectors(BlockBackend *blk, int64_t offset, > /* > * Compares two images. Exit codes: > * > - * 0 - Images are identical > + * 0 - Images are identical or the requested help was printed Nice, but does the user-facing documentation need updating to match? > * 1 - Images differ > * >1 - Error occurred > */ > @@ -1423,15 +1373,21 @@ static int img_compare(int argc, char **argv) > case 'U': > force_share = true; > break; > - case OPTION_OBJECT: { > - QemuOpts *opts; > - opts = qemu_opts_parse_noisily(&qemu_object_opts, > - optarg, true); > - if (!opts) { > - ret = 2; > - goto out4; > + case OPTION_OBJECT: > + { > + Error *local_err = NULL; > + > + if (!user_creatable_add_from_str(optarg, &local_err)) { > + if (local_err) { > + error_report_err(local_err); > + exit(2); > + } else { > + /* Help was printed */ > + exit(EXIT_SUCCESS); > + } The commit message needs to be updated to call out that this bug fix was intentional, preferably mentioning the commit where we broke it (334c43e2c3). The code is fine, though, so with an improved commit message (and maybe some matching doc tweaks), Reviewed-by: Eric Blake <eblake@xxxxxxxxxx> -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org