Skip to content

Commit 28b4037

Browse files
committed
Merge branch '11.2' into 11.3
2 parents d75ef02 + eece7f1 commit 28b4037

File tree

885 files changed

+12425
-6296
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

885 files changed

+12425
-6296
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*.rpm
88
.*.swp
99
*.ninja
10+
.ccls-cache/
1011
.ninja_*
1112
*.mri
1213
*.mri.tpl

.gitlab-ci.yml

Lines changed: 62 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ fedora-sanitizer:
207207
- builddir/_CPack_Packages/Linux/RPM/SPECS/
208208
parallel:
209209
matrix:
210-
- SANITIZER: [-DWITH_ASAN=YES, -DWITH_TSAN=YES, -DWITH_UBSAN=YES, -DWITH_MSAN=YES]
210+
- SANITIZER: [-DWITH_ASAN=YES, -DWITH_TSAN=YES, -DWITH_UBSAN=YES]
211211

212212
centos8:
213213
stage: build
@@ -297,6 +297,7 @@ centos7:
297297
main.mysqldump : Field separator argument is not what is expected; check the manual when executing 'SELECT INTO OUTFILE'
298298
main.flush_logs_not_windows : query 'flush logs' succeeded - should have failed with error ER_CANT_CREATE_FILE (1004)
299299
main.mysql_upgrade_noengine : upgrade output order does not match the expected
300+
main.func_math : MDEV-20966 - Wrong error code
300301
" > skiplist
301302
- ./mtr --suite=main --force --parallel=auto --xml-report=$CI_PROJECT_DIR/junit.xml --skip-test-list=skiplist $RESTART_POLICY
302303

@@ -369,22 +370,6 @@ mysql-test-run-ubsan:
369370
junit:
370371
- junit.xml
371372

372-
mysql-test-run-msan:
373-
stage: test
374-
variables:
375-
RESTART_POLICY: "--force-restart"
376-
dependencies:
377-
- "fedora-sanitizer: [-DWITH_MSAN=YES]"
378-
needs:
379-
- "fedora-sanitizer: [-DWITH_MSAN=YES]"
380-
<<: *mysql-test-run-def
381-
allow_failure: true
382-
artifacts:
383-
when: always # Also show results when tests fail
384-
reports:
385-
junit:
386-
- junit.xml
387-
388373
rpmlint:
389374
stage: test
390375
dependencies:
@@ -439,52 +424,70 @@ fedora install:
439424
- installed-database.sql
440425
- upgraded-database.sql
441426

