rubygem-mysql2/rubygem-mysql2-0.5.4-use-ssl-pem-files-in-repo.patch
Jun Aruga c33b1cff59 Fix the broken SSL tests with MariaDB 10.5.18.
This commit fixes the broken SSL tests below.

The rubygem-mysql2 build started to fail with the error below by the `mysql`
that can't connect to the MariaDB server, when a dependency mariadb was upgraded
from the version 3:10.5.16-3.fc37 to 3:10.5.18-1.fc38.
https://koschei.fedoraproject.org/build/14086115

build.log
~~~
+ /usr/libexec/mysqld --datadir=/builddir/build/BUILD/mysql2-0.5.4/usr/share/gems/gems/mysql2-0.5.4/data --log-error=/builddir/build/BUILD/mysql2-0.5.4/usr/share/gems/gems/mysql2-0.5.4/mysql.log --socket=/builddir/build/BUILD/mysql2-0.5.4/usr/share/gems/gems/mysql2-0.5.4/mysql.sock --pid-file=/builddir/build/BUILD/mysql2-0.5.4/usr/share/gems/gems/mysql2-0.5.4/mysql.pid --port=13471 --ssl
++ seq 10
+ for i in $(seq 10)
+ sleep 1
2022-11-17 11:20:48 0 [Note] /usr/libexec/mysqld (mysqld 10.5.18-MariaDB) starting as process 1297 ...
+ grep -q 'ready for connections.' /builddir/build/BUILD/mysql2-0.5.4/usr/share/gems/gems/mysql2-0.5.4/mysql.log
+ echo 'Waiting connections... 1'
...
+ echo 'Waiting connections... 10'
Waiting connections... 10
+ mysql -u mockbuild -e 'ALTER USER '\''root'\''@'\''localhost'\'' IDENTIFIED VIA mysql_native_password USING PASSWORD('\'''\'')' -S /builddir/build/BUILD/mysql2-0.5.4/usr/share/gems/gems/mysql2-0.5.4/mysql.sock -P 13471
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/builddir/build/BUILD/mysql2-0.5.4/usr/share/gems/gems/mysql2-0.' (2)
~~~

After Michal Schorm <mschorm@redhat.com>'s investigation (thanks!), we found
the error comes from the not appropriate SSL configurations.

It was reported that in Fedora, the MariaDB 10.5.16 used downstream OpenSSL 3
patch, and the MariaDB 10.5.18 started to use upstream OpenSSL 3 patch.
And there are some differences between these two patch files. And the difference
triggered this issue.
See also <https://github.com/brianmario/mysql2/pull/1290>.

I also applied a patch to use the SSL pem files in the spec directory directly
to run the SSL tests. Because we can't set up the files in the `/etc/mysql`.
See also <https://github.com/brianmario/mysql2/pull/1293>.

I also regenerated the SSL certification files from the localhost. It requires
openssl as a build dependency. This is a temporary workaround. It is expected
that the certification files are managed in the upstream repository.
See also <https://github.com/brianmario/mysql2/pull/1296>.

Resolves: rhbz#2144488
2022-12-23 18:25:12 +01:00

30 lines
1.0 KiB
Diff

From 06512d47dc1491bf5686b2bd89a8555de9f2acc9 Mon Sep 17 00:00:00 2001
From: Jun Aruga <jaruga@redhat.com>
Date: Thu, 22 Dec 2022 16:14:39 +0100
Subject: [PATCH] Use the SSL pem files in the Git repository.
---
spec/mysql2/client_spec.rb | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/spec/mysql2/client_spec.rb b/spec/mysql2/client_spec.rb
index 5861882..3f5cda8 100644
--- a/spec/mysql2/client_spec.rb
+++ b/spec/mysql2/client_spec.rb
@@ -153,9 +153,9 @@ RSpec.describe Mysql2::Client do # rubocop:disable Metrics/BlockLength
let(:option_overrides) do
{
'host' => 'mysql2gem.example.com', # must match the certificates
- :sslkey => '/etc/mysql/client-key.pem',
- :sslcert => '/etc/mysql/client-cert.pem',
- :sslca => '/etc/mysql/ca-cert.pem',
+ :sslkey => 'spec/ssl/client-key.pem',
+ :sslcert => 'spec/ssl/client-cert.pem',
+ :sslca => 'spec/ssl/ca-cert.pem',
:sslcipher => 'DHE-RSA-AES256-SHA',
:sslverify => true,
}
--
2.38.1