From c86ba4c137afa3ed53a1a844e1477db1341b4171 Mon Sep 17 00:00:00 2001 From: Alex1s Date: Sun, 5 May 2024 22:38:07 +0200 Subject: [PATCH] do not pass mariadbd arguments with whitespace to mariadb-install-db --- 10.11/docker-entrypoint.sh | 12 +++++++++++- 10.4/docker-entrypoint.sh | 12 +++++++++++- 10.5/docker-entrypoint.sh | 12 +++++++++++- 10.6/docker-entrypoint.sh | 12 +++++++++++- 11.0/docker-entrypoint.sh | 12 +++++++++++- 11.1/docker-entrypoint.sh | 12 +++++++++++- 11.2/docker-entrypoint.sh | 12 +++++++++++- 11.3/docker-entrypoint.sh | 12 +++++++++++- 11.4/docker-entrypoint.sh | 12 +++++++++++- 11.5/docker-entrypoint.sh | 12 +++++++++++- docker-entrypoint.sh | 12 +++++++++++- 11 files changed, 121 insertions(+), 11 deletions(-) diff --git a/10.11/docker-entrypoint.sh b/10.11/docker-entrypoint.sh index 20fefd4b..cc334181 100755 --- a/10.11/docker-entrypoint.sh +++ b/10.11/docker-entrypoint.sh @@ -228,7 +228,17 @@ docker_init_database_dir() { mysql_note "Initializing database files" installArgs=( --datadir="$DATADIR" --rpm --auth-root-authentication-method=normal ) # "Other options are passed to mariadbd." (so we pass all "mariadbd" arguments directly here) - mariadb-install-db "${installArgs[@]}" "${@:2}" \ + + local mariadbdArgs=() + for arg in "${@:2}"; do + # Check if the argument contains whitespace + if [[ ! "$arg" =~ [[:space:]] ]]; then + mariadbdArgs+=("$arg") + else + mysql_warn Not passing argument \'$arg\' to mariadb-install-db because mariadb-install-db does not support arguments with whitespace. + fi + done + mariadb-install-db "${installArgs[@]}" "${mariadbdArgs[@]}" \ --skip-test-db \ --old-mode='UTF8_IS_UTF8MB3' \ --default-time-zone=SYSTEM --enforce-storage-engine= \ diff --git a/10.4/docker-entrypoint.sh b/10.4/docker-entrypoint.sh index 0253377e..51403d5b 100755 --- a/10.4/docker-entrypoint.sh +++ b/10.4/docker-entrypoint.sh @@ -220,7 +220,17 @@ docker_init_database_dir() { mysql_note "Initializing database files" installArgs=( --datadir="$DATADIR" --rpm --auth-root-authentication-method=normal ) # "Other options are passed to mysqld." (so we pass all "mysqld" arguments directly here) - mysql_install_db "${installArgs[@]}" "${@:2}" \ + + local mariadbdArgs=() + for arg in "${@:2}"; do + # Check if the argument contains whitespace + if [[ ! "$arg" =~ [[:space:]] ]]; then + mariadbdArgs+=("$arg") + else + mysql_warn Not passing argument \'$arg\' to mariadb-install-db because mariadb-install-db does not support arguments with whitespace. + fi + done + mysql_install_db "${installArgs[@]}" "${mariadbdArgs[@]}" \ --skip-test-db \ --default-time-zone=SYSTEM --enforce-storage-engine= \ --skip-log-bin \ diff --git a/10.5/docker-entrypoint.sh b/10.5/docker-entrypoint.sh index 02234409..10150f90 100755 --- a/10.5/docker-entrypoint.sh +++ b/10.5/docker-entrypoint.sh @@ -220,7 +220,17 @@ docker_init_database_dir() { mysql_note "Initializing database files" installArgs=( --datadir="$DATADIR" --rpm --auth-root-authentication-method=normal ) # "Other options are passed to mysqld." (so we pass all "mysqld" arguments directly here) - mysql_install_db "${installArgs[@]}" "${@:2}" \ + + local mariadbdArgs=() + for arg in "${@:2}"; do + # Check if the argument contains whitespace + if [[ ! "$arg" =~ [[:space:]] ]]; then + mariadbdArgs+=("$arg") + else + mysql_warn Not passing argument \'$arg\' to mariadb-install-db because mariadb-install-db does not support arguments with whitespace. + fi + done + mysql_install_db "${installArgs[@]}" "${mariadbdArgs[@]}" \ --skip-test-db \ --default-time-zone=SYSTEM --enforce-storage-engine= \ --skip-log-bin \ diff --git a/10.6/docker-entrypoint.sh b/10.6/docker-entrypoint.sh index bb9aef30..70da970f 100755 --- a/10.6/docker-entrypoint.sh +++ b/10.6/docker-entrypoint.sh @@ -220,7 +220,17 @@ docker_init_database_dir() { mysql_note "Initializing database files" installArgs=( --datadir="$DATADIR" --rpm --auth-root-authentication-method=normal ) # "Other options are passed to mariadbd." (so we pass all "mariadbd" arguments directly here) - mariadb-install-db "${installArgs[@]}" "${@:2}" \ + + local mariadbdArgs=() + for arg in "${@:2}"; do + # Check if the argument contains whitespace + if [[ ! "$arg" =~ [[:space:]] ]]; then + mariadbdArgs+=("$arg") + else + mysql_warn Not passing argument \'$arg\' to mariadb-install-db because mariadb-install-db does not support arguments with whitespace. + fi + done + mariadb-install-db "${installArgs[@]}" "${mariadbdArgs[@]}" \ --skip-test-db \ --old-mode='UTF8_IS_UTF8MB3' \ --default-time-zone=SYSTEM --enforce-storage-engine= \ diff --git a/11.0/docker-entrypoint.sh b/11.0/docker-entrypoint.sh index 5c9fc4f0..7b6af63b 100755 --- a/11.0/docker-entrypoint.sh +++ b/11.0/docker-entrypoint.sh @@ -228,7 +228,17 @@ docker_init_database_dir() { mysql_note "Initializing database files" installArgs=( --datadir="$DATADIR" --rpm --auth-root-authentication-method=normal ) # "Other options are passed to mariadbd." (so we pass all "mariadbd" arguments directly here) - mariadb-install-db "${installArgs[@]}" "${@:2}" \ + + local mariadbdArgs=() + for arg in "${@:2}"; do + # Check if the argument contains whitespace + if [[ ! "$arg" =~ [[:space:]] ]]; then + mariadbdArgs+=("$arg") + else + mysql_warn Not passing argument \'$arg\' to mariadb-install-db because mariadb-install-db does not support arguments with whitespace. + fi + done + mariadb-install-db "${installArgs[@]}" "${mariadbdArgs[@]}" \ --skip-test-db \ --old-mode='UTF8_IS_UTF8MB3' \ --default-time-zone=SYSTEM --enforce-storage-engine= \ diff --git a/11.1/docker-entrypoint.sh b/11.1/docker-entrypoint.sh index 5c9fc4f0..7b6af63b 100755 --- a/11.1/docker-entrypoint.sh +++ b/11.1/docker-entrypoint.sh @@ -228,7 +228,17 @@ docker_init_database_dir() { mysql_note "Initializing database files" installArgs=( --datadir="$DATADIR" --rpm --auth-root-authentication-method=normal ) # "Other options are passed to mariadbd." (so we pass all "mariadbd" arguments directly here) - mariadb-install-db "${installArgs[@]}" "${@:2}" \ + + local mariadbdArgs=() + for arg in "${@:2}"; do + # Check if the argument contains whitespace + if [[ ! "$arg" =~ [[:space:]] ]]; then + mariadbdArgs+=("$arg") + else + mysql_warn Not passing argument \'$arg\' to mariadb-install-db because mariadb-install-db does not support arguments with whitespace. + fi + done + mariadb-install-db "${installArgs[@]}" "${mariadbdArgs[@]}" \ --skip-test-db \ --old-mode='UTF8_IS_UTF8MB3' \ --default-time-zone=SYSTEM --enforce-storage-engine= \ diff --git a/11.2/docker-entrypoint.sh b/11.2/docker-entrypoint.sh index 5c9fc4f0..7b6af63b 100755 --- a/11.2/docker-entrypoint.sh +++ b/11.2/docker-entrypoint.sh @@ -228,7 +228,17 @@ docker_init_database_dir() { mysql_note "Initializing database files" installArgs=( --datadir="$DATADIR" --rpm --auth-root-authentication-method=normal ) # "Other options are passed to mariadbd." (so we pass all "mariadbd" arguments directly here) - mariadb-install-db "${installArgs[@]}" "${@:2}" \ + + local mariadbdArgs=() + for arg in "${@:2}"; do + # Check if the argument contains whitespace + if [[ ! "$arg" =~ [[:space:]] ]]; then + mariadbdArgs+=("$arg") + else + mysql_warn Not passing argument \'$arg\' to mariadb-install-db because mariadb-install-db does not support arguments with whitespace. + fi + done + mariadb-install-db "${installArgs[@]}" "${mariadbdArgs[@]}" \ --skip-test-db \ --old-mode='UTF8_IS_UTF8MB3' \ --default-time-zone=SYSTEM --enforce-storage-engine= \ diff --git a/11.3/docker-entrypoint.sh b/11.3/docker-entrypoint.sh index 5c9fc4f0..7b6af63b 100755 --- a/11.3/docker-entrypoint.sh +++ b/11.3/docker-entrypoint.sh @@ -228,7 +228,17 @@ docker_init_database_dir() { mysql_note "Initializing database files" installArgs=( --datadir="$DATADIR" --rpm --auth-root-authentication-method=normal ) # "Other options are passed to mariadbd." (so we pass all "mariadbd" arguments directly here) - mariadb-install-db "${installArgs[@]}" "${@:2}" \ + + local mariadbdArgs=() + for arg in "${@:2}"; do + # Check if the argument contains whitespace + if [[ ! "$arg" =~ [[:space:]] ]]; then + mariadbdArgs+=("$arg") + else + mysql_warn Not passing argument \'$arg\' to mariadb-install-db because mariadb-install-db does not support arguments with whitespace. + fi + done + mariadb-install-db "${installArgs[@]}" "${mariadbdArgs[@]}" \ --skip-test-db \ --old-mode='UTF8_IS_UTF8MB3' \ --default-time-zone=SYSTEM --enforce-storage-engine= \ diff --git a/11.4/docker-entrypoint.sh b/11.4/docker-entrypoint.sh index 5c9fc4f0..7b6af63b 100755 --- a/11.4/docker-entrypoint.sh +++ b/11.4/docker-entrypoint.sh @@ -228,7 +228,17 @@ docker_init_database_dir() { mysql_note "Initializing database files" installArgs=( --datadir="$DATADIR" --rpm --auth-root-authentication-method=normal ) # "Other options are passed to mariadbd." (so we pass all "mariadbd" arguments directly here) - mariadb-install-db "${installArgs[@]}" "${@:2}" \ + + local mariadbdArgs=() + for arg in "${@:2}"; do + # Check if the argument contains whitespace + if [[ ! "$arg" =~ [[:space:]] ]]; then + mariadbdArgs+=("$arg") + else + mysql_warn Not passing argument \'$arg\' to mariadb-install-db because mariadb-install-db does not support arguments with whitespace. + fi + done + mariadb-install-db "${installArgs[@]}" "${mariadbdArgs[@]}" \ --skip-test-db \ --old-mode='UTF8_IS_UTF8MB3' \ --default-time-zone=SYSTEM --enforce-storage-engine= \ diff --git a/11.5/docker-entrypoint.sh b/11.5/docker-entrypoint.sh index 5c9fc4f0..7b6af63b 100755 --- a/11.5/docker-entrypoint.sh +++ b/11.5/docker-entrypoint.sh @@ -228,7 +228,17 @@ docker_init_database_dir() { mysql_note "Initializing database files" installArgs=( --datadir="$DATADIR" --rpm --auth-root-authentication-method=normal ) # "Other options are passed to mariadbd." (so we pass all "mariadbd" arguments directly here) - mariadb-install-db "${installArgs[@]}" "${@:2}" \ + + local mariadbdArgs=() + for arg in "${@:2}"; do + # Check if the argument contains whitespace + if [[ ! "$arg" =~ [[:space:]] ]]; then + mariadbdArgs+=("$arg") + else + mysql_warn Not passing argument \'$arg\' to mariadb-install-db because mariadb-install-db does not support arguments with whitespace. + fi + done + mariadb-install-db "${installArgs[@]}" "${mariadbdArgs[@]}" \ --skip-test-db \ --old-mode='UTF8_IS_UTF8MB3' \ --default-time-zone=SYSTEM --enforce-storage-engine= \ diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 9bf76235..bf65735f 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -228,7 +228,17 @@ docker_init_database_dir() { mysql_note "Initializing database files" installArgs=( --datadir="$DATADIR" --rpm --auth-root-authentication-method=normal ) # "Other options are passed to mysqld." (so we pass all "mysqld" arguments directly here) - mysql_install_db "${installArgs[@]}" "${@:2}" \ + + local mariadbdArgs=() + for arg in "${@:2}"; do + # Check if the argument contains whitespace + if [[ ! "$arg" =~ [[:space:]] ]]; then + mariadbdArgs+=("$arg") + else + mysql_warn Not passing argument \'$arg\' to mariadb-install-db because mariadb-install-db does not support arguments with whitespace. + fi + done + mysql_install_db "${installArgs[@]}" "${mariadbdArgs[@]}" \ --skip-test-db \ --old-mode='UTF8_IS_UTF8MB3' \ --default-time-zone=SYSTEM --enforce-storage-engine= \