Non-portable code in client plugin (fails on ARM)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MariaDB |
Fix Released
|
High
|
Sergei Golubchik | ||
MySQL Server |
Unknown
|
Unknown
|
|||
Percona Server moved to https://jira.percona.com/projects/PS |
Fix Released
|
Low
|
Unassigned | ||
5.5 |
Triaged
|
Low
|
Unassigned | ||
5.6 |
Fix Released
|
Low
|
Unassigned | ||
mysql-5.5 (Ubuntu) |
Fix Released
|
High
|
Clint Byrum |
Bug Description
The sql-common/
static struct st_mysql_
add_plugin(MYSQL *mysql, struct st_mysql_
int argc, va_list args)
{ ... }
int mysql_client_
{
...
add_
struct st_mysql_
mysql_client_
{
...
plugin= add_plugin(mysql, plugin, 0, 0, 0);
This passes 0 for the va_list argument. This is not correct C, there is no
guarantee that va_list is a pointer (or other type compatible with integer).
I got a report that GCC 4.5 fails on this on ARM.
An easy solution is to just declare and pass a dummy va_list instead; as argc
is zero it won't be used anyway.
[There is no code example in the source tree that actually uses the va_list arg
in the init function. The only client plugin I could find is, in
plugin/
static int init_dialog()
{
...
}
mysql_declare_
"dialog",
...
init_dialog,
This BTW seems to be putting an int (*)() for init_dialog, where it should be
int (*)(char *, size_t, int, va_list). This also isn't correct C, and while
perhaps unlikely to fail in practice, there is no reason not to use the
correct type for the function.]
Changed in maria: | |
importance: | Undecided → High |
milestone: | none → 5.2 |
status: | New → Confirmed |
description: | updated |
Changed in maria: | |
assignee: | nobody → Sergei (sergii) |
Changed in maria: | |
status: | Confirmed → Fix Committed |
Changed in maria: | |
status: | Fix Committed → Fix Released |
Changed in mysql-5.5 (Ubuntu): | |
status: | New → In Progress |
assignee: | nobody → Clint Byrum (clint-fewbar) |
Changed in mysql-5.5 (Ubuntu): | |
importance: | Undecided → High |
tags: | added: upstream |
Here is the full error message:
/home/esmil/ mysql-5. 5.8/sql- common/ client_ plugin. c: In function ‘mysql_ client_ plugin_ init’: mysql-5. 5.8/sql- common/ client_ plugin. c:252:5: error: incompatible type for argument 5 of ‘add_plugin’ mysql-5. 5.8/sql- common/ client_ plugin. c:126:1: note: expected ‘va_list’ but argument is of type ‘int’ mysql-5. 5.8/sql- common/ client_ plugin. c: In function ‘mysql_ client_ register_ plugin’ : mysql-5. 5.8/sql- common/ client_ plugin. c:310:5: error: incompatible type for argument 5 of ‘add_plugin’ mysql-5. 5.8/sql- common/ client_ plugin. c:126:1: note: expected ‘va_list’ but argument is of type ‘int’ CMakeFiles/ sql_embedded. dir/__/ sql-common/ client_ plugin. c.o] Error 1
/home/esmil/
/home/esmil/
/home/esmil/
/home/esmil/
/home/esmil/
make[2]: *** [libmysqld/