qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 for-5.2 0/6] Deprecate or forbid crazy QemuOpts cases
@ 2020-11-09 13:39 Paolo Bonzini
  2020-11-09 13:39 ` [PATCH v2 1/6] qemu-option: simplify search for end of key Paolo Bonzini
                   ` (6 more replies)
  0 siblings, 7 replies; 26+ messages in thread
From: Paolo Bonzini @ 2020-11-09 13:39 UTC (permalink / raw)
  To: qemu-devel; +Cc: armbru

It's very hard to make QemuOpts fail.  It's also very easy
to write command lines that QemuOpts accept but make no sense.

This series deals with three cases:

- QemuOpts accepts ids even for options that are meant to be singletons.
As a result, a command line option like "-M q35,id=ff" is ignored silently.

- QemuOpts simply matches "help" or "?" against the option name to
determine whether the user asked for help.  Something like "nohelp" or
"?=please" will print the help message.

- QemuOpts lets you write boolean options in "short form" where "abc"
means "abc=on" and "noabc" means "abc=off".  This is confusing, since it
is not done for the first key=value pair (but only if there is an implied
key); it can also be grossly misused, as in the previous example, because
it is not type safe.  In case you need confirmation, "-device e1000,noid"
will create a device with id equal to "off".

Unfortunately, this last idiom has found wide use with -chardev (think
"server,nowait") and to a lesser extent -spice, so it can only be
deprecated.  The other two are removed.

Patches 1-3 are cleanups.  Patches 4-6 deal with the above issues one
by one.  I have a seventh patch to remove the third argument to
qemu_opts_create, but it touches a few dozen files.

Paolo

Supersedes: <20201105142731.623428-1-pbonzini@redhat.com>

Paolo Bonzini (6):
  qemu-option: simplify search for end of key
  qemu-option: pass QemuOptsList to opts_accepts_any
  qemu-option: restrict qemu_opts_set to merge-lists QemuOpts
  qemu-option: clean up id vs. list->merge_lists
  qemu-option: move help handling to get_opt_name_value
  qemu-option: warn for short-form boolean options

 docs/system/deprecated.rst |   6 ++
 include/qemu/option.h      |   3 +-
 softmmu/vl.c               |  19 ++---
 tests/test-qemu-opts.c     |  26 ++++++-
 util/qemu-option.c         | 149 +++++++++++++++++++------------------
 5 files changed, 113 insertions(+), 90 deletions(-)

-- 
2.26.2



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

end of thread, other threads:[~2020-11-10  9:55 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-09 13:39 [PATCH v2 for-5.2 0/6] Deprecate or forbid crazy QemuOpts cases Paolo Bonzini
2020-11-09 13:39 ` [PATCH v2 1/6] qemu-option: simplify search for end of key Paolo Bonzini
2020-11-09 14:48   ` Markus Armbruster
2020-11-09 13:39 ` [PATCH v2 2/6] qemu-option: pass QemuOptsList to opts_accepts_any Paolo Bonzini
2020-11-09 15:27   ` Markus Armbruster
2020-11-09 13:39 ` [PATCH v2 3/6] qemu-option: restrict qemu_opts_set to merge-lists QemuOpts Paolo Bonzini
2020-11-09 15:55   ` Markus Armbruster
2020-11-09 16:21     ` Paolo Bonzini
2020-11-09 18:52       ` Markus Armbruster
2020-11-09 18:58         ` Paolo Bonzini
2020-11-09 13:39 ` [PATCH v2 4/6] qemu-option: clean up id vs. list->merge_lists Paolo Bonzini
2020-11-09 16:56   ` Markus Armbruster
2020-11-09 17:17     ` Paolo Bonzini
2020-11-09 18:38       ` Markus Armbruster
2020-11-09 18:59         ` Paolo Bonzini
2020-11-10  8:29           ` Markus Armbruster
2020-11-10  8:39             ` Paolo Bonzini
2020-11-10  9:54               ` Markus Armbruster
2020-11-09 13:39 ` [PATCH v2 5/6] qemu-option: move help handling to get_opt_name_value Paolo Bonzini
2020-11-09 19:40   ` Markus Armbruster
2020-11-09 19:47     ` Paolo Bonzini
2020-11-09 13:39 ` [PATCH v2 6/6] qemu-option: warn for short-form boolean options Paolo Bonzini
2020-11-09 21:19   ` Markus Armbruster
2020-11-09 21:42     ` Paolo Bonzini
2020-11-10  8:32       ` Markus Armbruster
2020-11-09 13:54 ` [PATCH v2 for-5.2 0/6] Deprecate or forbid crazy QemuOpts cases no-reply

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).