442-
fedora upgrade:
443-
stage: test
444-
dependencies:
445-
- fedora
446-
needs:
447-
- fedora
427+
cppcheck:
428+
stage: sast
429+
needs: []
430+
variables:
431+
GIT_STRATEGY: fetch
432+
GIT_SUBMODULE_STRATEGY: normal
448433
script:
449-
- dnf install -y mariadb-server
450-
# Fedora does not support running services in Docker (like Debian packages do) so start it manually
451-
- /usr/libexec/mariadb-check-socket
452-
- /usr/libexec/mariadb-prepare-db-dir
453-
- sudo -u mysql /usr/libexec/mariadbd --basedir=/usr & sleep 10
454-
# Dump database contents in installed state
455-
- mariadb-dump --all-databases --all-tablespaces --triggers --routines --events --skip-extended-insert > old-installed-database.sql
456-
- /usr/libexec/mariadb-check-upgrade
457-
# Dump database contents in upgraded state
458-
- mariadb-dump --all-databases --all-tablespaces --triggers --routines --events --skip-extended-insert > old-upgraded-database.sql
459-
- mariadb --skip-column-names -e "SELECT @@version, @@version_comment" # Show version
460-
# @TODO: Upgrade from Fedora 33 MariaDB 10.4 to MariaDB.org latest does not work
461-
# so do this manual step to remove conflicts until packaging is fixed
462-
- yum remove -y mariadb-server-utils mariadb-gssapi-server mariadb-cracklib-password-check mariadb-backup mariadb-connector-c-config
463-
- rm -f rpm/*debuginfo* # Not relevant in this test
464-
- yum install -y rpm/*.rpm
465-
# nothing provides galera-4 on Fedora, so this step fails if built with wsrep
466-
- mysql -e "SHUTDOWN;"
467-
- /usr/bin/mariadb-install-db # This step should not do anything on upgrades, just exit
468-
- sudo -u mysql /usr/sbin/mariadbd & sleep 10
469-
# Dump database contents in installed state
470-
- mariadb-dump --all-databases --all-tablespaces --triggers --routines --events --skip-extended-insert > new-installed-database.sql || true
471-
# The step above fails on: mariadb-dump: Couldn't execute 'show events': Cannot proceed, because event scheduler is disabled (1577)
472-
# @TODO: Since we did a manual start, we also need to run upgrade manually
473-
- /usr/bin/mariadb-upgrade
474-
# Dump database contents in upgraded state
475-
- mariadb-dump --all-databases --all-tablespaces --triggers --routines --events --skip-extended-insert > new-upgraded-database.sql
476-
- |
477-
mariadb --skip-column-names -e "SELECT @@version, @@version_comment" | tee /tmp/version
478-
grep $MARIADB_MAJOR_VERSION /tmp/version || echo "MariaDB didn't upgrade properly"
479-
- mariadb --table -e "SELECT * FROM mysql.global_priv; SHOW CREATE USER root@localhost; SHOW CREATE USER 'mariadb.sys'@localhost"
480-
- mariadb --table -e "SELECT * FROM mysql.plugin; SHOW PLUGINS"
434+
- yum install -y cppcheck diffutils
435+
# --template: use a single-line template
436+
# --force: check large directories without warning
437+
# -i<directory>: ignore this directory when scanning
438+
# -j: run multiple cppcheck threads
439+
# Use newline to escape colon in yaml
440+
- >
441+
cppcheck --template="{file}:{line}: {severity}: {message}" --force
442+
client dbug extra include libmariadb libmysqld libservices mysql-test mysys mysys_ssl pcre plugin
443+
strings tests unittest vio wsrep-lib sql sql-common storage
444+
-istorage/mroonga -istorage/tokudb -istorage/spider -istorage/rocksdb -iextra/ -ilibmariadb/ -istorage/columnstore
445+
--output-file=cppcheck.txt -j $(nproc)
446+
# Parallel jobs may output findings in an nondeterministic order. Sort to match ignorelist.
447+
- cat cppcheck.txt | sort > cppcheck_sorted.txt
448+
# Remove line numbers for diff
449+
- sed 's/:[^:]*:/:/' cppcheck_sorted.txt > cppcheck_sorted_no_line_numbers.txt
450+
# Only print new issues not found in ignore list
451+
- echo "Problems found in ignore list that were not discovered by cppcheck (may have been fixed)."
452+
- diff --changed-group-format='%>' --unchanged-group-format='' cppcheck_sorted_no_line_numbers.txt tests/code_quality/cppcheck_ignorelist.txt || true
453+
- echo "Problems found by cppcheck that were not in ignore list."
454+
- diff --changed-group-format='%<' --unchanged-group-format='' cppcheck_sorted_no_line_numbers.txt tests/code_quality/cppcheck_ignorelist.txt > lines_not_ignored.txt || true
455+
- cat lines_not_ignored.txt && test ! -s lines_not_ignored.txt
481456
artifacts:
457+
when: always
482458
paths:
483-
- old-installed-database.sql
484-
- old-upgraded-database.sql
485-
- new-installed-database.sql
486-
- new-upgraded-database.sql
459+
- cppcheck_sorted.txt
487460

461+
flawfinder:
462+
stage: sast
463+
needs: []
464+
variables:
465+
GIT_STRATEGY: fetch
466+
GIT_SUBMODULE_STRATEGY: normal
467+
script:
468+
- yum install -y python3 python3-pip jq diffutils git
469+
- pip install flawfinder
470+
- flawfinder --falsepositive --quiet --html . > flawfinder-all-vulnerabilities.html
471+
- cat flawfinder-all-vulnerabilities.html | grep "Hits ="
472+
- flawfinder --falsepositive --quiet --minlevel=5 --sarif . > flawfinder-output.json
473+
# FlawFinder's --sarif output will display all vulnerabilities despite having --minlevel=5 specified.
474+
# Therefore, we postprocess the results with jq and filter out findings where the vulnerability level is less than 5.
475+
# Also in the SARIF output format, the vulnerabilities are ranked as 0.2/0.4/0.6/0.8/1.0 which correspond to the --minlevel=1/2/3/4/5 of FlawFinder.
476+
# Additionally, we sort the results because individual findings are consistent across different runs, but their ordering may not be.
477+
# Vulnerabilities can also be ignored in-line (/* Flawfinder: ignore */), but this option was chosen as to not clutter the codebase.
478+
- jq 'del(.runs[] | .tool | .driver | .rules) | del(.runs[] | .results[] | select(.rank < 1)) | del(.runs[] | .results[] | .locations[] | .physicalLocation | .region | .startLine) | .runs[0].results|=sort_by(.fingerprints)' flawfinder-output.json > flawfinder-min-level5.json
479+
# Diff against known vulnerabilities, but ignore the line number.
480+
- echo "Problems found in ignore list that were not discovered by flawfinder (may have been fixed)."
481+
- diff --changed-group-format='%>' --unchanged-group-format='' flawfinder-min-level5.json tests/code_quality/flawfinder_ignorelist.json || true
482+
- echo "Problems found by flawfinder that were not in ignore list."
483+
- diff --changed-group-format='%<' --unchanged-group-format='' flawfinder-min-level5.json tests/code_quality/flawfinder_ignorelist.json > lines_not_ignored.txt || true
484+
- cat lines_not_ignored.txt && test ! -s lines_not_ignored.txt
485+
artifacts:
486+
when: always
487+
paths:
488+
- flawfinder-all-vulnerabilities.html
489+
- flawfinder-min-level5.json
490+
488491
mini-benchmark:
489492
stage: test
490493
dependencies:

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
2727
"None" "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
2828
ENDIF()
2929

