Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
3.0.2
-
None
-
None
-
OS: Fedora Project version 28 (rawhide) (develop version).
Architecture: ppc64 big endian.
mariadb-c-connector: 3.0.2
Ruby: 2.4.2
mysql2: MySQL Ruby binding.
Description
mariadb-c-connector is using mysql_optionsv `MYSQL_OPT_LOCAL_INFILE` value (arg1) as my_bool (char) in this code.
Ref: https://github.com/MariaDB/mariadb-connector-c/blob/v3.0.2/libmariadb/mariadb_lib.c#L2652
```
if (!arg1 || test((my_bool) arg1))
mysql->options.client_flag|= CLIENT_LOCAL_FILES;
else
mysql->options.client_flag&= ~CLIENT_LOCAL_FILES;
```
The part was changed from `uint` to `my_bool` in below commit.
https://github.com/MariaDB/mariadb-connector-c/commit/4ca933bb817efd90076d5bde968761047ac7e4cf
The issue is seeing other MySQL server and MariaDB server code, it is defined as uint, not my_bool (char).
Ex.
https://github.com/mysql/mysql-server/blob/mysql-5.7.20/sql-common/client.c#L5443
https://github.com/MariaDB/server/blob/10.3/sql-common/client.c#L4275
> if (!arg || MY_TEST((uint) arg))
It is also written on the document..
https://dev.mysql.com/doc/refman/5.7/en/mysql-options.html
> MYSQL_OPT_LOCAL_INFILE (argument type: optional pointer to unsigned int)
This difference causes that local_infile with mariadb-c-connector does not work on big endian environment.
Because on little endian (major environment such as x86_64), when set
mysql_options MYSQL_OPT_LOCAL_INFILE arg as type uint 1 = "0x01 0x00 0x00 0x00" to enable local_infile, this becomes "0x01" by char (my_bool) cast.
But on big endian environment, when set type uint 1 = "0x00 0x00 0x00 0x01" to enable local_infile, this becomes "0x00" by char (my_bool) cast. As a result, local_infile is not set as on.
I want to know why this project changed uint to my_bool (char).
I wish it is changed to uint (unsigned int) again.
I came from mysql ruby binding project. See https://github.com/brianmario/mysql2/pull/914 .
Thank you.