From: "Dr. David Alan Gilbert" <dave@treblig.org>
To: BALATON Zoltan <balaton@eik.bme.hu>
Cc: Markus Armbruster <armbru@redhat.com>,
qemu-devel@nongnu.org, arei.gonglei@huawei.com,
pizhenwei@bytedance.com, alistair.francis@wdc.com,
stefanb@linux.vnet.ibm.com, kwolf@redhat.com, hreitz@redhat.com,
sw@weilnetz.de, qemu_oss@crudebyte.com, groug@kaod.org,
mst@redhat.com, imammedo@redhat.com, anisinha@redhat.com,
kraxel@redhat.com, shentey@gmail.com, npiggin@gmail.com,
harshpb@linux.ibm.com, sstabellini@kernel.org,
anthony@xenproject.org, paul@xen.org, edgar.iglesias@gmail.com,
elena.ufimtseva@oracle.com, jag.raman@oracle.com,
sgarzare@redhat.com, pbonzini@redhat.com, fam@euphon.net,
philmd@linaro.org, alex@shazbot.org, clg@redhat.com,
peterx@redhat.com, farosas@suse.de, lizhijian@fujitsu.com,
jasowang@redhat.com, samuel.thibault@ens-lyon.org,
michael.roth@amd.com, kkostiuk@redhat.com, zhao1.liu@intel.com,
mtosatti@redhat.com, rathc@linux.ibm.com, palmer@dabbelt.com,
liwei1518@gmail.com, dbarboza@ventanamicro.com,
zhiwei_liu@linux.alibaba.com, marcandre.lureau@redhat.com,
qemu-block@nongnu.org, qemu-ppc@nongnu.org,
xen-devel@lists.xenproject.org, kvm@vger.kernel.org,
qemu-riscv@nongnu.org
Subject: Re: [PATCH 09/14] error: Use error_setg_file_open() for simplicity and consistency
Date: Sat, 22 Nov 2025 13:58:19 +0000 [thread overview]
Message-ID: <aSHBez6kYRagEL1K@gallifrey> (raw)
In-Reply-To: <05ef43e5-cc42-8e1c-2619-eb1dea12b02b@eik.bme.hu>
* BALATON Zoltan (balaton@eik.bme.hu) wrote:
> On Sat, 22 Nov 2025, Markus Armbruster wrote:
> > "Dr. David Alan Gilbert" <dave@treblig.org> writes:
> >
> > > * Markus Armbruster (armbru@redhat.com) wrote:
> > > > "Dr. David Alan Gilbert" <dave@treblig.org> writes:
> > > >
> > > > > * Markus Armbruster (armbru@redhat.com) wrote:
> > > > > > Replace
> > > > > >
> > > > > > error_setg_errno(errp, errno, MSG, FNAME);
> > > > > >
> > > > > > by
> > > > > >
> > > > > > error_setg_file_open(errp, errno, FNAME);
> > > > > >
> > > > > > where MSG is "Could not open '%s'" or similar.
> > > > > >
> > > > > > Also replace equivalent uses of error_setg().
> > > > > >
> > > > > > A few messages lose prefixes ("net dump: ", "SEV: ", __func__ ": ").
> > > > > > We could put them back with error_prepend(). Not worth the bother.
> > > > >
> > > > > Yeh, I guess you could just do it with another macro using
> > > > > the same internal function just with string concatenation.
> > > >
> > > > I'm no fan of such prefixes. A sign of developers not caring enough to
> > > > craft a good error message for *users*. *Especially* in the case of
> > > > __func__.
> > > >
> > > > The error messages changes in question are:
> > > >
> > > > net dump: can't open DUMP-FILE: REASON
> > > > Could not open 'DUMP-FILE': REASON
> > > >
> > > > SEV: Failed to open SEV-DEVICE: REASON
> > > > Could not open 'SEV-DEVICE': REASON
> > > >
> > > > sev_common_kvm_init: Failed to open SEV_DEVICE 'REASON'
> > > > Could not open 'SEV-DEVICE': REASON
> > > >
> > > > I think these are all improvements, and the loss of the prefix is fine.
> > >
> > > Yeh, although I find the error messages aren't just for users;
> > > they're often for the first dev to see it to guess which other
> > > dev to pass the problem to, so a hint about where it's coming
> > > from can be useful.
> >
> > I agree! But I think an error message must be make sense to users
> > *first* and help developers second, and once they make sense to users,
> > they're often good enough for developers.
> >
> > The common failures I see happen when developers remain caught in the
> > developer's perspective, and write something that makes sense to *them*.
> > Strawman form:
> >
> > prefix: failed op[: reason]
> >
> > where "prefix" is a subsystem tag, or even __func__, and "reason" is
> > strerror() or similar.
> >
> > To users, this tends to read as
> >
> > gobbledygook: techbabble[: reason]
> >
> > When we care to replace "failed op" (developer's perspective) by
> > something that actually makes sense to users, "prefix" often becomes
> > redundant.
> >
> > The error messages shown above aren't bad to begin with. "failed to
> > open FILE", where FILE is something the user specified, should make
> > sense to the user. It should also be good enough for developers even
> > without a prefix: connecting trouble with the DUMP-FILE to dump /
> > trouble with the SEV-DEVICE to SEV should be straightforward.
> >
> > [...]
>
> I think that
>
> net dump: can't open random-filename: because of some error
>
> shows better where to look for the problem than just
>
> Could not open 'random-filename': because of some error
>
> as the latter does not tell where the file name comes from or what is it. It
> could be added by a management application or added by the users randomly
> without really knowing what they are doing so repeating the option or part
> in the message that the error comes from can help to find out where to
> correct it. Otherwise it might be difficult to guess what random-filename is
> related to if it's not named something you'd expect.
Yeh agreed. It very much depends if you think of a 'user' as the person
who typed a qemu command line, or pressed a button on a GUI that triggered
15 levels of abstraction that eventually ran a qemu.
Or for the support person who has a customer saying 'help I've got this error',
and now needs to route it to the network person rather than something else.
Dave
> Regards,
> BALATON Zoltan
--
-----Open up your eyes, open up your mind, open up your code -------
/ Dr. David Alan Gilbert | Running GNU/Linux | Happy \
\ dave @ treblig.org | | In Hex /
\ _________________________|_____ http://www.treblig.org |_______/
next prev parent reply other threads:[~2025-11-22 13:58 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-20 19:13 [PATCH 00/14] Error message improvements Markus Armbruster
2025-11-20 19:13 ` [PATCH 01/14] error: Strip trailing '\n' from error string arguments (again) Markus Armbruster
2025-11-20 19:13 ` [PATCH 02/14] hw/usb: Use error_setg_file_open() for a better error message Markus Armbruster
2025-11-21 0:42 ` Dr. David Alan Gilbert
2025-11-21 5:28 ` Markus Armbruster
2025-11-20 19:13 ` [PATCH 03/14] tap-solaris: Use error_setg_file_open() for better error messages Markus Armbruster
2025-11-21 0:24 ` Dr. David Alan Gilbert
2025-11-21 5:35 ` Markus Armbruster
2025-11-20 19:13 ` [PATCH 04/14] qga: " Markus Armbruster
2025-11-21 1:12 ` Dr. David Alan Gilbert
2025-11-21 7:39 ` Kostiantyn Kostiuk
2025-11-20 19:13 ` [PATCH 05/14] hw/scsi: Use error_setg_file_open() for a better error message Markus Armbruster
2025-11-21 2:05 ` Dr. David Alan Gilbert
2025-11-20 19:13 ` [PATCH 06/14] hw/virtio: " Markus Armbruster
2025-11-20 19:13 ` [PATCH 07/14] net/tap: " Markus Armbruster
2025-11-20 19:13 ` [PATCH 08/14] blkdebug: " Markus Armbruster
2025-11-20 19:13 ` [PATCH 09/14] error: Use error_setg_file_open() for simplicity and consistency Markus Armbruster
2025-11-20 23:57 ` Dr. David Alan Gilbert
2025-11-21 5:45 ` Markus Armbruster
2025-11-21 17:45 ` Dr. David Alan Gilbert
2025-11-22 7:36 ` Markus Armbruster
2025-11-22 11:53 ` BALATON Zoltan
2025-11-22 13:58 ` Dr. David Alan Gilbert [this message]
2025-11-20 19:13 ` [PATCH 10/14] net/slirp: Improve file open error message Markus Armbruster
2025-11-20 19:13 ` [PATCH 11/14] error: Use error_setg_errno() to improve error messages Markus Armbruster
2025-11-21 0:10 ` Dr. David Alan Gilbert
2025-11-21 5:46 ` Markus Armbruster
2025-11-21 7:37 ` Markus Armbruster
2025-11-20 19:13 ` [PATCH 12/14] error: Use error_setg_errno() for simplicity and consistency Markus Armbruster
2025-11-21 0:15 ` Dr. David Alan Gilbert
2025-11-21 5:47 ` Markus Armbruster
2025-11-21 7:42 ` Markus Armbruster
2025-11-20 19:13 ` [PATCH 13/14] qga/commands-win32: Use error_setg_win32() for better error messages Markus Armbruster
2025-11-21 7:43 ` Kostiantyn Kostiuk
2025-11-20 19:13 ` [PATCH 14/14] block/file-win32: Improve an error message Markus Armbruster
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=aSHBez6kYRagEL1K@gallifrey \
--to=dave@treblig.org \
--cc=alex@shazbot.org \
--cc=alistair.francis@wdc.com \
--cc=anisinha@redhat.com \
--cc=anthony@xenproject.org \
--cc=arei.gonglei@huawei.com \
--cc=armbru@redhat.com \
--cc=balaton@eik.bme.hu \
--cc=clg@redhat.com \
--cc=dbarboza@ventanamicro.com \
--cc=edgar.iglesias@gmail.com \
--cc=elena.ufimtseva@oracle.com \
--cc=fam@euphon.net \
--cc=farosas@suse.de \
--cc=groug@kaod.org \
--cc=harshpb@linux.ibm.com \
--cc=hreitz@redhat.com \
--cc=imammedo@redhat.com \
--cc=jag.raman@oracle.com \
--cc=jasowang@redhat.com \
--cc=kkostiuk@redhat.com \
--cc=kraxel@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=kwolf@redhat.com \
--cc=liwei1518@gmail.com \
--cc=lizhijian@fujitsu.com \
--cc=marcandre.lureau@redhat.com \
--cc=michael.roth@amd.com \
--cc=mst@redhat.com \
--cc=mtosatti@redhat.com \
--cc=npiggin@gmail.com \
--cc=palmer@dabbelt.com \
--cc=paul@xen.org \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=pizhenwei@bytedance.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=qemu_oss@crudebyte.com \
--cc=rathc@linux.ibm.com \
--cc=samuel.thibault@ens-lyon.org \
--cc=sgarzare@redhat.com \
--cc=shentey@gmail.com \
--cc=sstabellini@kernel.org \
--cc=stefanb@linux.vnet.ibm.com \
--cc=sw@weilnetz.de \
--cc=xen-devel@lists.xenproject.org \
--cc=zhao1.liu@intel.com \
--cc=zhiwei_liu@linux.alibaba.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.