* [PATCH for-9.1?] system/vl.c: Print machine name, not "(null)", for unknown machine types
@ 2024-08-22 12:23 Peter Maydell
2024-08-22 13:54 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 2+ messages in thread
From: Peter Maydell @ 2024-08-22 12:23 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, qemu-trivial, Vladimir Sementsov-Ogievskiy,
Philippe Mathieu-Daudé, Michael Tokarev, qemu-stable
In commit 412d294ffdc we tried to improve the error message printed when
the machine type is unknown, but we used the wrong variable, resulting in:
$ ./build/x86/qemu-system-aarch64 -M bang
qemu-system-aarch64: unsupported machine type: "(null)"
Use -machine help to list supported machines
Use the right variable, so we produce more helpful output:
$ ./build/x86/qemu-system-aarch64 -M bang
qemu-system-aarch64: unsupported machine type: "bang"
Use -machine help to list supported machines
Note that we must move the qdict_del() to below the error_setg(),
because machine_type points into the value of that qdict entry,
and deleting it will make the pointer invalid.
Cc: qemu-stable@nongnu.org
Fixes: 412d294ffdc ("vl.c: select_machine(): add selected machine type to error message")
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
Tagged as for-9.1 because this is a sort-of regression since 9.0
(in 9.0 we didn't try to print the machine type name at all in
this error). But it's also very close to release and this is only
cosmetics in an error message. The cc-stable is for the case where
we don't put it into 9.1 and then backport it to the 9.1 stable
branch after release.
system/vl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/system/vl.c b/system/vl.c
index 41d53d2456a..01b8b8e77ad 100644
--- a/system/vl.c
+++ b/system/vl.c
@@ -1679,10 +1679,10 @@ static MachineClass *select_machine(QDict *qdict, Error **errp)
if (machine_type) {
machine_class = find_machine(machine_type, machines);
- qdict_del(qdict, "type");
if (!machine_class) {
- error_setg(errp, "unsupported machine type: \"%s\"", optarg);
+ error_setg(errp, "unsupported machine type: \"%s\"", machine_type);
}
+ qdict_del(qdict, "type");
} else {
machine_class = find_default_machine(machines);
if (!machine_class) {
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH for-9.1?] system/vl.c: Print machine name, not "(null)", for unknown machine types
2024-08-22 12:23 [PATCH for-9.1?] system/vl.c: Print machine name, not "(null)", for unknown machine types Peter Maydell
@ 2024-08-22 13:54 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 2+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-08-22 13:54 UTC (permalink / raw)
To: Peter Maydell, qemu-devel
Cc: Paolo Bonzini, qemu-trivial, Vladimir Sementsov-Ogievskiy,
Michael Tokarev, qemu-stable
On 22/8/24 14:23, Peter Maydell wrote:
> In commit 412d294ffdc we tried to improve the error message printed when
> the machine type is unknown, but we used the wrong variable, resulting in:
>
> $ ./build/x86/qemu-system-aarch64 -M bang
> qemu-system-aarch64: unsupported machine type: "(null)"
> Use -machine help to list supported machines
>
> Use the right variable, so we produce more helpful output:
>
> $ ./build/x86/qemu-system-aarch64 -M bang
> qemu-system-aarch64: unsupported machine type: "bang"
> Use -machine help to list supported machines
>
> Note that we must move the qdict_del() to below the error_setg(),
> because machine_type points into the value of that qdict entry,
> and deleting it will make the pointer invalid.
>
> Cc: qemu-stable@nongnu.org
> Fixes: 412d294ffdc ("vl.c: select_machine(): add selected machine type to error message")
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> Tagged as for-9.1 because this is a sort-of regression since 9.0
> (in 9.0 we didn't try to print the machine type name at all in
> this error). But it's also very close to release and this is only
> cosmetics in an error message. The cc-stable is for the case where
> we don't put it into 9.1 and then backport it to the 9.1 stable
> branch after release.
>
> system/vl.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Oops, thanks!
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-08-22 13:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-22 12:23 [PATCH for-9.1?] system/vl.c: Print machine name, not "(null)", for unknown machine types Peter Maydell
2024-08-22 13:54 ` Philippe Mathieu-Daudé
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).