Bug #74159 prototype for SHOW_FUNC handler declared as return int but return value ignored?
| Submitted: | 30 Sep 2014 15:53 | Modified: | 30 Sep 2014 16:24 |
|---|---|---|---|
| Reporter: | Hartmut Holzgraefe | Email Updates: | |
| Status: | Verified | Impact on me: | |
| Category: | MySQL Server: Compiling | Severity: | S3 (Non-critical) |
| Version: | MySQL 5.6.20 | OS: | Any |
| Assigned to: | CPU Architecture: | Any |
[30 Sep 2014 15:54]
Hartmut Holzgraefe
PS: maybe a general "MySQL Server: Plugin API" in addition to the more specific "MySQL Server: Storage Engine API" one would make sense? I wasn't really sure which category to choose for this one ...
[30 Sep 2014 16:24]
MySQL Verification Team
I have carefully studies the code and I must agree with reporter. This is a minor bug, but still a bug. Either return the error or make a function void !!!!
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.038 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.
Description: The mysql_show_var_func typedef for SHOW_FUNC callback handlers is declared as returning "int", but at the two places where it gets called in SHOW STATUS handling its return value is completely ignored. Also the documentation mentions that it should return int (by showing the typedef prototype) but doesn't mention what to return at all. How to repeat: Check ./include/mysql/plugin.h: typedef int (*mysql_show_var_func)(MYSQL_THD, struct st_mysql_show_var*, char *); vs. sql/sql_show.cc /* if var->type is SHOW_FUNC, call the function. Repeat as necessary, if new var is again SHOW_FUNC */ SHOW_VAR tmp; for (; list->type == SHOW_FUNC; list= &tmp) ((mysql_show_var_func)(list->value))(thd, &tmp, value); and /* if var->type is SHOW_FUNC or SHOW_SIMPLE_FUNC, call the function. Repeat as necessary, if new var is again one of the above */ for (var=variables; var->type == SHOW_FUNC || var->type == SHOW_SIMPLE_FUNC; var= &tmp) ((mysql_show_var_func)(var->value))(thd, &tmp, buff); Suggested fix: The return value was probably meant to signal errors? So implement actual error checking where mysql_show_var_func is called?