From: SeokYeon Hwang <syeon.hwang@samsung.com>
To: 'Markus Armbruster' <armbru@redhat.com>
Cc: 'Peter Maydell' <peter.maydell@linaro.org>,
'Paolo Bonzini' <bonzini@gnu.org>,
paolo.bonzini@gmail.com, qemu-devel@nongnu.org,
'Max Reitz' <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] error: fixed error_set_errno() to deal with a negative type of os_error.
Date: Fri, 07 Nov 2014 11:26:26 +0900 [thread overview]
Message-ID: <074501cffa32$3b7ab500$b2701f00$@samsung.com> (raw)
In-Reply-To: <87sihw4r5l.fsf@blackfin.pond.sub.org>
> -----Original Message-----
> From: Markus Armbruster [mailto:armbru@redhat.com]
> Sent: Thursday, November 06, 2014 6:25 PM
> To: SeokYeon Hwang
> Cc: 'Paolo Bonzini'; 'Max Reitz'; qemu-devel@nongnu.org; Peter Maydell;
> paolo.bonzini@gmail.com
> Subject: Re: [Qemu-devel] [PATCH] error: fixed error_set_errno() to deal
> with a negative type of os_error.
>
> SeokYeon Hwang <syeon.hwang@samsung.com> writes:
>
> >> -----Original Message-----
> >> From: SeokYeon Hwang [mailto:syeon.hwang@samsung.com]
> >> Sent: Wednesday, November 05, 2014 10:13 PM
> >> To: 'Paolo Bonzini'; 'Max Reitz'; 'qemu-devel@nongnu.org'
> >> Cc: 'armbru@redhat.com'; 'paolo.bonzini@gmail.com'
> >> Subject: RE: [PATCH] error: fixed error_set_errno() to deal with a
> >> negative type of os_error.
> >>
> >> > -----Original Message-----
> >> > From: Paolo Bonzini [mailto:paolo.bonzini@gmail.com] On Behalf Of
> >> > Paolo Bonzini
> >> > Sent: Wednesday, November 05, 2014 9:45 PM
> >> > To: Max Reitz; SeokYeon Hwang; qemu-devel@nongnu.org
> >> > Cc: armbru@redhat.com; paolo.bonzini@gmail.com
> >> > Subject: Re: [PATCH] error: fixed error_set_errno() to deal with a
> >> > negative type of os_error.
> >> >
> >> >
> >> >
> >> > On 05/11/2014 12:11, Max Reitz wrote:
> >> > >
> >> > > Of course I understand, but this patch doesn't make matters
> >> > > worse, as long as there are not systems which have negative
> >> > > values for errno (which I think we generally assume not to exist
> >> > > throughout
> > qemu).
> >> > > That's why I'm fine with it. We should fix the callers but I
> >> > > don't see why we shouldn't apply this patch as well.
> >> > >
> >> > > A similar issue already came up and led to commit b276d2499,
> >> > > where callers of error_setg_errno() assumed that it would not
> >> > > clobber errno, so we fixed some of the callers but also applied
> >> > > that commit which just saves errno because there's no reason not
to.
> >> >
> >> > I think side effect are a different matter than misuse of QEMU.
> >> >
> >> > There are "only" 157 calls to error_setg_errno; 67 use "errno" as
> >> > the argument, and 4 use an explicit errno value (one of them is the
> >> > wrong
> >> > - EBUSY). The other 86 seem correct and should not be hard to audit.
> >> >
> >> > Let's instead add an assertion check to error_setg_errno.
> >> >
> >> > Paolo
> >>
> >> I have expected to come out several opinions about this patch.
> >>
> >> The use of negative errno on "strerror()" was obviously wrong. But
> >> that does not mean it is wrong to use the negative errno on
> > "error_set_errno()".
> >> The reason that I chose this one among the solutions is to change
> >> function specification. I think it seems good to us to respect the
> >> tradition of the developers that use negative errno.
> >>
> >> But if error_set_errno() has strict specification - so, we must not
> >> change it's spec - I agree with Paolo's opinion.
> >
> > I think we have 2 options.
> >
> > 1. "error_set_errno()" is just utility for developer's convenience.
> > Why can't we supply more convenience to developer ??
> > -> My first opinion.
> >
> > 2. It is not just utility function for convenience or we cannot change
> > its spec because it is well-known function.
> > -> If this is right, I'm ready to post 2nd patch that applied Paolo's
> > opinion.
> >
> > What do you think about it??
>
> 3. Passing a negative value to an errno parameter is wrong. It's probably
> a harmless sign error, but it *could* be a logic error. We should not
> sweep programming errors under the rug.
>
> Please assert(os_error >= 0). Help with auditing callers is welcome.
I just posted patch v2.
Thank you for your advice.
prev parent reply other threads:[~2014-11-07 2:26 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-05 8:09 [Qemu-devel] [PATCH] error: fixed error_set_errno() to deal with a negative type of os_error SeokYeon Hwang
2014-11-05 8:12 ` Max Reitz
2014-11-05 10:57 ` Paolo Bonzini
2014-11-05 11:11 ` Max Reitz
2014-11-05 11:19 ` Eric Blake
2014-11-06 4:49 ` Amos Kong
2014-11-05 12:44 ` Paolo Bonzini
2014-11-05 13:13 ` SeokYeon Hwang
2014-11-05 13:29 ` Markus Armbruster
2014-11-06 2:02 ` SeokYeon Hwang
2014-11-06 9:25 ` Markus Armbruster
2014-11-07 2:26 ` SeokYeon Hwang [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='074501cffa32$3b7ab500$b2701f00$@samsung.com' \
--to=syeon.hwang@samsung.com \
--cc=armbru@redhat.com \
--cc=bonzini@gnu.org \
--cc=mreitz@redhat.com \
--cc=paolo.bonzini@gmail.com \
--cc=peter.maydell@linaro.org \
--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 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).