]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1851354: blocklist MySQL 8+, offer MariaDB (#143)
authorDave Miller <justdave@bugzilla.org>
Sun, 28 Apr 2024 04:44:26 +0000 (00:44 -0400)
committerGitHub <noreply@github.com>
Sun, 28 Apr 2024 04:44:26 +0000 (00:44 -0400)
Bugzilla/Constants.pm
Bugzilla/DB.pm
Bugzilla/Install/Requirements.pm
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 a6dedc969beab1b74f9619927ade6dcdc7693d89..4d9679c78ca181823f28dedb8a36b81b92bfb36d 100644 (file)
@@ -540,7 +540,16 @@ 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', name => 'MySQL'},
+  # We blocklist MySQL 8.0 and newer, and explicitly list MariaDB as an
+  # alternative. The db_blklst_str is shown in the auto-generated release notes
+  # instead of the regexp. We can't tell Maria apart from MySQL in our check
+  # and MariaDB skipped versions from 5 to 10, so we'll blocklist 8 and 9 for
+  # MariaDB as well just in case someone configured for 'mariadb' but actually
+  # has MySQL installed. See https://bugzilla.mozilla.org/show_bug.cgi?id=1851354
+  mysql => {db => 'Bugzilla::DB::Mysql', db_version => '5.0.15', name => 'MySQL',
+            db_blocklist => ['^[89]\.'], db_blklst_str => '>= 8.0'},
+  mariadb => {db => 'Bugzilla::DB::Mysql', db_version => '5.1', name => 'MariaDB',
+            db_blocklist => ['^[89]\.']},
   pg =>
     {db => 'Bugzilla::DB::Pg', db_version => '9.00.0000', name => 'PostgreSQL'},
   oracle =>
index be692cc8fc6d8ff99456c1916242bb2bbde0647f..cb9557a0a3ab4e687fc825cb7873e6352a52c176 100644 (file)
@@ -187,7 +187,13 @@ 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) {
@@ -195,12 +201,22 @@ sub bz_check_server_version {
       package => $sql_server,
       wanted  => $sql_want,
       found   => $sql_vers,
-      ok      => $version_ok
+      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 0127df103691b7bd0cb03e6726069f479d258468..fbd74b320fc74625c6660d4c646b16f91ce2a577 100644 (file)
@@ -296,8 +296,8 @@ sub check_font_file {
 
 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') : '';
 
@@ -325,10 +325,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 ? "$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",
     (' ' x $checking_for_indent) . install_string('checking_for'), $package,
     "($want_string)";
   print $ok ? $str : colored($str, COLOR_ERROR);
index 86b9ca517de271cc15a24533a97fb86543849034..472899a75cf8bd523f689b51b27d046a6bc78364 100644 (file)
@@ -90,7 +90,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 cf8de66287eb758a5a2c33ec8d5449fb5c06c8f9..a0307ab1b09176e58f10bb7340cafbda8792caad 100644 (file)
@@ -123,10 +123,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");
     }
 
     # Forbid cgi.param(). cgi_param() must be used instead.
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 095a439078930a29c442e240cf18a7be98bdc80d..0a19f478881f32e9b38a879fcf114845f623f048 100644 (file)
@@ -32,7 +32,7 @@ END
 The file ##file## must point to a TrueType or OpenType font file
 (its extension must be .ttf or .otf).
 END
-  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