diff mbox

[v2] vnc: add a more descriptive error message

Message ID 4FF65090.3040402@redhat.com
State New
Headers show

Commit Message

Amos Kong July 6, 2012, 2:42 a.m. UTC
On 30/06/12 10:02, akong@redhat.com wrote:
> From: Amos Kong<akong@redhat.com>
>
> Currently qemu outputs some low-level error in qemu-sockets.c
> when failed to start vnc server.
> eg. 'getaddrinfo(127.0.0.1,5902): Name or service not known'
>
> Some libvirt users could not know what's happened with this
> unclear error message. This patch added a more descriptive
> error message.
>
> Signed-off-by: Amos Kong<akong@redhat.com>
>
> ---
> V2: improve the commitlog
> ---
>   vl.c |    5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>

CC: qemu-trivial@nongnu.org
From ae5d1000b1e30ab03d56f93a751b47e89f91ca41 Mon Sep 17 00:00:00 2001
From: Amos Kong <akong@redhat.com>
Date: Sat, 30 Jun 2012 10:02:20 +0800
Subject: [PATCH v2] vnc: add a more descriptive error message

Currently qemu outputs some low-level error in qemu-sockets.c
when failed to start vnc server.
eg. 'getaddrinfo(127.0.0.1,5902): Name or service not known'

Some libvirt users could not know what's happened with this
unclear error message. This patch added a more descriptive
error message.

Signed-off-by: Amos Kong <akong@redhat.com>
---
V2: improve the commitlog
---
 vl.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

Comments

Michael Tokarev July 6, 2012, 6:45 a.m. UTC | #1
On 06.07.2012 06:42, Amos Kong wrote:
> On 30/06/12 10:02, akong@redhat.com wrote:
>> From: Amos Kong<akong@redhat.com>
>>
>> Currently qemu outputs some low-level error in qemu-sockets.c
>> when failed to start vnc server.
>> eg. 'getaddrinfo(127.0.0.1,5902): Name or service not known'
>>
>> Some libvirt users could not know what's happened with this
>> unclear error message. This patch added a more descriptive
>> error message.

Gyus, please, pretty PLEASE stop doing things like this.

Amos, your patch does TWO things.  One is to clarify error
message as correctly stated in your description, and second
is to change the code to do exit(1) if this message is
generated.  So, please, a) add the second fact to the
description, and b) mention why it is needed.

Thanks,

/mjt
Markus Armbruster July 6, 2012, 7:31 a.m. UTC | #2
Michael Tokarev <mjt@tls.msk.ru> writes:

> On 06.07.2012 06:42, Amos Kong wrote:
>> On 30/06/12 10:02, akong@redhat.com wrote:
>>> From: Amos Kong<akong@redhat.com>
>>>
>>> Currently qemu outputs some low-level error in qemu-sockets.c
>>> when failed to start vnc server.
>>> eg. 'getaddrinfo(127.0.0.1,5902): Name or service not known'
>>>
>>> Some libvirt users could not know what's happened with this
>>> unclear error message. This patch added a more descriptive
>>> error message.

Only libvirt users?  Really?

> Gyus, please, pretty PLEASE stop doing things like this.
>
> Amos, your patch does TWO things.  One is to clarify error
> message as correctly stated in your description, and second
> is to change the code to do exit(1) if this message is
> generated.  So, please, a) add the second fact to the
> description, and b) mention why it is needed.

Seconded.
Amos Kong July 6, 2012, 8:09 a.m. UTC | #3
----- Original Message -----
> Michael Tokarev <mjt@tls.msk.ru> writes:
> 
> > On 06.07.2012 06:42, Amos Kong wrote:
> >> On 30/06/12 10:02, akong@redhat.com wrote:
> >>> From: Amos Kong <akong@redhat.com>
> >>>
> >>> Currently qemu outputs some low-level error in qemu-sockets.c
> >>> when failed to start vnc server.
> >>> eg. 'getaddrinfo(127.0.0.1,5902): Name or service not known'
> >>>
> >>> Some libvirt users could not know what's happened with this
> >>> unclear error message. This patch added a more descriptive
> >>> error message.
> 
> Only libvirt users?  Really?

Actually, it's not clear for all users.
 
> > Gyus, please, pretty PLEASE stop doing things like this.
> >
> > Amos, your patch does TWO things.  One is to clarify error
> > message as correctly stated in your description, and second
> > is to change the code to do exit(1) if this message is
> > generated.  So, please, a) add the second fact to the
> > description, and b) mention why it is needed.


'exit(1)' is the original code, my patch just add an error message.


> Seconded.


Thanks, Amos.
Michael Tokarev July 6, 2012, 8:14 a.m. UTC | #4
On 06.07.2012 12:09, Amos Kong wrote:
> ----- Original Message -----
>> Michael Tokarev <mjt@tls.msk.ru> writes:

>>> Gyus, please, pretty PLEASE stop doing things like this.
>>>
>>> Amos, your patch does TWO things.  One is to clarify error
>>> message as correctly stated in your description, and second
>>> is to change the code to do exit(1) if this message is
>>> generated.  So, please, a) add the second fact to the
>>> description, and b) mention why it is needed.
> 
> 
> 'exit(1)' is the original code, my patch just add an error message.

Amos, I'm sorry for that -- it is my ENOCOFFEE case of misreading
the patch.  I read it initially as you've added the "exit" line,
but you actually added the "}" line.  So indeed, this is the right
fix and the description matches what the patch does.

I've seen quite alot of cases when the description was like "clarifying
message" or "moving the code to a separate file", but at the same time
other things has changed, and often changed in a wrong way...

So, yes, it is a very good, and trivial, change, and you may use my

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>

The more cases like this is fixed, the better!

Thank you!

/mjt
diff mbox

Patch

diff --git a/vl.c b/vl.c
index 23ab3a3..cea97be 100644
--- a/vl.c
+++ b/vl.c
@@ -3583,8 +3583,11 @@  int main(int argc, char **argv, char **envp)
     /* init remote displays */
     if (vnc_display) {
         vnc_display_init(ds);
-        if (vnc_display_open(ds, vnc_display) < 0)
+        if (vnc_display_open(ds, vnc_display) < 0) {
+            fprintf(stderr, "Failed to start VNC server on `%s'\n",
+                    vnc_display);
             exit(1);
+        }
 
         if (show_vnc_port) {
             printf("VNC server running on `%s'\n", vnc_display_local_addr(ds));