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

mydumper incompatibility with [email protected] #199539

Open
4 tasks done
webflo opened this issue Nov 30, 2024 · 5 comments
Open
4 tasks done

mydumper incompatibility with [email protected] #199539

webflo opened this issue Nov 30, 2024 · 5 comments
Labels
bug Reproducible Homebrew/homebrew-core bug stale No recent activity

Comments

@webflo
Copy link

webflo commented Nov 30, 2024

brew gist-logs <formula> link OR brew config AND brew doctor output

...

Verification

  • My brew doctor output says Your system is ready to brew. and am still able to reproduce my issue.
  • I ran brew update and am still able to reproduce my issue.
  • I have resolved all warnings from brew doctor and that did not fix my problem.
  • I searched for recent similar issues at https://github.com/Homebrew/homebrew-core/issues?q=is%3Aissue and found no duplicates.

What were you trying to do (and why)?

I have tried to use mydumper with [email protected].

What happened (include all command output)?

** (myloader:30324): CRITICAL **: Error connection to database: TLS/SSL error: SSL is required, but the server does not support it

What did you expect to happen?

Dump db.

Step-by-step reproduction instructions (by running brew commands)

mydumper can't connect to mariadb. TLS/SSL is disabled by default in [email protected] (afaik). The bug could have something to do with the change in ba70bb4.

// cc @cho-m

Related issue: mydumper/mydumper#1674

I tried to build a version of mydumper with [email protected] or [email protected] but it did not build successful.

@webflo webflo added the bug Reproducible Homebrew/homebrew-core bug label Nov 30, 2024
@cho-m
Copy link
Member

cho-m commented Nov 30, 2024

Seems odd as MariaDB-Connector-C should be aligned with latest MariaDB.

For example, MariaDB 11.7.1 runs the same version of MariaDB-Connector-C 3.4.3 as seen by the submodule in https://github.com/MariaDB/server/tree/mariadb-11.7.1

MariaDB 10.11.10 uses an older version - https://github.com/mariadb-corporation/mariadb-connector-c/releases/tag/v3.3.12


Not sure if related, but MariaDB did rework the TLS/SSL handling in 3.4.1 (mariadb-corporation/mariadb-connector-c@1287c901), which has been used since MariaDB 11.4.2.

Based on commit message, it looks like MYSQL_OPT_SSL_VERIFY_SERVER_CERT is enabled by default

Perhaps https://github.com/mydumper/mydumper/blob/v0.16.11-1/src/connection.c#L179-L180 needs to handle disablement:

      else if (g_ascii_strncasecmp(ssl_mode, "VERIFY_IDENTITY", 16) == 0) {
        mysql_options(conn, MYSQL_OPT_SSL_VERIFY_SERVER_CERT, &enable);

@cho-m
Copy link
Member

cho-m commented Nov 30, 2024

To check if it is due to latter, you can try building mariadb-connector-c with old default:

diff --git a/Formula/m/mariadb-connector-c.rb b/Formula/m/mariadb-connector-c.rb
index 874b813f3fd..b2288b108a3 100644
--- a/Formula/m/mariadb-connector-c.rb
+++ b/Formula/m/mariadb-connector-c.rb
@@ -52,6 +52,7 @@ class MariadbConnectorC < Formula
       -DWITH_EXTERNAL_ZLIB=ON
       -DWITH_MYSQLCOMPAT=ON
       -DWITH_UNIT_TESTS=OFF
+      -DDEFAULT_SSL_VERIFY_SERVER_CERT=OFF
     ]

     system "cmake", "-S", ".", "-B", "build", *args, *std_cmake_args

If this works, MyDumper needs a fix to work with default behavior of recent MariaDB.

Will help outside Homebrew too as MariaDB library is the default used by most distros/repositories (e.g. Arch Linux, Debian, and Fedora)

@webflo
Copy link
Author

webflo commented Dec 1, 2024

@cho-m Thanks for your help! I have tried to build the unmodified mariadb-connector-c formula. But I could not build. I did not understand the error message. https://gist.github.com/webflo/a250754226730080c383f72baee00f00

@cho-m
Copy link
Member

cho-m commented Dec 3, 2024

But I could not build. I did not understand the error message. https://gist.github.com/webflo/a250754226730080c383f72baee00f00

Not too sure on error. I locally built on a similar setup (ARM macOS, Sequoia) and don't see error on assembly code.


Could try patching mydumper instead. Haven't tested, but something like following may override the default:

diff --git a/src/connection.c b/src/connection.c
index 4ddcf0d..efc9978 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -187,6 +187,10 @@ void configure_connection(MYSQL *conn) {
         m_critical("Unsupported ssl-mode specified: %s\n", ssl_mode);
       }
   }
+  else {
+      enable= 0;
+      mysql_options(conn, MYSQL_OPT_SSL_VERIFY_SERVER_CERT, &enable);
+  }
 #else
   unsigned int i;
   if (ssl) {

Can try in the formula like:

diff --git a/Formula/m/mydumper.rb b/Formula/m/mydumper.rb
index 8540d52b3ec..ab1aeaa2cbd 100644
--- a/Formula/m/mydumper.rb
+++ b/Formula/m/mydumper.rb
@@ -27,6 +27,8 @@ class Mydumper < Formula
   depends_on "mariadb-connector-c"
   depends_on "pcre"
 
+  patch :DATA
+
   def install
     # Avoid installing config into /etc
     inreplace "CMakeLists.txt", "/etc", etc
@@ -43,3 +45,20 @@ class Mydumper < Formula
     system bin/"mydumper", "--help"
   end
 end
+
+__END__
+diff --git a/src/connection.c b/src/connection.c
+index 4ddcf0d..efc9978 100644
+--- a/src/connection.c
++++ b/src/connection.c
+@@ -187,6 +187,10 @@ void configure_connection(MYSQL *conn) {
+         m_critical("Unsupported ssl-mode specified: %s\n", ssl_mode);
+       }
+   }
++  else {
++      enable= 0;
++      mysql_options(conn, MYSQL_OPT_SSL_VERIFY_SERVER_CERT, &enable);
++  }
+ #else
+   unsigned int i;
+   if (ssl) {

Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot added the stale No recent activity label Dec 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Reproducible Homebrew/homebrew-core bug stale No recent activity
Projects
None yet
Development

No branches or pull requests

2 participants