summaryrefslogtreecommitdiffstats
path: root/debian/patches
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--debian/patches/0025-Change-the-default-optimization-from-O3-to-O2-in-mys.patch54
-rw-r--r--debian/patches/2129-new-script-wsrep-sst-backup-fixes.patch51
-rw-r--r--debian/patches/2541-fix-stack-overflow-in-pinbox-allocator.patch283
-rw-r--r--debian/patches/2777-fix-disks-disk-test.patch78
-rw-r--r--debian/patches/2883-subselect-test-failures.patch323
-rw-r--r--debian/patches/2980-riscv-use-rdtime.patch59
-rw-r--r--debian/patches/env-perl-usr-bin-perl.patch99
-rw-r--r--debian/patches/fix-reproducible-builds-rocksdb.patch26
-rw-r--r--debian/patches/fix-spelling-libmariadb.patch155
-rw-r--r--debian/patches/fix-spelling-libmarias3.patch73
-rw-r--r--debian/patches/fix-spelling-rocksdb.patch38
-rw-r--r--debian/patches/mroonga-mrn-lib-dirs-path-reproducible-build.patch39
-rw-r--r--debian/patches/rocksdb-kfreebsd.patch150
-rw-r--r--debian/patches/series13
14 files changed, 1441 insertions, 0 deletions
diff --git a/debian/patches/0025-Change-the-default-optimization-from-O3-to-O2-in-mys.patch b/debian/patches/0025-Change-the-default-optimization-from-O3-to-O2-in-mys.patch
new file mode 100644
index 00000000..77ced337
--- /dev/null
+++ b/debian/patches/0025-Change-the-default-optimization-from-O3-to-O2-in-mys.patch
@@ -0,0 +1,54 @@
+From: Ondrej Sury <ondrej@debian.org>
+Date: Wed, 22 Nov 2017 20:32:51 +0000
+Subject: Change the default optimization from -O3 to -O2 in
+ mysql_release.cmake BUILD_CONFIG profile
+Forwarded: https://jira.mariadb.org/browse/MDEV-19734?focusedCommentId=156606&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-156606
+
+---
+ cmake/build_configurations/mysql_release.cmake | 12 ++++++------
+ .../PerconaFT/cmake_modules/TokuSetupCompiler.cmake | 16 ++++++++--------
+ 2 files changed, 14 insertions(+), 14 deletions(-)
+
+--- a/cmake/build_configurations/mysql_release.cmake
++++ b/cmake/build_configurations/mysql_release.cmake
+@@ -174,12 +174,12 @@ IF(UNIX)
+ IF(CMAKE_COMPILER_IS_GNUCC)
+ SET(COMMON_C_FLAGS "-g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -Wno-uninitialized")
+ SET(CMAKE_C_FLAGS_DEBUG "-O ${COMMON_C_FLAGS}")
+- SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 ${COMMON_C_FLAGS}")
++ SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 ${COMMON_C_FLAGS}")
+ ENDIF()
+ IF(CMAKE_COMPILER_IS_GNUCXX)
+ SET(COMMON_CXX_FLAGS "-g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -Wno-uninitialized")
+ SET(CMAKE_CXX_FLAGS_DEBUG "-O ${COMMON_CXX_FLAGS}")
+- SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 ${COMMON_CXX_FLAGS}")
++ SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 ${COMMON_CXX_FLAGS}")
+ ENDIF()
+
+ # IBM Z flags
+@@ -228,8 +228,8 @@ IF(UNIX)
+ ENDIF()
+ SET(CMAKE_C_FLAGS_DEBUG "${COMMON_C_FLAGS}")
+ SET(CMAKE_CXX_FLAGS_DEBUG "${COMMON_CXX_FLAGS}")
+- SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -unroll2 -ip ${COMMON_C_FLAGS}")
+- SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -unroll2 -ip ${COMMON_CXX_FLAGS}")
++ SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -unroll2 -ip ${COMMON_C_FLAGS}")
++ SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -unroll2 -ip ${COMMON_CXX_FLAGS}")
+ SET(WITH_SSL no)
+ ENDIF()
+ ENDIF()
+@@ -238,12 +238,12 @@ IF(UNIX)
+ IF(CMAKE_C_COMPILER_ID MATCHES "Clang")
+ SET(COMMON_C_FLAGS "-g -fno-omit-frame-pointer -fno-strict-aliasing -Wno-parentheses-equality -Wno-string-plus-int")
+ SET(CMAKE_C_FLAGS_DEBUG "${COMMON_C_FLAGS}")
+- SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 ${COMMON_C_FLAGS}")
++ SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 ${COMMON_C_FLAGS}")
+ ENDIF()
+ IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+ SET(COMMON_CXX_FLAGS "-g -fno-omit-frame-pointer -fno-strict-aliasing -Wno-parentheses-equality -Wno-string-plus-int")
+ SET(CMAKE_CXX_FLAGS_DEBUG "${COMMON_CXX_FLAGS}")
+- SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 ${COMMON_CXX_FLAGS}")
++ SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 ${COMMON_CXX_FLAGS}")
+ ENDIF()
+
+ # Solaris flags
diff --git a/debian/patches/2129-new-script-wsrep-sst-backup-fixes.patch b/debian/patches/2129-new-script-wsrep-sst-backup-fixes.patch
new file mode 100644
index 00000000..8e49a076
--- /dev/null
+++ b/debian/patches/2129-new-script-wsrep-sst-backup-fixes.patch
@@ -0,0 +1,51 @@
+Forwarded: https://github.com/MariaDB/server/pull/2129
+Origin: https://patch-diff.githubusercontent.com/raw/MariaDB/server/pull/2129.patch
+From: Otto Kekäläinen <otto@kekalainen.net>
+Date: Sun, 22 May 2022 10:13:33 -0700
+Subject: [PATCH] Properly introduce wsrep_sst_backup script in project
+ packaging
+
+The script wsrep_sst_backup was introduced on MariaDB 10.3 in commit
+9b2fa2a. The new script was automatically included in RPM packages but not
+in Debian packages (which started to fail on warning about stray file).
+
+Include wsrep_sst_backup in the mariadb-server-10.{3..8} package, and
+also include a stub man page so that packaging of a new script is complete.
+
+---
+ debian/mariadb-server-10.6.install | 2 ++
+ man/CMakeLists.txt | 2 +-
+ man/wsrep_sst_backup.1 | 16 ++++++++++++++++
+ 3 files changed, 19 insertions(+), 1 deletion(-)
+ create mode 100644 man/wsrep_sst_backup.1
+
+--- a/man/CMakeLists.txt
++++ b/man/CMakeLists.txt
+@@ -13,7 +13,7 @@
+ # along with this program; if not, write to the Free Software
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
+
+-SET(MAN1_WSREP wsrep_sst_rsync.1 wsrep_sst_common.1 wsrep_sst_mariabackup.1
++SET(MAN1_WSREP wsrep_sst_rsync.1 wsrep_sst_common.1 wsrep_sst_mariabackup.1 wsrep_sst_backup.1
+ wsrep_sst_mysqldump.1 wsrep_sst_rsync_wan.1 galera_recovery.1 galera_new_cluster.1)
+ SET(MAN1_SERVER innochecksum.1 myisam_ftdump.1 myisamchk.1
+ aria_chk.1 aria_dump_log.1 aria_ftdump.1 aria_pack.1 aria_read_log.1
+--- /dev/null
++++ b/man/wsrep_sst_backup.1
+@@ -0,0 +1,16 @@
++'\" t
++.\"
++.TH "\FBWSREP_SST_BACKUP\FR" "1" "22 May 2022" "MariaDB 10\&.3" "MariaDB Database System"
++.\" -----------------------------------------------------------------
++.\" * set default formatting
++.\" -----------------------------------------------------------------
++.\" disable hyphenation
++.nh
++.\" disable justification (adjust text to left margin only)
++.ad l
++.SH NAME
++wsrep_sst_backup \- backup helper script for the MariaDB Galera Cluster
++.SH DESCRIPTION
++Use: See source code of script\.
++.PP
++For more information, please refer to the MariaDB Knowledge Base, available online at https://mariadb.com/kb/
diff --git a/debian/patches/2541-fix-stack-overflow-in-pinbox-allocator.patch b/debian/patches/2541-fix-stack-overflow-in-pinbox-allocator.patch
new file mode 100644
index 00000000..82f3b5b1
--- /dev/null
+++ b/debian/patches/2541-fix-stack-overflow-in-pinbox-allocator.patch
@@ -0,0 +1,283 @@
+Forwarded: https://github.com/MariaDB/server/pull/2541
+Origin: https://patch-diff.githubusercontent.com/raw/MariaDB/server/pull/2541.patch
+From: Hugo Wen <wenhug@amazon.com>
+Date: Sat, 11 Mar 2023 00:27:42 +0000
+Subject: [PATCH] Fix a stack overflow in pinbox allocator
+
+MariaDB supports a "wait-free concurrent allocator based on pinning addresses".
+In `lf_pinbox_real_free()` it tries to sort the pinned addresses for better
+performance to use binary search during "real free". `alloca()` was used to
+allocate stack memory and copy addresses.
+
+To prevent a stack overflow when allocating the stack memory the function checks
+if there's enough stack space. However, the available stack size was calculated
+inaccurately which eventually caused database crash due to stack overflow.
+
+The crash was seen on MariaDB 10.6.11 but the same code defect exists on all
+MariaDB versions.
+
+A similar issue happened previously and the fix in fc2c1e43 was to add a
+`ALLOCA_SAFETY_MARGIN` which is 8192 bytes. However, that safety margin is not
+enough during high connection workloads.
+
+MySQL also had a similar issue and the fix
+https://github.com/mysql/mysql-server/commit/b086fda was to remove the use of
+`alloca` and replace qsort approach by a linear scan through all pointers (pins)
+owned by each thread.
+
+This commit is mostly the same as it is the only way to solve this issue as:
+1. Frame sizes in different architecture can be different.
+2. Number of active (non-null) pinned addresses varies, so the frame
+ size for the recursive sorting function `msort_with_tmp` is also hard
+ to predict.
+3. Allocating big memory blocks in stack doesn't seem to be a very good
+ practice.
+
+For further details see the mentioned commit in MySQL and the inline comments.
+
+All new code of the whole pull request, including one or several files
+that are either new files or modified ones, are contributed under the
+BSD-new license. I am contributing on behalf of my employer Amazon Web
+Services, Inc.
+---
+ mysys/lf_alloc-pin.c | 180 ++++++++++++++-----------------------------
+ 1 file changed, 59 insertions(+), 121 deletions(-)
+
+--- a/mysys/lf_alloc-pin.c
++++ b/mysys/lf_alloc-pin.c
+@@ -103,12 +103,6 @@
+ #include <lf.h>
+ #include "my_cpu.h"
+
+-/*
+- when using alloca() leave at least that many bytes of the stack -
+- for functions we might be calling from within this stack frame
+-*/
+-#define ALLOCA_SAFETY_MARGIN 8192
+-
+ #define LF_PINBOX_MAX_PINS 65536
+
+ static void lf_pinbox_real_free(LF_PINS *pins);
+@@ -239,24 +233,21 @@ void lf_pinbox_put_pins(LF_PINS *pins)
+ } while (!my_atomic_cas32((int32 volatile*) &pinbox->pinstack_top_ver,
+ (int32*) &top_ver,
+ top_ver-pins->link+nr+LF_PINBOX_MAX_PINS));
+- return;
+ }
+
+-static int ptr_cmp(void **a, void **b)
++/*
++ Get the next pointer in the purgatory list.
++ Note that next_node is not used to avoid the extra volatile.
++*/
++#define pnext_node(P, X) (*((void **)(((char *)(X)) + (P)->free_ptr_offset)))
++
++static inline void add_to_purgatory(LF_PINS *pins, void *addr)
+ {
+- return *a < *b ? -1 : *a == *b ? 0 : 1;
++ pnext_node(pins->pinbox, addr)= pins->purgatory;
++ pins->purgatory= addr;
++ pins->purgatory_count++;
+ }
+
+-#define add_to_purgatory(PINS, ADDR) \
+- do \
+- { \
+- my_atomic_storeptr_explicit( \
+- (void **)((char *)(ADDR)+(PINS)->pinbox->free_ptr_offset), \
+- (PINS)->purgatory, MY_MEMORY_ORDER_RELEASE); \
+- (PINS)->purgatory= (ADDR); \
+- (PINS)->purgatory_count++; \
+- } while (0)
+-
+ /*
+ Free an object allocated via pinbox allocator
+
+@@ -274,138 +265,85 @@ void lf_pinbox_free(LF_PINS *pins, void
+ lf_pinbox_real_free(pins););
+ }
+
+-struct st_harvester {
+- void **granary;
+- int npins;
++struct st_match_and_save_arg {
++ LF_PINS *pins;
++ LF_PINBOX *pinbox;
++ void *old_purgatory;
+ };
+
+ /*
+- callback forlf_dynarray_iterate:
+- scan all pins of all threads and accumulate all pins
++ Callback for lf_dynarray_iterate:
++ Scan all pins of all threads, for each active (non-null) pin,
++ scan the current thread's purgatory. If present there, move it
++ to a new purgatory. At the end, the old purgatory will contain
++ pointers not pinned by any thread.
+ */
+-static int harvest_pins(LF_PINS *el, struct st_harvester *hv)
++static int match_and_save(LF_PINS *el, struct st_match_and_save_arg *arg)
+ {
+ int i;
+- LF_PINS *el_end= el+MY_MIN(hv->npins, LF_DYNARRAY_LEVEL_LENGTH);
++ LF_PINS *el_end= el + LF_DYNARRAY_LEVEL_LENGTH;
+ for (; el < el_end; el++)
+ {
+ for (i= 0; i < LF_PINBOX_PINS; i++)
+ {
+ void *p= el->pin[i];
+ if (p)
+- *hv->granary++= p;
++ {
++ void *cur= arg->old_purgatory;
++ void **list_prev= &arg->old_purgatory;
++ while (cur)
++ {
++ void *next= pnext_node(arg->pinbox, cur);
++
++ if (p == cur)
++ {
++ /* pinned - keeping */
++ add_to_purgatory(arg->pins, cur);
++ /* unlink from old purgatory */
++ *list_prev= next;
++ }
++ else
++ list_prev= (void **)((char *)cur+arg->pinbox->free_ptr_offset);
++ cur= next;
++ }
++ if (!arg->old_purgatory)
++ return 1;
++ }
+ }
+ }
+- /*
+- hv->npins may become negative below, but it means that
+- we're on the last dynarray page and harvest_pins() won't be
+- called again. We don't bother to make hv->npins() correct
+- (that is 0) in this case.
+- */
+- hv->npins-= LF_DYNARRAY_LEVEL_LENGTH;
+ return 0;
+ }
+
+ /*
+- callback forlf_dynarray_iterate:
+- scan all pins of all threads and see if addr is present there
+-*/
+-static int match_pins(LF_PINS *el, void *addr)
+-{
+- int i;
+- LF_PINS *el_end= el+LF_DYNARRAY_LEVEL_LENGTH;
+- for (; el < el_end; el++)
+- for (i= 0; i < LF_PINBOX_PINS; i++)
+- if (el->pin[i] == addr)
+- return 1;
+- return 0;
+-}
+-
+-#define next_node(P, X) (*((uchar * volatile *)(((uchar *)(X)) + (P)->free_ptr_offset)))
+-#define anext_node(X) next_node(&allocator->pinbox, (X))
+-
+-/*
+ Scan the purgatory and free everything that can be freed
+ */
+ static void lf_pinbox_real_free(LF_PINS *pins)
+ {
+- int npins;
+- void *list;
+- void **addr= NULL;
+- void *first= NULL, *last= NULL;
+- struct st_my_thread_var *var= my_thread_var;
+- void *stack_ends_here= var ? var->stack_ends_here : NULL;
+ LF_PINBOX *pinbox= pins->pinbox;
+
+- npins= pinbox->pins_in_array+1;
++ /* Store info about current purgatory. */
++ struct st_match_and_save_arg arg = {pins, pinbox, pins->purgatory};
++ /* Reset purgatory. */
++ pins->purgatory= NULL;
++ pins->purgatory_count= 0;
+
+-#ifdef HAVE_ALLOCA
+- if (stack_ends_here != NULL)
+- {
+- int alloca_size= sizeof(void *)*LF_PINBOX_PINS*npins;
+- /* create a sorted list of pinned addresses, to speed up searches */
+- if (available_stack_size(&pinbox, stack_ends_here) >
+- alloca_size + ALLOCA_SAFETY_MARGIN)
+- {
+- struct st_harvester hv;
+- addr= (void **) alloca(alloca_size);
+- hv.granary= addr;
+- hv.npins= npins;
+- /* scan the dynarray and accumulate all pinned addresses */
+- lf_dynarray_iterate(&pinbox->pinarray,
+- (lf_dynarray_func)harvest_pins, &hv);
+-
+- npins= (int)(hv.granary-addr);
+- /* and sort them */
+- if (npins)
+- qsort(addr, npins, sizeof(void *), (qsort_cmp)ptr_cmp);
+- }
+- }
+-#endif
+
+- list= pins->purgatory;
+- pins->purgatory= 0;
+- pins->purgatory_count= 0;
+- while (list)
++ lf_dynarray_iterate(&pinbox->pinarray,
++ (lf_dynarray_func)match_and_save, &arg);
++
++ if (arg.old_purgatory)
+ {
+- void *cur= list;
+- list= *(void **)((char *)cur+pinbox->free_ptr_offset);
+- if (npins)
+- {
+- if (addr) /* use binary search */
+- {
+- void **a, **b, **c;
+- for (a= addr, b= addr+npins-1, c= a+(b-a)/2; (b-a) > 1; c= a+(b-a)/2)
+- if (cur == *c)
+- a= b= c;
+- else if (cur > *c)
+- a= c;
+- else
+- b= c;
+- if (cur == *a || cur == *b)
+- goto found;
+- }
+- else /* no alloca - no cookie. linear search here */
+- {
+- if (lf_dynarray_iterate(&pinbox->pinarray,
+- (lf_dynarray_func)match_pins, cur))
+- goto found;
+- }
+- }
+- /* not pinned - freeing */
+- if (last)
+- last= next_node(pinbox, last)= (uchar *)cur;
+- else
+- first= last= (uchar *)cur;
+- continue;
+-found:
+- /* pinned - keeping */
+- add_to_purgatory(pins, cur);
++ /* Some objects in the old purgatory were not pinned, free them. */
++ void *last= arg.old_purgatory;
++ while (pnext_node(pinbox, last))
++ last= pnext_node(pinbox, last);
++ pinbox->free_func(arg.old_purgatory, last, pinbox->free_func_arg);
+ }
+- if (last)
+- pinbox->free_func(first, last, pinbox->free_func_arg);
+ }
+
++#define next_node(P, X) (*((uchar * volatile *)(((uchar *)(X)) + (P)->free_ptr_offset)))
++#define anext_node(X) next_node(&allocator->pinbox, (X))
++
+ /* lock-free memory allocator for fixed-size objects */
+
+ /*
diff --git a/debian/patches/2777-fix-disks-disk-test.patch b/debian/patches/2777-fix-disks-disk-test.patch
new file mode 100644
index 00000000..49b88ef6
--- /dev/null
+++ b/debian/patches/2777-fix-disks-disk-test.patch
@@ -0,0 +1,78 @@
+Forwarded: not-needed
+Origin: https://patch-diff.githubusercontent.com/raw/MariaDB/server/pull/2777.patch
+Bug: https://github.com/MariaDB/server/pull/2777
+From: Daniel Black <daniel@mariadb.org>
+Date: Thu, 5 Oct 2023 16:55:34 +0300
+Subject: [PATCH] MDEV-21587: disk.disk{_notembedded} test result
+
+Allow for a CI system to be almost out of space, or having so
+little use, that the Total space is the same as available or used.
+
+Thanks Otto Kekäläinen for the bug report and testing.
+---
+ plugin/disks/mysql-test/disks/disks.result | 4 ++--
+ plugin/disks/mysql-test/disks/disks.test | 2 +-
+ plugin/disks/mysql-test/disks/disks_notembedded.result | 8 ++++----
+ plugin/disks/mysql-test/disks/disks_notembedded.test | 4 ++--
+ 4 files changed, 9 insertions(+), 9 deletions(-)
+
+--- a/plugin/disks/mysql-test/disks/disks.result
++++ b/plugin/disks/mysql-test/disks/disks.result
+@@ -7,6 +7,6 @@ DISKS CREATE TEMPORARY TABLE `DISKS` (
+ `Used` bigint(32) NOT NULL,
+ `Available` bigint(32) NOT NULL
+ ) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+-select sum(Total) > sum(Available), sum(Total)>sum(Used) from information_schema.disks;
+-sum(Total) > sum(Available) sum(Total)>sum(Used)
++select sum(Total) >= sum(Available), sum(Total)>=sum(Used) from information_schema.disks;
++sum(Total) >= sum(Available) sum(Total)>=sum(Used)
+ 1 1
+--- a/plugin/disks/mysql-test/disks/disks.test
++++ b/plugin/disks/mysql-test/disks/disks.test
+@@ -1,3 +1,3 @@
+ --replace_regex /varchar\([0-9]+\)/varchar(pathlen)/
+ show create table information_schema.disks;
+-select sum(Total) > sum(Available), sum(Total)>sum(Used) from information_schema.disks;
++select sum(Total) >= sum(Available), sum(Total)>=sum(Used) from information_schema.disks;
+--- a/plugin/disks/mysql-test/disks/disks_notembedded.result
++++ b/plugin/disks/mysql-test/disks/disks_notembedded.result
+@@ -6,16 +6,16 @@ CREATE USER user1@localhost;
+ GRANT SELECT ON *.* TO user1@localhost;
+ connect con1,localhost,user1,,;
+ connection con1;
+-select sum(Total) > sum(Available), sum(Total)>sum(Used) from information_schema.disks;
+-sum(Total) > sum(Available) sum(Total)>sum(Used)
++select sum(Total) >= sum(Available), sum(Total) >= sum(Used) from information_schema.disks;
++sum(Total) >= sum(Available) sum(Total) >= sum(Used)
+ NULL NULL
+ disconnect con1;
+ connection default;
+ GRANT FILE ON *.* TO user1@localhost;
+ connect con1,localhost,user1,,;
+ connection con1;
+-select sum(Total) > sum(Available), sum(Total)>sum(Used) from information_schema.disks;
+-sum(Total) > sum(Available) sum(Total)>sum(Used)
++select sum(Total) >= sum(Available), sum(Total) >= sum(Used) from information_schema.disks;
++sum(Total) >= sum(Available) sum(Total) >= sum(Used)
+ 1 1
+ connection default;
+ DROP USER user1@localhost;
+--- a/plugin/disks/mysql-test/disks/disks_notembedded.test
++++ b/plugin/disks/mysql-test/disks/disks_notembedded.test
+@@ -10,7 +10,7 @@ GRANT SELECT ON *.* TO user1@localhost;
+
+ connect (con1,localhost,user1,,);
+ connection con1;
+-select sum(Total) > sum(Available), sum(Total)>sum(Used) from information_schema.disks;
++select sum(Total) >= sum(Available), sum(Total) >= sum(Used) from information_schema.disks;
+ disconnect con1;
+
+ connection default;
+@@ -18,7 +18,7 @@ GRANT FILE ON *.* TO user1@localhost;
+
+ connect (con1,localhost,user1,,);
+ connection con1;
+-select sum(Total) > sum(Available), sum(Total)>sum(Used) from information_schema.disks;
++select sum(Total) >= sum(Available), sum(Total) >= sum(Used) from information_schema.disks;
+ connection default;
+ DROP USER user1@localhost;
diff --git a/debian/patches/2883-subselect-test-failures.patch b/debian/patches/2883-subselect-test-failures.patch
new file mode 100644
index 00000000..d58d8716
--- /dev/null
+++ b/debian/patches/2883-subselect-test-failures.patch
@@ -0,0 +1,323 @@
+Forwarded: https://github.com/MariaDB/server/pull/2883
+Origin: https://patch-diff.githubusercontent.com/raw/MariaDB/server/pull/2883.patch
+Bug: https://jira.mariadb.org/browse/MDEV-32843
+From: Daniel Black <daniel@mariadb.org>
+Date: Thu, 30 Nov 2023 14:14:10 +1100
+Subject: [PATCH] main.subselect* often fails on CI with ER_SUBQUERY_NO_1_ROW
+
+Using mysql.slow_log was a test table would generate more than
+one row if there was more than one row in the table.
+
+Replace this table with a empty table with PK.
+
+Reviewer: Rex Johnston
+---
+ mysql-test/main/subselect.result | 13 ++++++++-----
+ mysql-test/main/subselect.test | 13 ++++++++-----
+ mysql-test/main/subselect_no_exists_to_in.result | 13 ++++++++-----
+ mysql-test/main/subselect_no_mat.result | 13 ++++++++-----
+ mysql-test/main/subselect_no_opts.result | 13 ++++++++-----
+ mysql-test/main/subselect_no_scache.result | 13 ++++++++-----
+ mysql-test/main/subselect_no_semijoin.result | 13 ++++++++-----
+ 7 files changed, 56 insertions(+), 35 deletions(-)
+
+--- a/mysql-test/main/subselect.result
++++ b/mysql-test/main/subselect.result
+@@ -7161,23 +7161,26 @@ drop table t1;
+ #
+ # MDEV-7565: Server crash with Signal 6 (part 2)
+ #
++create table t1 (id int not null primary key);
+ Select
+-(Select Sum(`TestCase`.Revenue) From mysql.slow_log E
+-Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
++(Select Sum(`TestCase`.Revenue) From t1 E
++Where TestCase.TemplateID not in (Select 1 from t1 where 2=2)
+ ) As `ControlRev`
+ From
+ (Select 3 as Revenue, 4 as TemplateID) As `TestCase`
+ Group By TestCase.Revenue, TestCase.TemplateID;
+ ControlRev
+ NULL
++drop table t1;
+ #
+ # MDEV-7445:Server crash with Signal 6
+ #
++create table t1 (id int not null primary key);
+ CREATE PROCEDURE procedure2()
+ BEGIN
+ Select
+-(Select Sum(`TestCase`.Revenue) From mysql.slow_log E
+-Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
++(Select Sum(`TestCase`.Revenue) From t1 E
++Where TestCase.TemplateID not in (Select 1 from t1 where 2=2)
+ ) As `ControlRev`
+ From
+ (Select 3 as Revenue, 4 as TemplateID) As `TestCase`
+@@ -7190,6 +7193,7 @@ call procedure2();
+ ControlRev
+ NULL
+ drop procedure procedure2;
++drop table t1;
+ #
+ # MDEV-7846:Server crashes in Item_subselect::fix
+ #_fields or fails with Thread stack overrun
+--- a/mysql-test/main/subselect.test
++++ b/mysql-test/main/subselect.test
+@@ -1180,8 +1180,10 @@ create table t1 (a int, b decimal(13, 3)
+ insert into t1 values (1, 0.123);
+ let $outfile_abs= $MYSQLTEST_VARDIR/tmp/subselect.out.file.1;
+ let $outfile_rel= ../../tmp/subselect.out.file.1;
++--disable_warnings
+ --error 0,1
+ --remove_file $outfile_abs
++--enable_warnings
+ eval select a, (select max(b) from t1) into outfile "$outfile_rel" from t1;
+ delete from t1;
+ eval load data infile "$outfile_rel" into table t1;
+@@ -6000,24 +6002,28 @@ drop table t1;
+ --echo #
+ --echo # MDEV-7565: Server crash with Signal 6 (part 2)
+ --echo #
++
++create table t1 (id int not null primary key);
+ Select
+- (Select Sum(`TestCase`.Revenue) From mysql.slow_log E
+- Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
++ (Select Sum(`TestCase`.Revenue) From t1 E
++ Where TestCase.TemplateID not in (Select 1 from t1 where 2=2)
+ ) As `ControlRev`
+ From
+ (Select 3 as Revenue, 4 as TemplateID) As `TestCase`
+ Group By TestCase.Revenue, TestCase.TemplateID;
++drop table t1;
+
+ --echo #
+ --echo # MDEV-7445:Server crash with Signal 6
+ --echo #
+
++create table t1 (id int not null primary key);
+ --delimiter |
+ CREATE PROCEDURE procedure2()
+ BEGIN
+ Select
+- (Select Sum(`TestCase`.Revenue) From mysql.slow_log E
+- Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
++ (Select Sum(`TestCase`.Revenue) From t1 E
++ Where TestCase.TemplateID not in (Select 1 from t1 where 2=2)
+ ) As `ControlRev`
+ From
+ (Select 3 as Revenue, 4 as TemplateID) As `TestCase`
+@@ -6029,6 +6035,7 @@ call procedure2();
+ call procedure2();
+
+ drop procedure procedure2;
++drop table t1;
+
+
+ --echo #
+--- a/mysql-test/main/subselect_no_exists_to_in.result
++++ b/mysql-test/main/subselect_no_exists_to_in.result
+@@ -7161,23 +7161,26 @@ drop table t1;
+ #
+ # MDEV-7565: Server crash with Signal 6 (part 2)
+ #
++create table t1 (id int not null primary key);
+ Select
+-(Select Sum(`TestCase`.Revenue) From mysql.slow_log E
+-Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
++(Select Sum(`TestCase`.Revenue) From t1 E
++Where TestCase.TemplateID not in (Select 1 from t1 where 2=2)
+ ) As `ControlRev`
+ From
+ (Select 3 as Revenue, 4 as TemplateID) As `TestCase`
+ Group By TestCase.Revenue, TestCase.TemplateID;
+ ControlRev
+ NULL
++drop table t1;
+ #
+ # MDEV-7445:Server crash with Signal 6
+ #
++create table t1 (id int not null primary key);
+ CREATE PROCEDURE procedure2()
+ BEGIN
+ Select
+-(Select Sum(`TestCase`.Revenue) From mysql.slow_log E
+-Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
++(Select Sum(`TestCase`.Revenue) From t1 E
++Where TestCase.TemplateID not in (Select 1 from t1 where 2=2)
+ ) As `ControlRev`
+ From
+ (Select 3 as Revenue, 4 as TemplateID) As `TestCase`
+@@ -7190,6 +7193,7 @@ call procedure2();
+ ControlRev
+ NULL
+ drop procedure procedure2;
++drop table t1;
+ #
+ # MDEV-7846:Server crashes in Item_subselect::fix
+ #_fields or fails with Thread stack overrun
+--- a/mysql-test/main/subselect_no_mat.result
++++ b/mysql-test/main/subselect_no_mat.result
+@@ -7154,23 +7154,26 @@ drop table t1;
+ #
+ # MDEV-7565: Server crash with Signal 6 (part 2)
+ #
++create table t1 (id int not null primary key);
+ Select
+-(Select Sum(`TestCase`.Revenue) From mysql.slow_log E
+-Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
++(Select Sum(`TestCase`.Revenue) From t1 E
++Where TestCase.TemplateID not in (Select 1 from t1 where 2=2)
+ ) As `ControlRev`
+ From
+ (Select 3 as Revenue, 4 as TemplateID) As `TestCase`
+ Group By TestCase.Revenue, TestCase.TemplateID;
+ ControlRev
+ NULL
++drop table t1;
+ #
+ # MDEV-7445:Server crash with Signal 6
+ #
++create table t1 (id int not null primary key);
+ CREATE PROCEDURE procedure2()
+ BEGIN
+ Select
+-(Select Sum(`TestCase`.Revenue) From mysql.slow_log E
+-Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
++(Select Sum(`TestCase`.Revenue) From t1 E
++Where TestCase.TemplateID not in (Select 1 from t1 where 2=2)
+ ) As `ControlRev`
+ From
+ (Select 3 as Revenue, 4 as TemplateID) As `TestCase`
+@@ -7183,6 +7186,7 @@ call procedure2();
+ ControlRev
+ NULL
+ drop procedure procedure2;
++drop table t1;
+ #
+ # MDEV-7846:Server crashes in Item_subselect::fix
+ #_fields or fails with Thread stack overrun
+--- a/mysql-test/main/subselect_no_opts.result
++++ b/mysql-test/main/subselect_no_opts.result
+@@ -7152,23 +7152,26 @@ drop table t1;
+ #
+ # MDEV-7565: Server crash with Signal 6 (part 2)
+ #
++create table t1 (id int not null primary key);
+ Select
+-(Select Sum(`TestCase`.Revenue) From mysql.slow_log E
+-Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
++(Select Sum(`TestCase`.Revenue) From t1 E
++Where TestCase.TemplateID not in (Select 1 from t1 where 2=2)
+ ) As `ControlRev`
+ From
+ (Select 3 as Revenue, 4 as TemplateID) As `TestCase`
+ Group By TestCase.Revenue, TestCase.TemplateID;
+ ControlRev
+ NULL
++drop table t1;
+ #
+ # MDEV-7445:Server crash with Signal 6
+ #
++create table t1 (id int not null primary key);
+ CREATE PROCEDURE procedure2()
+ BEGIN
+ Select
+-(Select Sum(`TestCase`.Revenue) From mysql.slow_log E
+-Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
++(Select Sum(`TestCase`.Revenue) From t1 E
++Where TestCase.TemplateID not in (Select 1 from t1 where 2=2)
+ ) As `ControlRev`
+ From
+ (Select 3 as Revenue, 4 as TemplateID) As `TestCase`
+@@ -7181,6 +7184,7 @@ call procedure2();
+ ControlRev
+ NULL
+ drop procedure procedure2;
++drop table t1;
+ #
+ # MDEV-7846:Server crashes in Item_subselect::fix
+ #_fields or fails with Thread stack overrun
+--- a/mysql-test/main/subselect_no_scache.result
++++ b/mysql-test/main/subselect_no_scache.result
+@@ -7167,23 +7167,26 @@ drop table t1;
+ #
+ # MDEV-7565: Server crash with Signal 6 (part 2)
+ #
++create table t1 (id int not null primary key);
+ Select
+-(Select Sum(`TestCase`.Revenue) From mysql.slow_log E
+-Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
++(Select Sum(`TestCase`.Revenue) From t1 E
++Where TestCase.TemplateID not in (Select 1 from t1 where 2=2)
+ ) As `ControlRev`
+ From
+ (Select 3 as Revenue, 4 as TemplateID) As `TestCase`
+ Group By TestCase.Revenue, TestCase.TemplateID;
+ ControlRev
+ NULL
++drop table t1;
+ #
+ # MDEV-7445:Server crash with Signal 6
+ #
++create table t1 (id int not null primary key);
+ CREATE PROCEDURE procedure2()
+ BEGIN
+ Select
+-(Select Sum(`TestCase`.Revenue) From mysql.slow_log E
+-Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
++(Select Sum(`TestCase`.Revenue) From t1 E
++Where TestCase.TemplateID not in (Select 1 from t1 where 2=2)
+ ) As `ControlRev`
+ From
+ (Select 3 as Revenue, 4 as TemplateID) As `TestCase`
+@@ -7196,6 +7199,7 @@ call procedure2();
+ ControlRev
+ NULL
+ drop procedure procedure2;
++drop table t1;
+ #
+ # MDEV-7846:Server crashes in Item_subselect::fix
+ #_fields or fails with Thread stack overrun
+--- a/mysql-test/main/subselect_no_semijoin.result
++++ b/mysql-test/main/subselect_no_semijoin.result
+@@ -7152,23 +7152,26 @@ drop table t1;
+ #
+ # MDEV-7565: Server crash with Signal 6 (part 2)
+ #
++create table t1 (id int not null primary key);
+ Select
+-(Select Sum(`TestCase`.Revenue) From mysql.slow_log E
+-Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
++(Select Sum(`TestCase`.Revenue) From t1 E
++Where TestCase.TemplateID not in (Select 1 from t1 where 2=2)
+ ) As `ControlRev`
+ From
+ (Select 3 as Revenue, 4 as TemplateID) As `TestCase`
+ Group By TestCase.Revenue, TestCase.TemplateID;
+ ControlRev
+ NULL
++drop table t1;
+ #
+ # MDEV-7445:Server crash with Signal 6
+ #
++create table t1 (id int not null primary key);
+ CREATE PROCEDURE procedure2()
+ BEGIN
+ Select
+-(Select Sum(`TestCase`.Revenue) From mysql.slow_log E
+-Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
++(Select Sum(`TestCase`.Revenue) From t1 E
++Where TestCase.TemplateID not in (Select 1 from t1 where 2=2)
+ ) As `ControlRev`
+ From
+ (Select 3 as Revenue, 4 as TemplateID) As `TestCase`
+@@ -7181,6 +7184,7 @@ call procedure2();
+ ControlRev
+ NULL
+ drop procedure procedure2;
++drop table t1;
+ #
+ # MDEV-7846:Server crashes in Item_subselect::fix
+ #_fields or fails with Thread stack overrun
diff --git a/debian/patches/2980-riscv-use-rdtime.patch b/debian/patches/2980-riscv-use-rdtime.patch
new file mode 100644
index 00000000..254187bc
--- /dev/null
+++ b/debian/patches/2980-riscv-use-rdtime.patch
@@ -0,0 +1,59 @@
+Forwarded: https://github.com/MariaDB/server/pull/2980
+Origin: https://patch-diff.githubusercontent.com/raw/MariaDB/server/pull/2980.patch
+From: Aurelien Jarno <aurelien@aurel32.net>
+Date: Thu, 4 Jan 2024 11:30:34 +0100
+Subject: [PATCH] RISC-V: use RDTIME instead of RDCYCLE
+
+Starting with Linux 6.6 [1], RDCYCLE is a privileged instruction on
+RISC-V and can't be used directly from userland. There is a sysctl
+option to change that as a transition period, but it will eventually
+disappear.
+
+Use RDTIME instead, which while less accurate has the advantage of being
+synchronized between CPU (and thus monotonic) and of constant frequency.
+
+[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=cc4c07c89aada16229084eeb93895c95b7eabaa3
+---
+ include/my_rdtsc.h | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+--- a/include/my_rdtsc.h
++++ b/include/my_rdtsc.h
+@@ -111,7 +111,7 @@ C_MODE_START
+ On AARCH64, we use the generic timer base register. We override clang
+ implementation for aarch64 as it access a PMU register which is not
+ guaranteed to be active.
+- On RISC-V, we use the rdcycle instruction to read from mcycle register.
++ On RISC-V, we use the rdtime instruction to read from mtime register.
+
+ Sadly, we have nothing for the Digital Alpha, MIPS, Motorola m68k,
+ HP PA-RISC or other non-mainstream (or obsolete) processors.
+@@ -211,15 +211,15 @@ static inline ulonglong my_timer_cycles(
+ }
+ #elif defined(__riscv)
+ #define MY_TIMER_ROUTINE_CYCLES MY_TIMER_ROUTINE_RISCV
+- /* Use RDCYCLE (and RDCYCLEH on riscv32) */
++ /* Use RDTIME (and RDTIMEH on riscv32) */
+ {
+ # if __riscv_xlen == 32
+ ulong result_lo, result_hi0, result_hi1;
+ /* Implemented in assembly because Clang insisted on branching. */
+ __asm __volatile__(
+- "rdcycleh %0\n"
+- "rdcycle %1\n"
+- "rdcycleh %2\n"
++ "rdtimeh %0\n"
++ "rdtime %1\n"
++ "rdtimeh %2\n"
+ "sub %0, %0, %2\n"
+ "seqz %0, %0\n"
+ "sub %0, zero, %0\n"
+@@ -228,7 +228,7 @@ static inline ulonglong my_timer_cycles(
+ return (static_cast<ulonglong>(result_hi1) << 32) | result_lo;
+ # else
+ ulonglong result;
+- __asm __volatile__("rdcycle %0" : "=r"(result));
++ __asm __volatile__("rdtime %0" : "=r"(result));
+ return result;
+ }
+ # endif
diff --git a/debian/patches/env-perl-usr-bin-perl.patch b/debian/patches/env-perl-usr-bin-perl.patch
new file mode 100644
index 00000000..559e7f2e
--- /dev/null
+++ b/debian/patches/env-perl-usr-bin-perl.patch
@@ -0,0 +1,99 @@
+Forwarded: https://github.com/MariaDB/server/pull/1718
+Origin: https://patch-diff.githubusercontent.com/raw/MariaDB/server/pull/1718.patch
+From: Otto Kekäläinen <otto@debian.org>
+Date: Sun, 20 Dec 2020 20:58:42 +0200
+Subject: Fix perl path in scripts
+ Fix Lintian issue
+ https://lintian.debian.org/tags/incorrect-path-for-interpreter.html
+ .
+ Upstream will never accept this patch, see
+ https://github.com/MariaDB/server/pull/1718
+
+--- a/mysql-test/lib/process-purecov-annotations.pl
++++ b/mysql-test/lib/process-purecov-annotations.pl
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env perl
++#!/usr/bin/perl
+ # -*- cperl -*-
+
+ # This script processes a .gcov coverage report to honor purecov
+--- a/mysql-test/lib/v1/mysql-test-run.pl
++++ b/mysql-test/lib/v1/mysql-test-run.pl
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env perl
++#!/usr/bin/perl
+ # -*- cperl -*-
+
+ # Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+--- a/mysql-test/mariadb-stress-test.pl
++++ b/mysql-test/mariadb-stress-test.pl
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env perl
++#!/usr/bin/perl
+
+ # Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ #
+--- a/mysql-test/mariadb-test-run.pl
++++ b/mysql-test/mariadb-test-run.pl
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env perl
++#!/usr/bin/perl
+ # -*- cperl -*-
+
+ # Copyright (c) 2004, 2014, Oracle and/or its affiliates.
+--- a/mysql-test/std_data/checkDBI_DBD-MariaDB.pl
++++ b/mysql-test/std_data/checkDBI_DBD-MariaDB.pl
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env perl
++#!/usr/bin/perl
+
+ # Copyright (c) 2011, Oracle and/or its affiliates
+ #
+--- a/mysql-test/suite/engines/rr_trx/run_stress_tx_rr.pl
++++ b/mysql-test/suite/engines/rr_trx/run_stress_tx_rr.pl
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env perl
++#!/usr/bin/perl
+ ################################################################################
+ #
+ # This script runs the transactional stress test "stress_tx_rr" against the
+--- a/mysql-test/suite/funcs_1/lib/DataGen_local.pl
++++ b/mysql-test/suite/funcs_1/lib/DataGen_local.pl
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env perl
++#!/usr/bin/perl
+
+
+ if ( (scalar(@ARGV) != 1 ) || ($ARGV[0] =~ /[^0-9]/i ) )
+--- a/mysql-test/suite/funcs_1/lib/DataGen_modify.pl
++++ b/mysql-test/suite/funcs_1/lib/DataGen_modify.pl
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env perl
++#!/usr/bin/perl
+
+
+ if ( (scalar(@ARGV) != 2 ) || ($ARGV[0] =~ /[^0-9]/i ) )
+--- a/mysql-test/suite/funcs_2/lib/gen_charset_utf8.pl
++++ b/mysql-test/suite/funcs_2/lib/gen_charset_utf8.pl
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env perl
++#!/usr/bin/perl
+
+ #################################################################################
+ # Author: Serge Kozlov #
+--- a/mysql-test/suite/rpl/extension/checksum.pl
++++ b/mysql-test/suite/rpl/extension/checksum.pl
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env perl
++#!/usr/bin/perl
+
+ # Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ #
+--- a/scripts/mytop.sh
++++ b/scripts/mytop.sh
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env perl
++#!/usr/bin/perl
+ #
+ # $Id: mytop,v 1.99-maria6 2019/10/22 14:53:51 jweisbuch Exp $
+
diff --git a/debian/patches/fix-reproducible-builds-rocksdb.patch b/debian/patches/fix-reproducible-builds-rocksdb.patch
new file mode 100644
index 00000000..1bc01252
--- /dev/null
+++ b/debian/patches/fix-reproducible-builds-rocksdb.patch
@@ -0,0 +1,26 @@
+Origin: https://github.com/facebook/rocksdb/commit/0a9a05ae12943b1529ef1eabbca5ce5a71c986bf
+# Merged in RocksDB 6.19.3, but not updated into MariaDB yet
+Bug: https://github.com/facebook/rocksdb/issues/7035
+Author: Otto Kekäläinen <otto@kekalainen.net>
+Subject: Make RocksDB build reproducible
+
+The RocksDB binary included a string with the build timestamp:
+> rocksdb_build_git_date:@2021-05-23·16:04:38@
+
+As this changes from build to build, it makes the builds unreproducible.
+Simply removing it solves the issue.
+
+This temporary fix can be removed when a proper fix already done in upstream
+lands in MariaDB when the RocksDB submodule is updated to a newer release.
+
+--- a/storage/rocksdb/rocksdb/util/build_version.cc.in
++++ b/storage/rocksdb/rocksdb/util/build_version.cc.in
+@@ -1,5 +1,5 @@
+ // Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
+ #include "build_version.h"
+-const char* rocksdb_build_git_sha = "rocksdb_build_git_sha:@@GIT_SHA@@";
+-const char* rocksdb_build_git_date = "rocksdb_build_git_date:@@GIT_DATE_TIME@@";
+-const char* rocksdb_build_compile_date = __DATE__;
++const char* rocksdb_build_git_sha = "rocksdb_build_git_sha:REDACTED";
++const char* rocksdb_build_git_date = "rocksdb_build_git_date:REDACTED";
++const char* rocksdb_build_compile_date = "REDACTED";
diff --git a/debian/patches/fix-spelling-libmariadb.patch b/debian/patches/fix-spelling-libmariadb.patch
new file mode 100644
index 00000000..57cdaec1
--- /dev/null
+++ b/debian/patches/fix-spelling-libmariadb.patch
@@ -0,0 +1,155 @@
+Forwarded: https://github.com/mariadb-corporation/mariadb-connector-c/pull/220
+Origin: https://patch-diff.githubusercontent.com/raw/mariadb-corporation/mariadb-connector-c/pull/220.patch
+Author: Otto Kekäläinen <otto@kekalainen.net>
+Date: Sat, 11 Mar 2023 11:22:24 -0800
+Subject: [PATCH] Fix trivial spelling errors
+
+- handshak -> handshake
+- occured -> occurred
+- releated -> related
+- reponse -> response
+- seperated -> separated
+- sucess -> success
+- use use -> use
+
+All new code of the whole pull request, including one or several files
+that are either new files or modified ones, are contributed under the
+BSD-new license. I am contributing on behalf of my employer Amazon Web
+Services, Inc.
+---
+ man/mariadb_get_infov.3 | 4 ++--
+ man/mariadb_reconnect.3 | 2 +-
+ man/mysql_ping.3 | 2 +-
+ man/mysql_real_connect.3 | 4 ++--
+ man/mysql_send_query.3 | 2 +-
+ man/mysql_set_character_set.3 | 2 +-
+ man/mysql_stmt_error.3 | 2 +-
+ man/mysql_stmt_reset.3 | 2 +-
+ man/mysql_store_result.3 | 2 +-
+ unittest/libmariadb/result.c | 2 +-
+ 10 files changed, 12 insertions(+), 12 deletions(-)
+
+--- a/libmariadb/man/mariadb_get_infov.3
++++ b/libmariadb/man/mariadb_get_infov.3
+@@ -5,7 +5,7 @@
+ .hy
+ .SS Name
+ .PP
+-mariadb_get_infov \- retrieves generic or connection releated
++mariadb_get_infov \- retrieves generic or connection related
+ information
+ .SS Synopsis
+ .IP
+@@ -170,7 +170,7 @@ Retrieves character set information for
+ .PD 0
+ .P
+ .PD
+-Returns the handshak capability flags] of the client.
++Returns the handshake capability flags] of the client.
+ .IP \[bu] 2
+ \f[C]MARIADB_CONNECTION_ERROR\f[R]
+ .PD 0
+--- a/libmariadb/man/mariadb_reconnect.3
++++ b/libmariadb/man/mariadb_reconnect.3
+@@ -22,7 +22,7 @@ It uses the same credentials which were
+ \f[B]mysql_real_connect(3)\f[R].
+ .SS Return value
+ .PP
+-The function will return 0 on sucess, a non zero value on error
++The function will return 0 on success, a non zero value on error
+ .PP
+ \f[B]Note\f[R]: The function will return an error, if the option
+ \f[C]MYSQL_OPT_RECONNECT\f[R] wasn\[cq]t set before.
+--- a/libmariadb/man/mysql_ping.3
++++ b/libmariadb/man/mysql_ping.3
+@@ -36,7 +36,7 @@ Also resources bundled to the connection
+ temporary tables, \&...) will be released.
+ .SS Return value
+ .PP
+-Returns zero on success, nonzero if an error occured.
++Returns zero on success, nonzero if an error occurred.
+ .SS See also
+ .IP \[bu] 2
+ \f[B]mysql_optionsv(3)\f[R]
+--- a/libmariadb/man/mysql_real_connect.3
++++ b/libmariadb/man/mysql_real_connect.3
+@@ -141,11 +141,11 @@ since version 3.3.0).
+ The following syntax is required:
+ .RS 2
+ .IP \[bu] 2
+-hostname and port must be seperated by a colon (:)
++hostname and port must be separated by a colon (:)
+ .IP \[bu] 2
+ IPv6 addresses must be enclosed within square brackets
+ .IP \[bu] 2
+-hostname:port pairs must be be seperated by a comma (,)
++hostname:port pairs must be be separated by a comma (,)
+ .IP \[bu] 2
+ if only one host:port was specified, the host string needs to end with a
+ comma.
+--- a/libmariadb/man/mysql_send_query.3
++++ b/libmariadb/man/mysql_send_query.3
+@@ -5,7 +5,7 @@
+ .SS Name
+ .PP
+ mysql_send_query \- sends a SQL statement without waiting for server
+-reponse
++response
+ .SS Synopsis
+ .IP
+ .nf
+--- a/libmariadb/man/mysql_set_character_set.3
++++ b/libmariadb/man/mysql_set_character_set.3
+@@ -34,7 +34,7 @@ of \f[C]SET NAMES ...\f[R] since \f[B]my
+ might fail or deliver unexpected results.
+ .SS Return value
+ .PP
+-Zero on success, non zero if an error occured
++Zero on success, non zero if an error occurred
+ .SS Supported character sets
+ .PP
+ The client library supports the following character sets:
+--- a/libmariadb/man/mysql_stmt_error.3
++++ b/libmariadb/man/mysql_stmt_error.3
+@@ -27,7 +27,7 @@ The string will be empty if no error occ
+ .SS Return value
+ .IP \[bu] 2
+ A string describing the last error or an empty string if no error
+-occured.
++occurred.
+ .SS Notes
+ .IP \[bu] 2
+ Client error messages are listed in the \f[C]errmsg.h\f[R] header file,
+--- a/libmariadb/man/mysql_stmt_reset.3
++++ b/libmariadb/man/mysql_stmt_reset.3
+@@ -24,7 +24,7 @@ Resets a prepared statement on client an
+ Returns zero on success, nonzero if an error occurred.
+ .SS Return value
+ .PP
+-Returns zero on succes, 1 if an error occured.
++Returns zero on succes, 1 if an error occurred.
+ .SS Notes
+ .IP \[bu] 2
+ \f[C]mysql_stmt_reset()\f[R] resets the statement on the server,
+--- a/libmariadb/man/mysql_store_result.3
++++ b/libmariadb/man/mysql_store_result.3
+@@ -31,7 +31,7 @@ allocated by \f[B]mysql_init(3)\f[R] and
+ \f[B]mysql_real_connect(3)\f[R].
+ .SS Return value
+ .PP
+-Returns a buffered result set or NULL in case an error occured or if the
++Returns a buffered result set or NULL in case an error occurred or if the
+ query didn\[cq]t return data (e.g.\ when executing an INSERT, UPDATE,
+ DELETE or REPLACE statement).
+ ## See also * \f[B]mysql_free_result(3)\f[R] *
+--- a/libmariadb/unittest/libmariadb/result.c
++++ b/libmariadb/unittest/libmariadb/result.c
+@@ -65,7 +65,7 @@ static int client_use_result(MYSQL *mysq
+ result= mysql_use_result(mysql);
+ FAIL_IF(!result, "Invalid result set");
+
+- /* since we use use result, we shouldn't be able execute other api calls */
++ /* since we use result, we shouldn't be able execute other api calls */
+ rc= mysql_ping(mysql);
+ FAIL_IF(!rc, "Error expected");
+
diff --git a/debian/patches/fix-spelling-libmarias3.patch b/debian/patches/fix-spelling-libmarias3.patch
new file mode 100644
index 00000000..58fb5815
--- /dev/null
+++ b/debian/patches/fix-spelling-libmarias3.patch
@@ -0,0 +1,73 @@
+Forwarded: https://github.com/mariadb-corporation/libmarias3/pull/111
+Origin: https://patch-diff.githubusercontent.com/raw/mariadb-corporation/libmarias3/pull/111.patch
+Author: Otto Kekäläinen <otto@kekalainen.net>
+Date: Sat, 11 Mar 2023 12:05:28 -0800
+Subject: [PATCH] Fix spelling: occured -> occurred
+
+All new code of the whole pull request, including one or several files
+that are either new files or modified ones, are contributed under the
+BSD-new license. I am contributing on behalf of my employer Amazon Web
+Services, Inc.
+---
+ docs/api/functions.rst | 10 +++++-----
+ src/xml.c | 2 +-
+ 2 files changed, 6 insertions(+), 6 deletions(-)
+
+--- a/storage/maria/libmarias3/docs/api/functions.rst
++++ b/storage/maria/libmarias3/docs/api/functions.rst
+@@ -147,7 +147,7 @@ Example
+ res= ms3_list(ms3, s3bucket, NULL, &list);
+ if (res)
+ {
+- printf("Error occured: %d\n", res);
++ printf("Error occurred: %d\n", res);
+ return;
+ }
+ list_it= list;
+@@ -220,7 +220,7 @@ Example
+ res= ms3_put(ms3, s3bucket, "test/ms3.txt", (const uint8_t*)test_string, strlen(test_string));
+ if (res)
+ {
+- printf("Error occured: %d\n", res);
++ printf("Error occurred: %d\n", res);
+ return;
+ }
+ ms3_deinit(ms3);
+@@ -290,7 +290,7 @@ Example
+ res= ms3_get(ms3, s3bucket, "test/ms3.txt", &data, &length);
+ if (res)
+ {
+- printf("Error occured: %d\n", res);
++ printf("Error occurred: %d\n", res);
+ return;
+ }
+ printf("File contents: %s\n", data);
+@@ -348,7 +348,7 @@ Example
+ res = ms3_delete(ms3, s3bucket, "test/ms3.txt");
+ if (res)
+ {
+- printf("Error occured: %d\n", res);
++ printf("Error occurred: %d\n", res);
+ return;
+ }
+ ms3_deinit(ms3);
+@@ -384,7 +384,7 @@ Example
+ res= ms3_status(ms3, s3bucket, "test/ms3.txt", &status);
+ if (res)
+ {
+- printf("Error occured: %d\n", res);
++ printf("Error occurred: %d\n", res);
+ return;
+ }
+ printf("File length: %ld\n", status.length);
+--- a/storage/maria/libmarias3/src/xml.c
++++ b/storage/maria/libmarias3/src/xml.c
+@@ -800,7 +800,7 @@ node_creation:;
+ return node;
+
+
+- /* A failure occured, so free all allocalted resources
++ /* A failure occurred, so free all allocalted resources
+ */
+ exit_failure:
+ if (tag_open) {
diff --git a/debian/patches/fix-spelling-rocksdb.patch b/debian/patches/fix-spelling-rocksdb.patch
new file mode 100644
index 00000000..d9007c3a
--- /dev/null
+++ b/debian/patches/fix-spelling-rocksdb.patch
@@ -0,0 +1,38 @@
+Forwarded: https://github.com/facebook/rocksdb/pull/9653
+Origin: https://patch-diff.githubusercontent.com/raw/facebook/rocksdb/pull/9653.patch
+From: Otto Kekäläinen <otto@debian.org>
+Date: Wed, 2 Mar 2022 18:13:18 -0800
+Subject: Fix various spelling errors still found in code
+ Two upstream PRs remain that have been merged, but not imported on MariaDB yet.
+
+--- a/storage/rocksdb/rocksdb/db/external_sst_file_ingestion_job.cc
++++ b/storage/rocksdb/rocksdb/db/external_sst_file_ingestion_job.cc
+@@ -46,7 +46,7 @@ Status ExternalSstFileIngestionJob::Prep
+ TablePropertiesCollectorFactory::Context::kUnknownColumnFamily &&
+ f.cf_id != cfd_->GetID()) {
+ return Status::InvalidArgument(
+- "External file column family id dont match");
++ "External file column family id don't match");
+ }
+ }
+
+@@ -646,7 +646,7 @@ Status ExternalSstFileIngestionJob::Assi
+ return Status::InvalidArgument("Global seqno is required, but disabled");
+ } else if (file_to_ingest->global_seqno_offset == 0) {
+ return Status::InvalidArgument(
+- "Trying to set global seqno for a file that dont have a global seqno "
++ "Trying to set global seqno for a file that don't have a global seqno "
+ "field");
+ }
+
+--- a/storage/rocksdb/rocksdb/include/rocksdb/cache.h
++++ b/storage/rocksdb/rocksdb/include/rocksdb/cache.h
+@@ -60,7 +60,7 @@ struct LRUCacheOptions {
+ // If greater than zero, the LRU list will be split into a high-pri
+ // list and a low-pri list. High-pri entries will be insert to the
+ // tail of high-pri list, while low-pri entries will be first inserted to
+- // the low-pri list (the midpoint). This is refered to as
++ // the low-pri list (the midpoint). This is referred to as
+ // midpoint insertion strategy to make entries never get hit in cache
+ // age out faster.
+ //
diff --git a/debian/patches/mroonga-mrn-lib-dirs-path-reproducible-build.patch b/debian/patches/mroonga-mrn-lib-dirs-path-reproducible-build.patch
new file mode 100644
index 00000000..1034f8c6
--- /dev/null
+++ b/debian/patches/mroonga-mrn-lib-dirs-path-reproducible-build.patch
@@ -0,0 +1,39 @@
+Forwarded: not-needed
+Origin: https://github.com/mroonga/mroonga/issues/298#issuecomment-1030815927
+Bug: https://github.com/mroonga/mroonga/issues/298
+From: Sutou Kouhei <kou@clear-code.com>
+Date: Sat, 5 Feb 2022 11:05:39 +0900
+Subject: [PATCH] cmake: add support for reproducible buildS
+ .
+ We should use relative path not absolute path.
+ We can use target without breaking reproducibility.
+--- a/storage/mroonga/CMakeLists.txt
++++ b/storage/mroonga/CMakeLists.txt
+@@ -209,7 +209,7 @@ set(MYSQL_INCLUDE_DIRS
+
+ if(MRN_BUNDLED)
+ set(MYSQL_PLUGIN_DIR "${INSTALL_PLUGINDIR}")
+- set(MYSQL_SERVICES_LIB_DIR "${MYSQL_BUILD_DIR}/libservices")
++ set(MYSQL_SERVICES_LIB_DIR)
+ set(MYSQL_CFLAGS "${CMAKE_C_FLAGS}")
+ set(MYSQL_VERSION "${MYSQL_BASE_VERSION}")
+ else()
+@@ -248,15 +248,11 @@ endif()
+
+ if(MRN_GROONGA_BUNDLED)
+ set(GROONGA_INCLUDE_DIRS "${MRN_BUNDLED_GROONGA_DIR}/include")
+- set(GROONGA_LIBRARY_DIRS "${MRN_BUNDLED_GROONGA_DIR}/lib")
+- set(GROONGA_LIBRARIES "libgroonga")
++ set(GROONGA_LIBRARY "libgroonga")
+
+- set(MRN_LIBRARY_DIRS ${GROONGA_LIBRARY_DIRS})
+- set(MRN_LIBRARIES ${GROONGA_LIBRARIES})
++ set(MRN_LIBRARY_DIRS)
++ set(MRN_LIBRARIES ${GROONGA_LIBRARY})
+ if(MRN_GROONGA_NORMALIZER_MYSQL_EMBED)
+- set(MRN_LIBRARY_DIRS
+- ${MRN_LIBRARY_DIRS}
+- "${MRN_BUNDLED_GROONGA_NORMALIZER_MYSQL_DIR}/normalizers")
+ set(MRN_LIBRARIES ${MRN_LIBRARIES} mysql_normalizer)
+ endif()
+ else()
diff --git a/debian/patches/rocksdb-kfreebsd.patch b/debian/patches/rocksdb-kfreebsd.patch
new file mode 100644
index 00000000..da15484b
--- /dev/null
+++ b/debian/patches/rocksdb-kfreebsd.patch
@@ -0,0 +1,150 @@
+Forwarded: https://github.com/facebook/rocksdb/pull/6992
+From: Andrew Kryczka <andrewkr@fb.com>
+Date: Tue, 16 Jun 2020 19:34:21 -0700
+# Merged in RocksDB 6.13.fb, but not updated into MariaDB yet
+Bug: https://jira.mariadb.org/browse/MDEV-19251
+Description:
+ Upstream has merged this but we still need to wait for it to be included
+ in a RocksDB release and imported into MariaDB and then into Debian.
+--- a/storage/rocksdb/build_rocksdb.cmake
++++ b/storage/rocksdb/build_rocksdb.cmake
+@@ -90,6 +90,8 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "Linux"
+ add_definitions(-DOS_LINUX)
+ elseif(CMAKE_SYSTEM_NAME MATCHES "SunOS")
+ add_definitions(-DOS_SOLARIS)
++elseif(CMAKE_SYSTEM_NAME MATCHES "kFreeBSD")
++ add_definitions(-DOS_GNU_KFREEBSD)
+ elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+ add_definitions(-DOS_FREEBSD)
+ elseif(CMAKE_SYSTEM_NAME MATCHES "NetBSD")
+--- a/storage/rocksdb/rocksdb/CMakeLists.txt
++++ b/storage/rocksdb/rocksdb/CMakeLists.txt
+@@ -91,7 +91,7 @@ if(MSVC)
+ option(WITH_XPRESS "build with windows built in compression" OFF)
+ include(${CMAKE_CURRENT_SOURCE_DIR}/thirdparty.inc)
+ else()
+- if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
++ if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD" AND NOT CMAKE_SYSTEM_NAME MATCHES "kFreeBSD")
+ # FreeBSD has jemalloc as default malloc
+ # but it does not have all the jemalloc files in include/...
+ set(WITH_JEMALLOC ON)
+@@ -413,6 +413,8 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "Linux"
+ add_definitions(-DOS_LINUX)
+ elseif(CMAKE_SYSTEM_NAME MATCHES "SunOS")
+ add_definitions(-DOS_SOLARIS)
++elseif(CMAKE_SYSTEM_NAME MATCHES "kFreeBSD")
++ add_definitions(-DOS_GNU_KFREEBSD)
+ elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+ add_definitions(-DOS_FREEBSD)
+ elseif(CMAKE_SYSTEM_NAME MATCHES "NetBSD")
+--- a/storage/rocksdb/rocksdb/build_tools/build_detect_platform
++++ b/storage/rocksdb/rocksdb/build_tools/build_detect_platform
+@@ -190,6 +190,17 @@ EOF
+ PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -lpthread"
+ # PORT_FILES=port/freebsd/freebsd_specific.cc
+ ;;
++ GNU/kFreeBSD)
++ PLATFORM=OS_GNU_KFREEBSD
++ COMMON_FLAGS="$COMMON_FLAGS -DOS_GNU_KFREEBSD"
++ if [ -z "$USE_CLANG" ]; then
++ COMMON_FLAGS="$COMMON_FLAGS -fno-builtin-memcmp"
++ else
++ PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -latomic"
++ fi
++ PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -lpthread -lrt"
++ # PORT_FILES=port/gnu_kfreebsd/gnu_kfreebsd_specific.cc
++ ;;
+ NetBSD)
+ PLATFORM=OS_NETBSD
+ COMMON_FLAGS="$COMMON_FLAGS -fno-builtin-memcmp -D_REENTRANT -DOS_NETBSD"
+--- a/storage/rocksdb/rocksdb/env/env_posix.cc
++++ b/storage/rocksdb/rocksdb/env/env_posix.cc
+@@ -41,7 +41,7 @@
+ #include <time.h>
+ #include <algorithm>
+ // Get nano time includes
+-#if defined(OS_LINUX) || defined(OS_FREEBSD)
++#if defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_GNU_KFREEBSD)
+ #elif defined(__MACH__)
+ #include <Availability.h>
+ #include <mach/clock.h>
+@@ -287,7 +287,8 @@ class PosixEnv : public CompositeEnvWrap
+ }
+
+ uint64_t NowNanos() override {
+-#if defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_AIX)
++#if defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_GNU_KFREEBSD) || \
++ defined(OS_AIX)
+ struct timespec ts;
+ clock_gettime(CLOCK_MONOTONIC, &ts);
+ return static_cast<uint64_t>(ts.tv_sec) * 1000000000 + ts.tv_nsec;
+@@ -307,8 +308,8 @@ class PosixEnv : public CompositeEnvWrap
+ }
+
+ uint64_t NowCPUNanos() override {
+-#if defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_AIX) || \
+- (defined(__MACH__) && defined(__MAC_10_12))
++#if defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_GNU_KFREEBSD) || \
++ defined(OS_AIX) || (defined(__MACH__) && defined(__MAC_10_12))
+ struct timespec ts;
+ clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts);
+ return static_cast<uint64_t>(ts.tv_sec) * 1000000000 + ts.tv_nsec;
+--- a/storage/rocksdb/rocksdb/port/stack_trace.cc
++++ b/storage/rocksdb/rocksdb/port/stack_trace.cc
+@@ -32,7 +32,7 @@ namespace port {
+
+ namespace {
+
+-#if defined(OS_LINUX) || defined(OS_FREEBSD)
++#if defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_GNU_KFREEBSD)
+ const char* GetExecutableName() {
+ static char name[1024];
+
+--- a/storage/rocksdb/rdb_io_watchdog.h
++++ b/storage/rocksdb/rdb_io_watchdog.h
+@@ -56,19 +56,19 @@ class Rdb_io_watchdog {
+ int stop_timers() {
+ int ret = 0;
+
+- if (m_io_check_watchdog_timer) {
++ if (m_io_check_watchdog_timer != reinterpret_cast<timer_t>(-1)) {
+ ret = timer_delete(m_io_check_watchdog_timer);
+
+ if (!ret) {
+- m_io_check_watchdog_timer = nullptr;
++ m_io_check_watchdog_timer = reinterpret_cast<timer_t>(-1);
+ }
+ }
+
+- if (m_io_check_timer && !ret) {
++ if (m_io_check_timer != reinterpret_cast<timer_t>(-1) && !ret) {
+ ret = timer_delete(m_io_check_timer);
+
+ if (!ret) {
+- m_io_check_timer = nullptr;
++ m_io_check_timer = reinterpret_cast<timer_t>(-1);
+ }
+ }
+
+@@ -93,8 +93,8 @@ class Rdb_io_watchdog {
+
+ public:
+ explicit Rdb_io_watchdog(std::vector<std::string> &&directories)
+- : m_io_check_timer(nullptr),
+- m_io_check_watchdog_timer(nullptr),
++ : m_io_check_timer(reinterpret_cast<timer_t>(-1)),
++ m_io_check_watchdog_timer(reinterpret_cast<timer_t>(-1)),
+ m_io_in_progress(false),
+ m_dirs_to_check(std::move(directories)),
+ m_buf(nullptr) {
+--- a/storage/rocksdb/rdb_io_watchdog.cc
++++ b/storage/rocksdb/rdb_io_watchdog.cc
+@@ -111,7 +111,7 @@ void Rdb_io_watchdog::io_check_callback(
+ sql_print_warning("Deleting the watchdog I/O timer failed with %d.", errno);
+ }
+
+- m_io_check_watchdog_timer = nullptr;
++ m_io_check_watchdog_timer = reinterpret_cast<timer_t>(-1);
+
+ RDB_MUTEX_UNLOCK_CHECK(m_reset_mutex);
+ }
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 00000000..153cdfbf
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,13 @@
+0025-Change-the-default-optimization-from-O3-to-O2-in-mys.patch
+rocksdb-kfreebsd.patch
+env-perl-usr-bin-perl.patch
+fix-spelling-rocksdb.patch
+fix-reproducible-builds-rocksdb.patch
+mroonga-mrn-lib-dirs-path-reproducible-build.patch
+2129-new-script-wsrep-sst-backup-fixes.patch
+2541-fix-stack-overflow-in-pinbox-allocator.patch
+fix-spelling-libmarias3.patch
+fix-spelling-libmariadb.patch
+2777-fix-disks-disk-test.patch
+2883-subselect-test-failures.patch
+2980-riscv-use-rdtime.patch