All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fabien Chouteau <chouteau@adacore.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-trivial@nongnu.org, kwolf@redhat.com, qemu-devel@nongnu.org,
	stefanha@redhat.com
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH V2] get_tmp_filename: add explicit error message
Date: Tue, 19 Feb 2013 11:28:25 +0100	[thread overview]
Message-ID: <512353C9.9070108@adacore.com> (raw)
In-Reply-To: <87hal98to6.fsf@blackfin.pond.sub.org>

On 02/18/2013 05:37 PM, Markus Armbruster wrote:
> I agree with you that the existing error reporting is too unspecific in
> many cases, and I applaud your attempt to do something about it, but I'm
> afraid this patch creates as many problems as it solves.  Details below.
>
>
> In my review of v1, I wrote "The function's (implied) contract is to
> return an error code without printing anything.  If you want to change
> the contract to include reporting the error, you [...] have to
> demonstrate that all callers are happy with the change of contract."  So
> let's check the two callers of get_tmp_filename():
>
> 1. bdrv_open()
>
>    Complex function, can fail in many ways.  Returns an error code.
>    Does not report errors; that's left to its callers.
>
>    Your patch effectively changes bdrv_open() to report the error in one
>    of its failure modes.
>
>    For callers that report bdrv_open() failure to the user, we then get
>    two error messages: the one you add, followed by a less specific one
>    from further up the call chain.  Reporting the same error multiple
>    times is not nice.

It seems that your point of view is very Linux centric, on Windows we
didn't get any error message, just "Operation not permitted" for every
error in bdrv_open. I've spent 15 mins trying to find the exact location
of the error, going into the complex call tree of bdrv, and it's not the
first time.

Maybe I should just put the error message in the Windows code. So it
doesn't duplicate on Linux.

>
>    For callers that neglect to report bdrv_open() failure to the user
>    even though they should (if such buggy callers exist), you fix the
>    problem for one failure mode only.

One could say that it's already something. I'd like to have the time to
add error messages for all possible failures, but unfortunately I don't.

BTW, it looks likes a common rule in Qemu, we never check the error code
from Win32 API (maybe because there's no way to efficiently report those
errors).

> Apart from these fundamental gaps, the new error message needs polish.
> Say mkstemp() fails ENOSPC.  Gets reported roughly like this:
>
>     qemu-system-x86_64: -drive file=f16.img: get_tmp_filename: mkstemp() error: No space left on device
>     qemu-system-x86_64: -drive file=f16.img: could not open disk image f16.img: No space left on device
>
> The second message talks to the user in user terms.  That's proper.  The
> first one talks source code instead.  From a user's point of view,
> "get_tmp_filename" and "mkstemp() error" are gobbledygook.  At best,
> they can help him guessing what the problem might be.
>

I know this error message is not user friendly, but (again) it's still
better than 15 mins of digging in the code...

I don't want to spend much time on this small issue. If you consider
that it creates more problems than is solves, that's fine. I understand
your concerns and wanted to expose mine. Anyway the patch will remain in
our branch until a better solution is found.

Regards,

-- 
Fabien Chouteau


  reply	other threads:[~2013-02-19 10:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-06 14:17 [Qemu-trivial] [PATCH V2] get_tmp_filename: add explicit error message Fabien Chouteau
2013-02-18 13:47 ` Stefan Hajnoczi
2013-02-18 16:37 ` [Qemu-trivial] [Qemu-devel] " Markus Armbruster
2013-02-19 10:28   ` Fabien Chouteau [this message]
2013-02-19 12:01     ` 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=512353C9.9070108@adacore.com \
    --to=chouteau@adacore.com \
    --cc=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=stefanha@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.