30-
PROJECT(MariaDB)
31-
3230
# Remove the following comment if you don't want to have striped binaries
3331
# in RPM's:
3432

@@ -39,6 +37,8 @@ FOREACH(p CMP0022 CMP0046 CMP0040 CMP0048 CMP0054 CMP0075 CMP0069 CMP0135)
3937
ENDIF()
4038
ENDFOREACH()
4139

40+
PROJECT(MariaDB)
41+
4242
MESSAGE(STATUS "Running cmake version ${CMAKE_VERSION}")
4343

4444
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}

client/mysql.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2142,7 +2142,7 @@ static int get_options(int argc, char **argv)
21422142
current_db= my_strdup(PSI_NOT_INSTRUMENTED, *argv, MYF(MY_WME));
21432143
}
21442144
if (tty_password)
2145-
opt_password= get_tty_password(NullS);
2145+
opt_password= my_get_tty_password(NullS);
21462146
if (debug_info_flag)
21472147
my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO;
21482148
if (debug_check_flag)
@@ -4887,7 +4887,7 @@ char *mysql_authentication_dialog_ask(MYSQL *mysql, int type,
48874887

48884888
if (type == 2) /* password */
48894889
{
4890-
s= get_tty_password("");
4890+
s= my_get_tty_password("");
48914891
strnmov(buf, s, buf_len);
48924892
buf[buf_len-1]= 0;
48934893
my_free(s);

client/mysql_upgrade.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1458,7 +1458,7 @@ int main(int argc, char **argv)
14581458

14591459
if (tty_password)
14601460
{
1461-
opt_password= get_tty_password(NullS);
1461+
opt_password= my_get_tty_password(NullS);
14621462
/* add password to defaults file */
14631463
add_one_option_cnf_file(&ds_args, "password", opt_password);
14641464
}

client/mysqladmin.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ int main(int argc,char *argv[])
348348
}
349349
commands = temp_argv;
350350
if (tty_password)
351-
opt_password = get_tty_password(NullS);
351+
opt_password = my_get_tty_password(NullS);
352352

353353
(void) signal(SIGINT,endprog); /* Here if abort */
354354
(void) signal(SIGTERM,endprog); /* Here if abort */
@@ -1053,8 +1053,8 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
10531053
else if (argc == 1)
10541054
{
10551055
/* prompt for password */
1056-
typed_password= get_tty_password("New password: ");
1057-
verified= get_tty_password("Confirm new password: ");
1056+
typed_password= my_get_tty_password("New password: ");
1057+
verified= my_get_tty_password("Confirm new password: ");
10581058
if (strcmp(typed_password, verified) != 0)
10591059
{
10601060
my_printf_error(0,"Passwords don't match",MYF(ME_BELL));

client/mysqlbinlog.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2261,7 +2261,7 @@ get_one_option(const struct my_option *opt, const char *argument,
22612261
break;
22622262
}
22632263
if (tty_password)
2264-
pass= get_tty_password(NullS);
2264+
pass= my_get_tty_password(NullS);
22652265

22662266
return 0;
22672267
}

client/mysqlcheck.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ static int get_options(int *argc, char ***argv)
481481
DBUG_RETURN(1);
482482
}
483483
if (tty_password)
484-
opt_password = get_tty_password(NullS);
484+
opt_password = my_get_tty_password(NullS);
485485
if (debug_info_flag)
486486
my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO;
487487
if (debug_check_flag)

client/mysqldump.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1351,7 +1351,7 @@ static int get_options(int *argc, char ***argv)
13511351
return EX_USAGE;
13521352
}
13531353
if (tty_password)
1354-
opt_password=get_tty_password(NullS);
1354+
opt_password=my_get_tty_password(NullS);
13551355
return(0);
13561356
} /* get_options */
13571357

