Unverified Commit 93c67e40 authored by Vladimír Čunát's avatar Vladimír Čunát
Browse files

mysql80: 8.0.42 -> 8.0.43, mysql84: 8.4.5 -> 8.4.6 (#428270)

parents bc104307 8608f6e7
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -27,11 +27,11 @@

stdenv.mkDerivation (finalAttrs: {
  pname = "mysql";
  version = "8.4.5";
  version = "8.4.6";

  src = fetchurl {
    url = "https://dev.mysql.com/get/Downloads/MySQL-${lib.versions.majorMinor finalAttrs.version}/mysql-${finalAttrs.version}.tar.gz";
    hash = "sha256-U2OVkqcgpxn9+t8skhuUfqyGwG4zMgLkdmeFKleBvRo=";
    hash = "sha256-oeUj3IvpbRilreEGmYZhKFygG29bRsCLJlQRDkDfL7c=";
  };

  nativeBuildInputs = [
+2 −10
Original line number Diff line number Diff line
@@ -2,7 +2,6 @@
  lib,
  stdenv,
  fetchurl,
  fetchpatch,
  bison,
  cmake,
  pkg-config,
@@ -31,11 +30,11 @@

stdenv.mkDerivation (finalAttrs: {
  pname = "mysql";
  version = "8.0.42";
  version = "8.0.43";

  src = fetchurl {
    url = "https://dev.mysql.com/get/Downloads/MySQL-${lib.versions.majorMinor finalAttrs.version}/mysql-${finalAttrs.version}.tar.gz";
    hash = "sha256-XrIsIMILdlxYlMkBBIW9B9iptuv7YovP0wYHAXFVJv4=";
    hash = "sha256-diUKgQFch49iUhz68w3/DqmyUJeNKx3/AHQIo5jV25M=";
  };

  nativeBuildInputs = [
@@ -48,13 +47,6 @@ stdenv.mkDerivation (finalAttrs: {

  patches = [
    ./no-force-outline-atomics.patch # Do not force compilers to turn on -moutline-atomics switch
    # Fix compilation with LLVM 19, adapted from https://github.com/mysql/mysql-server/commit/3a51d7fca76e02257f5c42b6a4fc0c5426bf0421
    # in https://github.com/NixOS/nixpkgs/pull/374591#issuecomment-2615855076
    ./libcpp-fixes.patch
    (fetchpatch {
      url = "https://github.com/mysql/mysql-server/commit/4a5c00d26f95faa986ffed7a15ee15e868e9dcf2.patch";
      hash = "sha256-MEl1lQlDYtFjHk0+S02RQFnxMr+YeFxAyNjpDtVHyeE=";
    })
  ];

  ## NOTE: MySQL upstream frequently twiddles the invocations of libtool. When updating, you might proactively grep for libtool references.
+0 −183
Original line number Diff line number Diff line
diff --git a/include/my_char_traits.h b/include/my_char_traits.h
new file mode 100644
index 00000000..6336bc03
--- /dev/null
+++ b/include/my_char_traits.h
@@ -0,0 +1,65 @@
+/* Copyright (c) 2024, Oracle and/or its affiliates.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License, version 2.0,
+   as published by the Free Software Foundation.
+
+   This program is designed to work with certain software (including
+   but not limited to OpenSSL) that is licensed under separate terms,
+   as designated in a particular file or component or in included license
+   documentation.  The authors of MySQL hereby grant you an additional
+   permission to link the program and your derivative works with the
+   separately licensed software that they have either included with
+   the program or referenced in the documentation.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License, version 2.0, for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
+
+#ifndef MY_CHAR_TRAITS_INCLUDED
+#define MY_CHAR_TRAITS_INCLUDED
+
+#include <cstring>
+
+template <class CharT>
+struct my_char_traits;
+
+/*
+  This is a standards-compliant, drop-in replacement for
+    std::char_traits<unsigned char>
+  We need this because clang libc++ is removing support for it in clang 19.
+  It is not a complete implementation. Rather we implement just enough to
+  compile any usage of char_traits<uchar> we have in our codebase.
+ */
+template <>
+struct my_char_traits<unsigned char> {
+  using char_type = unsigned char;
+  using int_type = unsigned int;
+
+  static void assign(char_type &c1, const char_type &c2) { c1 = c2; }
+
+  static char_type *assign(char_type *s, std::size_t n, char_type a) {
+    return static_cast<char_type *>(memset(s, a, n));
+  }
+
+  static int compare(const char_type *s1, const char_type *s2, std::size_t n) {
+    return memcmp(s1, s2, n);
+  }
+
+  static char_type *move(char_type *s1, const char_type *s2, std::size_t n) {
+    if (n == 0) return s1;
+    return static_cast<char_type *>(memmove(s1, s2, n));
+  }
+
+  static char_type *copy(char_type *s1, const char_type *s2, std::size_t n) {
+    if (n == 0) return s1;
+    return static_cast<char_type *>(memcpy(s1, s2, n));
+  }
+};
+
+#endif  // MY_CHAR_TRAITS_INCLUDED
diff --git a/sql/mdl_context_backup.h b/sql/mdl_context_backup.h
index 89e7e23d..cf9c307e 100644
--- a/sql/mdl_context_backup.h
+++ b/sql/mdl_context_backup.h
@@ -28,6 +28,7 @@
 #include <map>
 #include <memory>
 
+#include "my_char_traits.h"
 #include "sql/malloc_allocator.h"
 #include "sql/mdl.h"
 
@@ -47,7 +48,8 @@ class MDL_context_backup_manager {
   /**
     Key for uniquely identifying MDL_context in the MDL_context_backup map.
   */
-  typedef std::basic_string<uchar> MDL_context_backup_key;
+  using MDL_context_backup_key =
+      std::basic_string<uchar, my_char_traits<uchar>>;
 
   class MDL_context_backup;
 
diff --git a/sql/stream_cipher.h b/sql/stream_cipher.h
index 606d4064..358fbb41 100644
--- a/sql/stream_cipher.h
+++ b/sql/stream_cipher.h
@@ -28,6 +28,8 @@
 #include <memory>
 #include <string>
 
+#include "my_char_traits.h"
+
 /**
   @file stream_cipher.h
 
@@ -35,7 +37,8 @@
          binary log files.
 */
 
-typedef std::basic_string<unsigned char> Key_string;
+using Key_string =
+    std::basic_string<unsigned char, my_char_traits<unsigned char>>;
 
 /**
   @class Stream_cipher
diff --git a/unittest/gunit/binlogevents/transaction_compression-t.cc b/unittest/gunit/binlogevents/transaction_compression-t.cc
index ba13f979..01af0e3a 100644
--- a/unittest/gunit/binlogevents/transaction_compression-t.cc
+++ b/unittest/gunit/binlogevents/transaction_compression-t.cc
@@ -23,6 +23,7 @@
 */
 
 #include <array>
+#include <string>
 
 #include <gtest/gtest.h>
 #include "libbinlogevents/include/binary_log.h"
@@ -51,14 +52,13 @@ class TransactionPayloadCompressionTest : public ::testing::Test {
   using Managed_buffer_t = Decompressor_t::Managed_buffer_t;
   using Size_t = Decompressor_t::Size_t;
   using Char_t = Decompressor_t::Char_t;
-  using String_t = std::basic_string<Char_t>;
   using Decompress_status_t =
       binary_log::transaction::compression::Decompress_status;
   using Compress_status_t =
       binary_log::transaction::compression::Compress_status;
 
-  static String_t constant_data(Size_t size) {
-    return String_t(size, (Char_t)'a');
+  static std::string constant_data(Size_t size) {
+    return std::string(size, (Char_t)'a');
   }
 
  protected:
@@ -69,7 +69,7 @@ class TransactionPayloadCompressionTest : public ::testing::Test {
   void TearDown() override {}
 
   static void compression_idempotency_test(Compressor_t &c, Decompressor_t &d,
-                                           String_t data) {
+                                           const std::string &data) {
     auto debug_string = concat(
         binary_log::transaction::compression::type_to_string(c.get_type_code()),
         " ", data.size());
@@ -104,8 +104,8 @@ class TransactionPayloadCompressionTest : public ::testing::Test {
 
     // Check decompressed data
     ASSERT_EQ(managed_buffer.read_part().size(), data.size()) << debug_string;
-    ASSERT_EQ(data, String_t(managed_buffer.read_part().begin(),
-                             managed_buffer.read_part().end()))
+    ASSERT_EQ(data, std::string(managed_buffer.read_part().begin(),
+                                managed_buffer.read_part().end()))
         << debug_string;
 
     // Check that we reached EOF
@@ -118,7 +118,7 @@ TEST_F(TransactionPayloadCompressionTest, CompressDecompressZstdTest) {
   for (auto size : buffer_sizes) {
     binary_log::transaction::compression::Zstd_dec d;
     binary_log::transaction::compression::Zstd_comp c;
-    String_t data{TransactionPayloadCompressionTest::constant_data(size)};
+    std::string data{TransactionPayloadCompressionTest::constant_data(size)};
     TransactionPayloadCompressionTest::compression_idempotency_test(c, d, data);
     c.set_compression_level(22);
     TransactionPayloadCompressionTest::compression_idempotency_test(c, d, data);
@@ -129,7 +129,7 @@ TEST_F(TransactionPayloadCompressionTest, CompressDecompressNoneTest) {
   for (auto size : buffer_sizes) {
     binary_log::transaction::compression::None_dec d;
     binary_log::transaction::compression::None_comp c;
-    String_t data{TransactionPayloadCompressionTest::constant_data(size)};
+    std::string data{TransactionPayloadCompressionTest::constant_data(size)};
     TransactionPayloadCompressionTest::compression_idempotency_test(c, d, data);
   }
 }
 No newline at end of file