From: Markus Armbruster <armbru@redhat.com>
To: Kostiantyn Kostiuk <kkostiuk@redhat.com>
Cc: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
qemu-devel@nongnu.org, "Yan Vugenfirer" <yvugenfi@redhat.com>,
"Daniel Berrangé" <berrange@redhat.com>
Subject: Re: [PATCH] util: win32: Write hex value when can't get error message
Date: Mon, 28 Jul 2025 13:12:47 +0200 [thread overview]
Message-ID: <87ecu0r2kw.fsf@pond.sub.org> (raw)
In-Reply-To: <CAPMcbCp5BuLADQoDijw811G4-u-ssBJ+eFrzyiU8_G9Tr7uLHA@mail.gmail.com> (Kostiantyn Kostiuk's message of "Fri, 25 Jul 2025 12:59:00 +0300")
Kostiantyn Kostiuk <kkostiuk@redhat.com> writes:
> Issue reported to GLib https://gitlab.gnome.org/GNOME/glib/-/issues/3740
> PR with fix https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4716
>
> @Markus Armbruster <armbru@redhat.com>
> Based on the documentation from this PR, do you have any other objections
> to this patch?
I can't see that the commit invalidates my objection.
The revised contract still specifies the error code comes from
GetLastError() or WSAGetLastError(). Passing anything else still
violates it.
What can go wrong when we pass some other integer?
Say we pass EINVAL. It's 22 on Linux. Interpreted as Windows system
error code (the thing GetLastError() returns), that's ERROR_BAD_COMMAND,
documented as "The device does not recognize the command."[*].
g_win32_error_message() and thus error_setg_win32() will report
confusing nonsense.
Another common integer error code is -1. This isn't a valid Windows
system error code, so we can expect to hit the "unknown Windows error"
branch.
Perhaps the code is so confused about error codes that passing them to
an appropriate function is impractical, and taking our chances with
g_win32_error_message() is the best we can do. Wouldn't exactly inspire
confidence in the soundness of QEMU's Windows code.
[*] https://learn.microsoft.com/en-us/windows/win32/debug/system-error-codes--0-499-
prev parent reply other threads:[~2025-07-28 11:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-17 14:59 [PATCH] util: win32: Write hex value when can't get error message Kostiantyn Kostiuk
2025-07-17 15:28 ` Yan Vugenfirer
2025-07-19 6:27 ` Markus Armbruster
2025-07-21 7:07 ` Kostiantyn Kostiuk
2025-07-21 9:22 ` Markus Armbruster
2025-07-21 10:12 ` Kostiantyn Kostiuk
2025-07-21 11:23 ` Yan Vugenfirer
2025-07-21 11:53 ` Philippe Mathieu-Daudé
2025-07-25 9:59 ` Kostiantyn Kostiuk
2025-07-28 9:47 ` Philippe Mathieu-Daudé
2025-07-28 9:58 ` Kostiantyn Kostiuk
2025-07-28 11:12 ` Markus Armbruster [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ecu0r2kw.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=kkostiuk@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=yvugenfi@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.