@@ -2847,11 +2847,7 @@ static uint dump_routines_for_db(char *db)
28472847
routine_type[i], routine_name);
28482848

28492849
if (mysql_query_with_error_report(mysql, &routine_res, query_buff))
2850-
{
2851-
mysql_free_result(routine_list_res);
2852-
routine_list_res= 0;
2853-
DBUG_RETURN(1);
2854-
}
2850+
continue;
28552851

28562852
while ((row= mysql_fetch_row(routine_res)))
28572853
{
@@ -3357,7 +3353,8 @@ static uint get_table_structure(const char *table, const char *db, char *table_t
33573353
my_snprintf(query_buff, sizeof(query_buff),
33583354
"select column_name, extra, generation_expression, data_type "
33593355
"from information_schema.columns where table_schema=database() "
3360-
"and table_name=%s", quote_for_equal(table, temp_buff));
3356+
"and table_name=%s order by ordinal_position",
3357+
quote_for_equal(table, temp_buff));
33613358
if (mysql_query_with_error_report(mysql, &result, query_buff))
33623359
{
33633360
if (path)
@@ -3442,7 +3439,8 @@ static uint get_table_structure(const char *table, const char *db, char *table_t
34423439
"`EXTRA` AS `Extra`, "
34433440
"`COLUMN_COMMENT` AS `Comment` "
34443441
"FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE "
3445-
"TABLE_SCHEMA = %s AND TABLE_NAME = %s";
3442+
"TABLE_SCHEMA = %s AND TABLE_NAME = %s "
3443+
"ORDER BY ORDINAL_POSITION";
34463444

34473445
verbose_msg("%s: Warning: Can't set SQL_QUOTE_SHOW_CREATE option (%s)\n",
34483446
my_progname_short, mysql_error(mysql));

client/mysqlimport.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ static int get_options(int *argc, char ***argv)
319319
current_db= *((*argv)++);
320320
(*argc)--;
321321
if (tty_password)
322-
opt_password=get_tty_password(NullS);
322+
opt_password=my_get_tty_password(NullS);
323323
return(0);
324324
}
325325

0 commit comments

Comments
 (0)