qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Capitulino <lcapitulino@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	aliguori@us.ibm.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 10/19] qemu-char: Chardev open error reporting, !_WIN32 part
Date: Thu, 9 Feb 2012 14:31:50 -0200	[thread overview]
Message-ID: <20120209143150.2608800f@doriath.home> (raw)
In-Reply-To: <m3liocq8sr.fsf@blackfin.pond.sub.org>

On Thu, 09 Feb 2012 17:19:00 +0100
Markus Armbruster <armbru@redhat.com> wrote:

> Kevin Wolf <kwolf@redhat.com> writes:
> 
> > Am 09.02.2012 16:16, schrieb Markus Armbruster:
> >> Kevin Wolf <kwolf@redhat.com> writes:
> >> 
> >>> Am 07.02.2012 15:09, schrieb Markus Armbruster:
> >>>> This part takes care of backends "file", "pipe", "pty" and "stdio".
> >>>> Unlike many other backends, these leave open error reporting to their
> >>>> caller.  Because the caller doesn't know what went wrong, this results
> >>>> in a pretty useless error message.
> >>>>
> >>>> Change them to report their errors.  Improves comically user-hostile
> >>>> messages like this one for "-chardev file,id=foo,path=/x"
> >>>>
> >>>>     chardev: opening backend "file" failed
> >>>>
> >>>> to
> >>>>
> >>>>     qemu-system-x86_64: -chardev file,id=foo,path=/x: Can't create file '/x': Permission denied
> >>>>     chardev: opening backend "file" failed
> >>>>
> >>>> The useless "opening backend failed" message will be cleaned up
> >>>> shortly.
> >>>>
> >>>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> >>>> ---
> >>>>  qemu-char.c |   19 +++++++++++++++----
> >>>>  1 files changed, 15 insertions(+), 4 deletions(-)
> >>>
> >>>> @@ -1002,7 +1013,7 @@ static CharDriverState *qemu_chr_open_pty(QemuOpts *opts)
> >>>>      chr->filename = g_malloc(len);
> >>>>      snprintf(chr->filename, len, "pty:%s", q_ptsname(master_fd));
> >>>>      qemu_opt_set(opts, "path", q_ptsname(master_fd));
> >>>> -    fprintf(stderr, "char device redirected to %s\n", q_ptsname(master_fd));
> >>>> +    error_printf("char device redirected to %s\n", q_ptsname(master_fd));
> >>>>  
> >>>>      s = g_malloc0(sizeof(PtyCharDriver));
> >>>>      chr->opaque = s;
> >>>
> >>> Not really an error message. Does it make any sense at all to have this
> >>> message?
> >> 
> >> error_printf() prints to the error channel (monitor or stderr), but not
> >> necessarily an error message.  See for instance drive_init()'s use of it
> >> to print format help.
> >
> > Ah, right. I confused it with error_report() which includes an error
> > location. That would be rather unexpected.
> 
> Indeed.
> 
> >> Not sure whether it makes sense to have this message.  I guess it exists
> >> because the pty is chosen automatically, but the user might still want
> >> to know which one was chosen.
> >
> > Does "the user" include management tools?
> >
> > If we had a chardev_add monitor command, its output would be moved from
> > stderr to the monitor. We don't have that,
> 
> Yet!  One of the reasons for doing this series was preparing the ground
> for chardev_add.

I haven't taken a look in detail in this series, but if your end goal is to
add chardev_add, then you should probably be using error_set() all around.

