Skip to content
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

Suppressing warnings in MariaDB Connector C (Fedora) case #1305

Closed
junaruga opened this issue Jan 21, 2023 · 5 comments · Fixed by #1306
Closed

Suppressing warnings in MariaDB Connector C (Fedora) case #1305

junaruga opened this issue Jan 21, 2023 · 5 comments · Fixed by #1306

Comments

@junaruga
Copy link
Contributor

Seeing the Fedora cases CI log on the latest master branch (6528137), there are some warnings printed in the process of running the test. I would like to suppress the warnings.

https://github.com/brianmario/mysql2/actions/runs/3972990412/jobs/6811349042#step:4:283

+ bundle exec rake spec
...
 /build/lib/mysql2/client.rb:58: warning: Your mysql client library does not support setting ssl_mode; full support comes with 5.6.36+, 5.7.11+, 8.0+
    should set ssl_mode option verify_identity
/build/lib/mysql2/client.rb:58: warning: Your mysql client library does not support setting ssl_mode; full support comes with 5.6.36+, 5.7.11+, 8.0+
    should set ssl_mode option required
/build/lib/mysql2/client.rb:58: warning: Your mysql client library does not support setting ssl_mode; full support comes with 5.6.36+, 5.7.11+, 8.0+
    should set ssl_mode option verify_ca
    should be able to connect via SSL options
/build/lib/mysql2/client.rb:58: warning: Your mysql client library does not support setting ssl_mode; full support comes with 5.6.36+, 5.7.11+, 8.0+
    should set ssl_mode option disabled
/build/lib/mysql2/client.rb:58: warning: Your mysql client library does not support setting ssl_mode; full support comes with 5.6.36+, 5.7.11+, 8.0+
...
   #each
/build/spec/mysql2/statement_spec.rb:311: warning: :cache_rows is ignored if :stream is true
/build/spec/mysql2/statement_spec.rb:311: warning: :cache_rows is ignored if :stream is true
     should yield different value for #first if streaming
...

The issue was discussed at #1294, however I want to open the issue ticket to manage the status.

@junaruga junaruga changed the title Suppressing warnings in Fedora (MariaDB Connector C) case Suppressing warnings in MariaDB Connector C (Fedora) case Jan 21, 2023
@sodabrew
Copy link
Collaborator

Thank you, commented on the other issue just now. I think this could be the last thing to solve before a next release, btw

@junaruga
Copy link
Contributor Author

Thank you for considering this issue, and I also would like to see the next release.

@sodabrew
Copy link
Collaborator

Ok, the version numbers are in the 3.x range (30207) -- that must be the MariaDB Connector/C family: https://mariadb.com/kb/en/about-mariadb-connector-c/

Looking at the docs for the ssl-enforce option, it looks like version 3.1.1 should be the minimum for full support https://mariadb.com/kb/en/configuring-mariadb-connectorc-with-option-files/#ssl-enforce

The code now more clearly shows a problem: it won't let 3xxxx through the code path that sets SSL_VERIFY_SERVER_CERT or SSL_MODE_ENFORCED.

mysql2/ext/mysql2/client.c

Lines 128 to 153 in 6528137

#if defined(HAVE_CONST_MYSQL_OPT_SSL_VERIFY_SERVER_CERT) || defined(HAVE_CONST_MYSQL_OPT_SSL_ENFORCE)
GET_CLIENT(self);
int val = NUM2INT( setting );
// Either MySQL 5.7.3 - 5.7.10, or Connector/C 6.1.3 - 6.1.x, or MariaDB 10.x and later
if ((version >= 50703 && version < 50711) || (version >= 60103 && version < 60200) || version >= 100000) {
#ifdef HAVE_CONST_MYSQL_OPT_SSL_VERIFY_SERVER_CERT
if (val == SSL_MODE_VERIFY_IDENTITY) {
my_bool b = 1;
int result = mysql_options( wrapper->client, MYSQL_OPT_SSL_VERIFY_SERVER_CERT, &b );
return INT2NUM(result);
}
#endif
#ifdef HAVE_CONST_MYSQL_OPT_SSL_ENFORCE
if (val == SSL_MODE_DISABLED || val == SSL_MODE_REQUIRED) {
my_bool b = ( val == SSL_MODE_REQUIRED );
int result = mysql_options( wrapper->client, MYSQL_OPT_SSL_ENFORCE, &b );
return INT2NUM(result);
}
#endif
rb_warn( "Your mysql client library does not support ssl_mode %d.", val );
return Qnil;
} else {
rb_warn( "Your mysql client library does not support ssl_mode as expected." );
return Qnil;
}
#endif

@junaruga
Copy link
Contributor Author

Yes, Fedora cases use the MariaDB Connector/C RPM package to run the mysql2 gem. And thanks for checking it.

@junaruga
Copy link
Contributor Author

junaruga commented Jan 22, 2023

The warnings in the SSL tests were suppressed by #1306. Thanks!

The remaining warning is below. I assume this is the expected result. And we can suppress it by capturing the warning by RSpec output. And I don't think we have to fix it before the next release.

https://github.com/brianmario/mysql2/actions/runs/3981580490/jobs/6825405070#step:4:547

/build/spec/mysql2/statement_spec.rb:311: warning: :cache_rows is ignored if :stream is true
/build/spec/mysql2/statement_spec.rb:311: warning: :cache_rows is ignored if :stream is true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants