-
Notifications
You must be signed in to change notification settings - Fork 548
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
local_infile not enabled on a big endian environment #914
local_infile not enabled on a big endian environment #914
Conversation
This looks sensible, but intermittently fails now on just the same test that you're trying to fix for big endian. Try passing this in |
@sodabrew ok let me try it! |
Checking mysql and mariadb's source code, they are setting https://github.com/mysql/mysql-server/blob/mysql-5.7.20/sql-common/client.c#L5443
|
Seeing the test result, it is not same test. The test that is failed on big endian is this test:
|
We may have been too clever by switching from |
Did you mean to mention me? I don't think I was aware/involved with that change #840 |
Oops! I thought it was from a linting pass :) |
Can you check if the big endian errors begin to appear at version 0.4.6 and higher, which is the first version to have the |
@sodabrew yes I can do it on next Monday or Tuesday. |
See #919 to see if it resolves this issue for you. |
By the way, I checked the docs, and even though the behavior is boolean on/off for this feature, it does require an int argument https://dev.mysql.com/doc/refman/5.7/en/mysql-options.html
|
This does not solve on mariadb-c-connecter 3.0.2 ppc64 big endian environment.
I guess the reason is
and it is casted with as char in mariadb-c-connector.
OK, mariadb-c-connector's definition of |
Thanks for your help running this down! |
@sodabrew you are welcome. Reported here. https://jira.mariadb.org/browse/CONC-297 |
Thanks for getting this fixed upstream! |
Yeah, that's good news. |
For those who find this PR in the future: Fixed in mariadb-connector-c 3.0.3 or higher. |
@sodabrew I needed this patch to run mysql2 0.5.2 on mariadb-connector-c 3.0.5 on the big endian environment. Though mariadb-connector-c fixed something on mariadb-connector-c >= 3.0.3. |
The client option
local_infile
is not enabled on a big endian environment.There is a RPM package for this
mysql2
on Fedora Project [1]I try to build
mysql2
on several platforms for that.Ruby: 2.4.2
DB Client: mariadb-connector-c: 3.0.2 ([2])
On little endian environment such as x86_64, it is fine.
But in big endian such as ppc64, s390x, this issue happens.
The unit test was failed as below result on the environment.
The behavior
The used command is not allowed with this MariaDB version
usually happens whenlocal_infile
is off.The reason is this code.
https://github.com/MariaDB/mariadb-connector-c/blob/v3.0.2/libmariadb/mariadb_lib.c#L2652
When
usigned int intval
is used for MYSQL_OPT_LOCAL_INFILE in_mysql_client_options
, the value is set as a cast tomy_bool (= char)
intest(*(my_bool*) arg1)
.little endian: unsigned intval (0x01 0x00 0x00 0x00) => cast to char (0x01) ->
test
result is true =>mysql->options.client_flag|= CLIENT_LOCAL_FILES;
is run => okbig endian: unsigned intval(0x00 0x00 0x00 0x01) -> cast to char (0x00) ->
test
result is false =>mysql->options.client_flag&= ~CLIENT_LOCAL_FILES;
is run =>local_infile
is not set tomysql->options.client_flag
.[1] https://src.fedoraproject.org/rpms/rubygem-mysql2
[2] https://github.com/MariaDB/mariadb-connector-c