Bug #18404 Erroneous (error != MYX_GRT_NO_ERROR) test in MGRT.cc
Submitted: 21 Mar 2006 19:24 Modified: 26 Apr 2006 19:31
Reporter: John Yodsnukis (Basic Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench Preview Severity:S3 (Non-critical)
Version:1.0.5beta svn revision 1218 OS:Linux (Linux (Gentoo on PPC))
Assigned to: Alfredo Kojima CPU Architecture:Any

[21 Mar 2006 19:24] John Yodsnukis
Description:
The logic is reversed-- 

if (error != MYX_GRT_NO_ERROR)

means there was an error. so the message shouldn't be "Registration ok".

conversely (error == MYX_GRT_NO_ERROR) means there was no error, so "C++ loader registration failed" is wrong too.

How to repeat:
Start workbench, press F4 for grt console window.  You'll see:

C++ loader registration failed (0)Registered 3 modules

There ought to be a newline too.  Probably should be a few more in other places.

Suggested fix:
Index: mysql-gui-common/source/linux/MySQLGRT/MGRT.cc
===================================================================
--- mysql-gui-common/source/linux/MySQLGRT/MGRT.cc (revision 1218)
+++ mysql-gui-common/source/linux/MySQLGRT/MGRT.cc (working copy)
@@ -939,10 +939,10 @@
module->extends= NULL;

error= myx_grt_add_module(_grt, module);
- if (error != MYX_GRT_NO_ERROR)
- out_text("Registration ok");
+ if (error == MYX_GRT_NO_ERROR)
+ out_text("Registration ok\n");
else
- out_text(ufmt("C++ loader registration failed (%i)", error));
+ out_text(ufmt("C++ loader registration failed (%i)\n", error));

GRT_LEAVE(_grt);
}
[22 Mar 2006 11:54] MySQL Verification Team
Thank you for the bug report. Verified on Linux Suse 10.
[29 Mar 2006 14:30] John Yodsnukis
Thanks for the feedback.  You might like this fix better, although I submit they are equivalent.

Index: MGRT.cc
===================================================================
--- MGRT.cc    (revision 1222) 
+++ MGRT.cc    (working copy) 

====
@@ -939,10 +939,10 @@
module->extends= NULL;

error= myx_grt_add_module(_grt, module);
 if (error != MYX_GRT_NO_ERROR)
-    out_text("Registration ok"); 
+    out_text(ufmt("Built-in C++ module %s registration failed (%i)\n", module->name, error)); 
   else
-    out_text(ufmt("C++ loader registration failed (%i)", error)); 
+    out_text(ufmt("Built-in C++ module {%s} registered\n", module->name)); 
     
   GRT_LEAVE(_grt);
 }
[29 Mar 2006 14:36] John Yodsnukis
Sorry... this patch is formatted better.

Index: MGRT.cc
===================================================================
--- MGRT.cc    (revision 1222) 
+++ MGRT.cc    (working copy) 

====
@@ -939,10 +939,11 @@
module->extends= NULL;

error= myx_grt_add_module(_grt, module);
 if (error != MYX_GRT_NO_ERROR)
-    out_text("Registration ok"); 
+    out_text(ufmt("Built-in C++ module %s registration failed (%i)\n", 
+                module->name, error)); 
   else
-    out_text(ufmt("C++ loader registration failed (%i)", error)); 
+    out_text(ufmt("Built-in C++ module {%s} registered\n", module->name)); 
     
   GRT_LEAVE(_grt);
 }
[26 Apr 2006 19:31] Alfredo Kojima
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html