> >                                            but  there might be commands
> > that create chardevs internally: gdbserver is one, not sure if I missed
> > others.
> >
> > We probably don't care much about breaking tools that use 'gdbserver
> > pty' and read the device from stderr.
> 
> And do so using a monitor chardev other than stdio.  That would be
> weird, wouldn't it?
> 
> >                                       (But the information is missing
> > from QMP - should it be added?)
> 
> Right when somebody asks for it.
>
> 
> For what it's worth, some chardev backend open() methods return such
> information via their opts argument.  E.g. inet_listen_opts() receives a
> port range in opts (options "port" and "to"), and overwrites option
> "port" with the port actually chosen.  I hate that, should use separate
> options.
> 

  reply	other threads:[~2012-02-09 16:32 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-07 14:09 [Qemu-devel] [PATCH 00/19] Fix and improve chardev open error messages Markus Armbruster
2012-02-07 14:09 ` [Qemu-devel] [PATCH 01/19] Revert "qemu-char: Print strerror message on failure" and deps Markus Armbruster
2012-02-07 15:06   ` Anthony Liguori
2012-02-07 14:09 ` [Qemu-devel] [PATCH 02/19] qemu-char: Use qemu_open() to avoid leaking fds to children Markus Armbruster
2012-02-07 15:07   ` Anthony Liguori
2012-02-07 14:09 ` [Qemu-devel] [PATCH 03/19] qemu-char: Re-apply style fixes from just reverted aad04cd0 Markus Armbruster
2012-02-07 15:07   ` Anthony Liguori
2012-02-07 14:09 ` [Qemu-devel] [PATCH 04/19] qemu-char: qemu_chr_open_fd() can't fail, don't check Markus Armbruster
2012-02-07 15:24   ` Anthony Liguori
2012-02-07 14:09 ` [Qemu-devel] [PATCH 05/19] vl.c: Error locations for options using add_device_config() Markus Armbruster
2012-02-07 14:09 ` [Qemu-devel] [PATCH 06/19] gdbstub: Error locations for -gdb Markus Armbruster
2012-02-07 15:32   ` Kevin Wolf
2012-02-09 15:08     ` Markus Armbruster
2012-02-07 14:09 ` [Qemu-devel] [PATCH 07/19] sockets: Drop sockets_debug debug code Markus Armbruster
2012-02-07 14:09 ` [Qemu-devel] [PATCH 08/19] sockets: Clean up inet_listen_opts()'s convoluted bind() loop Markus Armbruster
2012-02-07 14:09 ` [Qemu-devel] [PATCH 09/19] sockets: Chardev open error reporting, sockets part Markus Armbruster
2012-02-07 15:13   ` Anthony Liguori
2012-02-09 16:05     ` Markus Armbruster
2012-02-14 17:24       ` Markus Armbruster
2012-02-14 19:05         ` Anthony Liguori
2012-02-15 13:33           ` Markus Armbruster
2012-02-22 20:28             ` Anthony Liguori
2012-02-23  8:15               ` Markus Armbruster
2012-08-29 15:15                 ` Amos Kong
2012-08-29 16:04                   ` Amos Kong
2012-09-05  2:19                     ` Amos Kong
2012-09-05 18:52                       ` Luiz Capitulino
2012-02-07 14:09 ` [Qemu-devel] [PATCH 10/19] qemu-char: Chardev open error reporting, !_WIN32 part Markus Armbruster
2012-02-07 15:52   ` Kevin Wolf
2012-02-09 15:16     ` Markus Armbruster
2012-02-09 15:39       ` Kevin Wolf
2012-02-09 16:19         ` Markus Armbruster
2012-02-09 16:31           ` Luiz Capitulino [this message]
2012-02-09 17:08             ` Markus Armbruster
2012-02-07 14:09 ` [Qemu-devel] [PATCH 11/19] qemu-char: Chardev open error reporting, _WIN32 part Markus Armbruster
2012-02-07 14:09 ` [Qemu-devel] [PATCH 12/19] qemu-char: Chardev open error reporting, tty part Markus Armbruster
2012-02-07 14:09 ` [Qemu-devel] [PATCH 13/19] qemu-char: Chardev open error reporting, parport part Markus Armbruster
2012-02-07 14:09 ` [Qemu-devel] [PATCH 14/19] console: Eliminate text_consoles[] Markus Armbruster
2012-02-07 14:09 ` [Qemu-devel] [PATCH 15/19] console: Chardev open error reporting, console part Markus Armbruster
2012-02-07 14:09 ` [Qemu-devel] [PATCH 16/19] spice-qemu-char: Chardev open error reporting, spicevmc part Markus Armbruster
2012-02-07 14:09 ` [Qemu-devel] [PATCH 17/19] baum: Chardev open error reporting, braille part Markus Armbruster
2012-02-07 14:09 ` [Qemu-devel] [PATCH 18/19] qemu-char: Chardev open error reporting, generic part Markus Armbruster
2012-02-07 14:09 ` [Qemu-devel] [PATCH 19/19] qemu-char: Fix legacy chardev syntax error reporting Markus Armbruster
2012-02-07 16:05 ` [Qemu-devel] [PATCH 00/19] Fix and improve chardev open error messages Kevin Wolf
2012-02-24 15:30 ` Anthony Liguori

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=20120209143150.2608800f@doriath.home \
    --to=lcapitulino@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=armbru@redhat.com \
    --cc=kwolf@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 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).