]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1851354: blocklist MySQL 8+, offer MariaDB (#141)
authorDave Miller <justdave@bugzilla.org>
Sun, 28 Apr 2024 04:47:08 +0000 (00:47 -0400)
committerGitHub <noreply@github.com>
Sun, 28 Apr 2024 04:47:08 +0000 (00:47 -0400)
Bugzilla/Constants.pm
Bugzilla/DB.pm
Bugzilla/Install/Requirements.pm
Build.PL
docs/en/rst/installing/essential-post-install-config.rst
t/004template.t
template/en/default/config.js.tmpl
template/en/default/setup/strings.txt.pl

index edaa8baa5b20b17f27d533ec028b578fc60ce6c2..45cbefe74b12b3afb504950fa5ee49937934043e 100644 (file)
@@ -508,16 +508,42 @@ use constant INSTALLATION_MODE_NON_INTERACTIVE => 1;
 use constant DB_MODULE => {
     # MySQL 5.0.15 was the first production 5.0.x release.
     'mysql' => {db => 'Bugzilla::DB::Mysql', db_version => '5.0.15',
-                dbd => { 
+                db_blocklist => ['^[89]\.'],
+                # the following is a "human-readable" version to show in the
+                # release notes
+                db_blklst_str => '>= 8.0',
+                dbd => {
                     package => 'DBD-mysql',
                     module  => 'DBD::mysql',
                     # Disallow development versions
-                    blacklist => ['_'],
+                    blocklist => ['_'],
                     # For UTF-8 support. 4.001 makes sure that blobs aren't
                     # marked as UTF-8.
                     version => '4.001',
                 },
                 name => 'MySQL'},
+
+    # MariaDB is a drop-in replacement for MySQL and works with Bugzilla
+    'mariadb' => {db => 'Bugzilla::DB::Mysql', db_version => '5.1',
+                  # MariaDB is indistinguishable from MySQL, but skipped 8 and
+                  # 9 so blocklist it anyway in case someone has the driver set
+                  # to mariadb but actually has MySQL.
+                  db_blocklist => ['^[89]\.'],
+                  # no string to show the user on the release notes though.
+                  dbd        => {
+                    package => 'DBD-mysql',
+                    module  => 'DBD::mysql',
+
+                    # Disallow development versions
+                    blocklist => ['_'],
+
+                    # For UTF-8 support. 4.001 makes sure that blobs aren't
+                    # marked as UTF-8.
+                    version => '4.001',
+                  },
+                  name => 'MariaDB'
+    },
+
     # Also see Bugzilla::DB::Pg::bz_check_server_version, which has special
     # code to require DBD::Pg 2.17.2 for PostgreSQL 9 and above.
     'pg'    => {db => 'Bugzilla::DB::Pg', db_version => '8.03.0000',
index 5bc83f9d6ab75dee945ecacdf9bfa759fa3b807f..f59a32feb8fc8816f5894061b6b3b5afe644e675 100644 (file)
@@ -204,17 +204,33 @@ sub bz_check_server_version {
     $self->disconnect;
 
     my $sql_want = $db->{db_version};
+    my $sql_dontwant = exists $db->{db_blocklist} ? $db->{db_blocklist} : [];
     my $version_ok = vers_cmp($sql_vers, $sql_want) > -1 ? 1 : 0;
+    my $blocklisted;
+    if ($version_ok) {
+        $blocklisted = grep($sql_vers =~ /$_/, @$sql_dontwant);
+        $version_ok = 0 if $blocklisted;
+    }
 
     my $sql_server = $db->{name};
     if ($output) {
         Bugzilla::Install::Requirements::_checking_for({
             package => $sql_server, wanted => $sql_want,
-            found   => $sql_vers, ok => $version_ok });
+            found   => $sql_vers, ok => $version_ok,
+            blocklisted => $blocklisted });
     }
 
     # Check what version of the database server is installed and let
     # the user know if the version is too old to be used with Bugzilla.
+    if ($blocklisted) {
+        die <<EOT;
+
+Your $sql_server v$sql_vers is blocklisted. Please check the
+release notes for details or try a different database engine
+or version.
+
+EOT
+    }
     if (!$version_ok) {
         die <<EOT;
 
index 3022cea3bc386394c0714ad534bc1d5137bd5ebb..a7fe4f7ebdbc39ee04f6e1116ee8d72a1db6a598 100644 (file)
@@ -78,8 +78,8 @@ use constant APACHE_PATH => [qw(
 # installed or not. "version" is the version we need, or 0 if we'll accept
 # any version.
 #
-# "blacklist" is an arrayref of regular expressions that describe versions that
-# are 'blacklisted'--that is, even if the version is high enough, Bugzilla
+# "blocklist" is an arrayref of regular expressions that describe versions that
+# are 'blocklisted'--that is, even if the version is high enough, Bugzilla
 # will refuse to say that it's OK to run with that version.
 sub REQUIRED_MODULES {
     my @modules = (
@@ -288,7 +288,7 @@ sub OPTIONAL_MODULES {
         # throwing warnings with Perl 5.12.
         version => '0.712',
         # SOAP::Transport::HTTP 1.12 is bogus.
-        blacklist => ['^1\.12$'],
+        blocklist => ['^1\.12$'],
         feature => ['xmlrpc'],
     },
     # Since SOAP::Lite 1.0, XMLRPC::Lite is no longer included
@@ -731,16 +731,16 @@ sub have_vers {
 
     # Must do a string comparison as $vnum may be of the form 5.10.1.
     my $vok = ($vnum ne '-1' && version->new($vnum) >= version->new($wanted)) ? 1 : 0;
-    my $blacklisted;
-    if ($vok && $params->{blacklist}) {
-        $blacklisted = grep($vnum =~ /$_/, @{$params->{blacklist}});
-        $vok = 0 if $blacklisted;
+    my $blocklisted;
+    if ($vok && $params->{blocklist}) {
+        $blocklisted = grep($vnum =~ /$_/, @{$params->{blocklist}});
+        $vok = 0 if $blocklisted;
     }
 
     if ($output) {
         _checking_for({ 
             package => $package, ok => $vok, wanted => $wanted,
-            found   => $vnum, blacklisted => $blacklisted
+            found   => $vnum, blocklisted => $blocklisted
         });
     }
     
@@ -749,8 +749,8 @@ sub have_vers {
 
 sub _checking_for {
     my ($params) = @_;
-    my ($package, $ok, $wanted, $blacklisted, $found) = 
-        @$params{qw(package ok wanted blacklisted found)};
+    my ($package, $ok, $wanted, $blocklisted, $found) =
+        @$params{qw(package ok wanted blocklisted found)};
 
     my $ok_string = $ok ? install_string('module_ok') : '';
 
@@ -777,10 +777,10 @@ sub _checking_for {
         $ok_string = install_string('module_not_found');
     }
 
-    my $black_string = $blacklisted ? install_string('blacklisted') : '';
+    my $block_string = $blocklisted ? install_string('blocklisted') : '';
     my $want_string  = $wanted ? "v$wanted" : install_string('any');
 
-    my $str = sprintf "%s %20s %-11s $ok_string $black_string\n",
+    my $str = sprintf "%s %20s %-11s $ok_string $block_string\n",
                 install_string('checking_for'), $package, "($want_string)";
     print $ok ? $str : colored($str, COLOR_ERROR);
 }
index 024a5602481b71245ca7a4c82ca8b445ee7f67ba..0a7c1059a2ffe7ba886301e50db3dc10bd0e55c7 100644 (file)
--- a/Build.PL
+++ b/Build.PL
@@ -33,10 +33,10 @@ sub build_requires {
 
 sub recommends {
     my $recommends = OPTIONAL_MODULES();
-    my @blacklist = ('Apache-SizeLimit', 'mod_perl'); # Does not compile properly on Travis
+    my @blocklist = ('Apache-SizeLimit', 'mod_perl'); # Does not compile properly on Travis
     my $hrecommends = {};
     foreach my $module (@$recommends) {
-        next if grep($_ eq $module->{package}, @blacklist);
+        next if grep($_ eq $module->{package}, @blocklist);
         $hrecommends->{$module->{module}} = $module->{version};
     }
     return $hrecommends;
index 1b9fd6b94a8b8063ecee4d87c45256f6ec192cdc..51ff5871968f97141dca218348f3b00ba855355f 100644 (file)
@@ -94,7 +94,7 @@ This section corresponds to choosing a :param:`mail_delivery_method` of
 :paramval:`Sendmail`.
 
 Unless you know what you are doing, and can deal with the possible problems
-of spam, bounces and blacklists, it is probably unwise to set up your own
+of spam, bounces and blocklists, it is probably unwise to set up your own
 mail server just for Bugzilla. However, if you wish to do so, some guidance
 follows.
 
index 760d39ac8573194aa7ba211edf1cfaffd3b18fcd..f336441aca13a018cec0a2403a6e15af12e87218 100644 (file)
@@ -114,10 +114,10 @@ foreach my $include_path (@include_paths) {
 
         # Forbid single quotes to delimit URLs, see bug 926085.
         if ($data =~ /href=\\?'/) {
-            ok(0, "$path contains blacklisted constructs: href='...'");
+            ok(0, "$path contains blocklisted constructs: href='...'");
         }
         else {
-            ok(1, "$path contains no blacklisted constructs");
+            ok(1, "$path contains no blocklisted constructs");
         }
     }
 }
index 0399f8b28691f6325f28bc94e903953353f4f018..0e924d80167b6cdc82a27f9074389e7d409eeb0e 100644 (file)
@@ -64,7 +64,7 @@ var [% cf.name FILTER js %] = [ [% FOREACH x = cf.legal_values %]'[% x.name FILT
 // =======================
 //
 // It is not necessary to list all products and components here.
-// Instead, you can define a "blacklist" for some commonly used words
+// Instead, you can define a "blocklist" for some commonly used words
 // or word fragments that occur in a product or component name
 // but should _not_ trigger product/component search.
 
@@ -84,7 +84,7 @@ var target_milestone = new Object();
 // Product and Component Exceptions
 // ================================
 //
-// A blacklist for some commonly used words or word fragments 
+// A blocklist for some commonly used words or word fragments
 // that occur in a product or component name but should *not*
 // trigger product/component search in QuickSearch.
 
index 78c4d861bd42056420299419f5eb940eab9e1094..202b3c78da0af1a36f89a5590dcc445626c84d2c 100644 (file)
@@ -23,7 +23,7 @@ happens when you are not running checksetup.pl as ##root##. To see the
 problem we ran into, run: ##command##
 END
     bad_executable => 'not a valid executable: ##bin##',
-    blacklisted => '(blacklisted)',
+    blocklisted => '(blocklisted)',
     bz_schema_exists_before_220 => <<'END',
 You are upgrading from a version before 2.20, but the bz_schema table
 already exists. This means that you restored a mysqldump into the Bugzilla