From: "Daniel P. Berrange" <berrange@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: Peter Xu <peterx@redhat.com>,
peter.maydell@linaro.org, famz@redhat.com, qemu-devel@nongnu.org,
pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH v4 0/4] Introduce error_report_{fatal|abort}
Date: Fri, 9 Sep 2016 18:19:41 +0100 [thread overview]
Message-ID: <20160909171941.GM25802@redhat.com> (raw)
In-Reply-To: <87inu5m2bj.fsf@dusky.pond.sub.org>
On Fri, Sep 09, 2016 at 07:05:04PM +0200, Markus Armbruster wrote:
> Peter Xu <peterx@redhat.com> writes:
>
> > v4 changes:
> > - remove two standard headers since they are included in osdep.h
> > already [Fam]
> > - make sure it passes build on all platforms (no --target-list
> > specified during configure)
> >
> > v3 changes:
> > - implement error_report_fatal using function [Markus]
> > - provide error_report_abort as well in seperate patch [Markus, Fam]
> >
> > We have many use cases that first print some error messages, then
> > quit (by either exit() or abort()). This series introduce two helper
> > functions for that.
> >
> > The old formats are mostly one of the following:
> >
> > Case one:
> >
> > error_report(...);
> > exit(1|EXIT_FAILURE) | abort();
> >
> > Case two:
> >
> > error_setg(&error_{fatal|abort}, ...);
> >
> > And we can convert either of the above cases into:
> >
> > error_report_{fatal|abort}(...);
> >
> > Two coccinelle scripts are created to help automate the work, plus
> > some manual tweaks:
> >
> > 1. very long strings, fix for over-80-chars issues, to make sure it
> > passes checkpatch.pl.
> >
> > 2. add "return XXX" for some non-void retcode functions.
> >
> > The first two patches introduce the functions. The latter two apply
> > them.
>
> You effectively propose to revise this coding rule from error.h:
>
> * Please don't error_setg(&error_fatal, ...), use error_report() and
> * exit(), because that's more obvious.
> * Likewise, don't error_setg(&error_abort, ...), use assert().
>
> If we accept your proposal, you get to add a patch to update the rule :)
>
> We've discussed the preferred way to report fatal errors to the human
> user before. With actual patches, we can see how a change of rules
> changes the code. Do we like the change shown by this patch set?
>
> I believe there are a number of separate issues to discuss here:
>
> * Shall we get rid of error_setg(&error_fatal, ...)?
>
> This is a no-brainer for me. Such a simple thing should be done in
> one way, not two ways. I count 14 instances of
> error_setg(&error_fatal, ...), but more than 300 of error_report(...);
> exit(1).
NB, arguably 99% of the usage of error_setg(&error_fatal) are in
fact cases where code ought to be eventually converted to accept
an "Error **errp" parameter and let the caller decide whether to
exit or not.
IOW, if we take this approach today we'll change
error_setg(&error_fatal, "....");
into
error_report_fatal("....");
and then later potentially change it back again to
error_setg(errp, "....");
This isn't the end of the world, but I'm just not convinced that
the intermediate change to error_report_fatal() buys us anything
positive overall.
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
next prev parent reply other threads:[~2016-09-09 17:19 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-07 6:06 [Qemu-devel] [PATCH v4 0/4] Introduce error_report_{fatal|abort} Peter Xu
2016-09-07 6:06 ` [Qemu-devel] [PATCH v4 1/4] error-report: provide error_report_fatal() Peter Xu
2016-09-07 6:06 ` [Qemu-devel] [PATCH v4 2/4] error-report: provide error_report_abort() Peter Xu
2016-09-07 6:06 ` [Qemu-devel] [PATCH v4 3/4] error-report: leverage error_report_fatal() Peter Xu
2016-09-07 6:06 ` [Qemu-devel] [PATCH v4 4/4] error-report: leverage error_report_abort() Peter Xu
2016-09-07 6:39 ` [Qemu-devel] [PATCH v4 0/4] Introduce error_report_{fatal|abort} Fam Zheng
2016-09-07 9:23 ` Alex Bennée
2016-09-07 9:33 ` Fam Zheng
2016-09-07 10:42 ` Peter Xu
2016-09-07 12:39 ` Lluís Vilanova
2016-09-07 13:48 ` Markus Armbruster
2016-09-09 17:05 ` Markus Armbruster
2016-09-09 17:19 ` Daniel P. Berrange [this message]
2016-09-12 8:02 ` Markus Armbruster
2016-09-12 5:33 ` Peter Xu
2016-09-12 19:49 ` Eric Blake
2016-09-13 6:44 ` 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=20160909171941.GM25802@redhat.com \
--to=berrange@redhat.com \
--cc=armbru@redhat.com \
--cc=famz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
/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.