[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] qemu-sockets: Fix assertion failure
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-devel] [PATCH] qemu-sockets: Fix assertion failure |
Date: |
Wed, 6 Mar 2013 16:47:31 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Am 06.03.2013 um 16:38 hat Laszlo Ersek geschrieben:
> On 03/06/13 16:19, Kevin Wolf wrote:
> > Am 06.03.2013 um 16:04 hat Paolo Bonzini geschrieben:
> >> Il 06/03/2013 15:46, Laszlo Ersek ha scritto:
> >>>>> We could assert(!error_is_set(errp)) if we wanted. As soon as you've got
> >>>>> an Error, you must return instead of calling more functions with the
> >>>>> same error pointer.
> >>> I think Luiz would suggest (*) to receive any error into a
> >>> NULL-initialized local_err pointer; do the logic above on local_err, and
> >>> just before returning, error_propagate() it to errp.
> >>>
> >>> (*) I hope you can see what I did there: if you disagree, you get to
> >>> take that to Luiz, even though he didn't say anything. I'm getting
> >>> better at working this list! :)
> >>
> >> I agree with Laszlo.
> >
> > I don't really understand the difference. As long as the function
> > doesn't depend on the Error object to be present (which it doesn't),
> > isn't it semantically exactly the same?
>
> The difference is when the caller passes in an already set Error. In
> this case you release that and replace it with your own error.
>
> Usually we stick to the first error encountered. Under the above
> suggestion you'd keep error handling internal to yourself, and in the
> end make one attempt to propagate it outwards. If the caller has passed
> in NULL, the error is dropped. If the caller's passed in a preexistent
> error, then that one takes precedence and the new one is dropped (but it
> doesn't interfere with the internal logic). Third, the caller can even
> accept your error.
>
> error_propagate() and error_set() deal with the overwrite attempt
> differently. The former silently drops the newcomer, whereas the latter
> assert()s.
>
> Of course one wonders why a caller would pass in a preexistent Error.
Thanks, Laszlo, now I think I understand what Paolo and you were
suggesting.
However, I'd call any such caller buggy and don't feel like adding code
so that it doesn't break. This is what I meant when I said you should
return when you get an error, and not call other functions with the
already used error pointer.
Kevin
- [Qemu-devel] [PATCH] qemu-sockets: Fix assertion failure, Kevin Wolf, 2013/03/06
- Re: [Qemu-devel] [PATCH] qemu-sockets: Fix assertion failure, Paolo Bonzini, 2013/03/06
- Re: [Qemu-devel] [PATCH] qemu-sockets: Fix assertion failure, Kevin Wolf, 2013/03/06
- Re: [Qemu-devel] [PATCH] qemu-sockets: Fix assertion failure, Laszlo Ersek, 2013/03/06
- Re: [Qemu-devel] [PATCH] qemu-sockets: Fix assertion failure, Paolo Bonzini, 2013/03/06
- Re: [Qemu-devel] [PATCH] qemu-sockets: Fix assertion failure, Kevin Wolf, 2013/03/06
- Re: [Qemu-devel] [PATCH] qemu-sockets: Fix assertion failure, Laszlo Ersek, 2013/03/06
- Re: [Qemu-devel] [PATCH] qemu-sockets: Fix assertion failure,
Kevin Wolf <=
- Re: [Qemu-devel] [PATCH] qemu-sockets: Fix assertion failure, Laszlo Ersek, 2013/03/06
- Re: [Qemu-devel] [PATCH] qemu-sockets: Fix assertion failure, Markus Armbruster, 2013/03/06
- Re: [Qemu-devel] [PATCH] qemu-sockets: Fix assertion failure, Paolo Bonzini, 2013/03/06
- [Qemu-devel] [RFC PATCH] qemu-socket: Use local error variable, Kevin Wolf, 2013/03/14
- Re: [Qemu-devel] [RFC PATCH] qemu-socket: Use local error variable, Laszlo Ersek, 2013/03/14
- Re: [Qemu-devel] [RFC PATCH] qemu-socket: Use local error variable, Kevin Wolf, 2013/03/15
- Re: [Qemu-devel] [RFC PATCH] qemu-socket: Use local error variable, Laszlo Ersek, 2013/03/15
- Re: [Qemu-devel] [RFC PATCH] qemu-socket: Use local error variable, Kevin Wolf, 2013/03/15
- Re: [Qemu-devel] [RFC PATCH] qemu-socket: Use local error variable, Laszlo Ersek, 2013/03/15
- Re: [Qemu-devel] [PATCH] qemu-sockets: Fix assertion failure, Luiz Capitulino, 2013/03/19