Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
5.5.38, 10.0.12
-
None
-
None
Description
At the moment, if an invalid parameter is put on the [mysqld_safe] section of my.cnf, it is not parsed, no warning is throwed and mysqld_safe is continuing execution without an error code.
Its not consistent with the usual way of handling incorrect variables (abort the execution and throw an error message) on mysqld and tools such as mysqldump.
–
How to reproduce :
- Add an incorrect variable such as badvar=1 on a [mysqld_safe] section of your my.cnf file
- Restart MariaDB using the init script or directly mysqld_safe : it will succeed without a warning
–
Here is a quick fix that makes mysqld_safe exit and throw an error to stderr :
--- mysqld_safe.orig 2014-02-24 05:35:19.000000000 +0100
|
+++ mysqld_safe 2014-03-27 10:34:32.775201218 +0100
|
@@ -193,11 +193,17 @@
|
# handle them here. So, we collect unrecognized options (passed on
|
# the command line) into the args variable.
|
pick_args=
|
+ mysqld_safe_args=
|
if test "$1" = PICK-ARGS-FROM-ARGV
|
then
|
pick_args=1
|
shift
|
fi
|
+ if test "$1" = MYSQLD-SAFE-ARGS
|
+ then
|
+ mysqld_safe_args=1
|
+ shift
|
+ fi
|
|
for arg do
|
# the parameter after "=", or the whole $arg if no match
|
@@ -255,6 +261,14 @@
|
--help) usage ;;
|
|
*)
|
+ if test -n "$mysqld_safe_args"
|
+ then
|
+ log_error "unknown variable '$arg'"
|
+ if test "${arg::8}" != "--loose-"
|
+ then
|
+ exit 1
|
+ fi
|
+ fi
|
if test -n "$pick_args"
|
then
|
append_arg_to_args "$arg"
|
@@ -516,7 +530,7 @@
|
SET_USER=0
|
fi
|
|
-parse_arguments `$print_defaults $defaults --loose-verbose mysqld_safe safe_mysqld mariadb_safe`
|
+parse_arguments MYSQLD-SAFE-ARGS `$print_defaults $defaults --loose-verbose mysqld_safe safe_mysqld mariadb_safe`
|
parse_arguments PICK-ARGS-FROM-ARGV "$@"
|
|
|
After applying the patch : the execution of mysqld_safe will abort with an error code of 1 and will throw an error.
–
ps 27/03: modified the patch not to abort execution in case the variable would be prefixed with loose-.
Attachments
Activity
Field | Original Value | New Value |
---|---|---|
Description |
At the moment, if an invalid parameter in put on the _\[mysqld_safe]_ section of my.cnf, it is not parsed but no warning is throwed and mysqld_safe is continuing execution without an error code. Its not consistent with the usual way of handling incorrect variables (abort the execution and throw an error message) on _mysqld_ and tools such as _mysqldump_. -- How to reproduce : * Add an incorrect variable such as _badvar=1_ on a _\[mysqld_safe]_ section of your my.cnf file * Restart MariaDB using the init script or directly mysqld_safe, it will succeed without a warning -- Here is a quick fix that makes mysqld_safe exit and throw an error to stderr : {noformat}--- mysqld_safe.orig 2014-02-24 05:35:19.000000000 +0100 +++ mysqld_safe 2014-03-26 19:07:11.852284872 +0100 @@ -193,11 +193,17 @@ # handle them here. So, we collect unrecognized options (passed on # the command line) into the args variable. pick_args= + mysqld_safe_args= if test "$1" = PICK-ARGS-FROM-ARGV then pick_args=1 shift fi + if test "$1" = MYSQLD-SAFE-ARGS + then + mysqld_safe_args=1 + shift + fi for arg do # the parameter after "=", or the whole $arg if no match @@ -255,6 +261,11 @@ --help) usage ;; *) + if test -n "$mysqld_safe_args" + then + log_error "unknown variable '$arg'" + exit 1 + fi if test -n "$pick_args" then append_arg_to_args "$arg" @@ -516,7 +527,7 @@ SET_USER=0 fi -parse_arguments `$print_defaults $defaults --loose-verbose mysqld_safe safe_mysqld mariadb_safe` +parse_arguments MYSQLD-SAFE-ARGS `$print_defaults $defaults --loose-verbose mysqld_safe safe_mysqld mariadb_safe` parse_arguments PICK-ARGS-FROM-ARGV "$@" {noformat} After applying the patch : the execution of mysqld_safe will abort with an error code of 1 and will throw an error. |
At the moment, if an invalid parameter in put on the _\[mysqld_safe]_ section of my.cnf, it is not parsed but no warning is throwed and mysqld_safe is continuing execution without an error code. Its not consistent with the usual way of handling incorrect variables (abort the execution and throw an error message) on _mysqld_ and tools such as _mysqldump_. -- How to reproduce : * Add an incorrect variable such as _badvar=1_ on a _\[mysqld_safe]_ section of your my.cnf file * Restart MariaDB using the init script or directly mysqld_safe, it will succeed without a warning -- Here is a quick fix that makes mysqld_safe exit and throw an error to stderr : {noformat}--- mysqld_safe.orig 2014-02-24 05:35:19.000000000 +0100 +++ mysqld_safe 2014-03-27 10:34:32.775201218 +0100 @@ -193,11 +193,17 @@ # handle them here. So, we collect unrecognized options (passed on # the command line) into the args variable. pick_args= + mysqld_safe_args= if test "$1" = PICK-ARGS-FROM-ARGV then pick_args=1 shift fi + if test "$1" = MYSQLD-SAFE-ARGS + then + mysqld_safe_args=1 + shift + fi for arg do # the parameter after "=", or the whole $arg if no match @@ -255,6 +261,14 @@ --help) usage ;; *) + if test -n "$mysqld_safe_args" + then + log_error "unknown variable '$arg'" + if test "${arg::8}" != "--loose-" + then + exit 1 + fi + fi if test -n "$pick_args" then append_arg_to_args "$arg" @@ -516,7 +530,7 @@ SET_USER=0 fi -parse_arguments `$print_defaults $defaults --loose-verbose mysqld_safe safe_mysqld mariadb_safe` +parse_arguments MYSQLD-SAFE-ARGS `$print_defaults $defaults --loose-verbose mysqld_safe safe_mysqld mariadb_safe` parse_arguments PICK-ARGS-FROM-ARGV "$@" {noformat} After applying the patch : the execution of mysqld_safe will abort with an error code of 1 and will throw an error. -- ps 27/03: modified the patch not to abort execution in case the variable would be prefixed with _loose-_. |
Summary | Handle invalid arguments on the [mysqld_safe] section of my.cnf | Inconsitent handling of invalid arguments for mysqld_safe |
Description |
At the moment, if an invalid parameter in put on the _\[mysqld_safe]_ section of my.cnf, it is not parsed but no warning is throwed and mysqld_safe is continuing execution without an error code. Its not consistent with the usual way of handling incorrect variables (abort the execution and throw an error message) on _mysqld_ and tools such as _mysqldump_. -- How to reproduce : * Add an incorrect variable such as _badvar=1_ on a _\[mysqld_safe]_ section of your my.cnf file * Restart MariaDB using the init script or directly mysqld_safe, it will succeed without a warning -- Here is a quick fix that makes mysqld_safe exit and throw an error to stderr : {noformat}--- mysqld_safe.orig 2014-02-24 05:35:19.000000000 +0100 +++ mysqld_safe 2014-03-27 10:34:32.775201218 +0100 @@ -193,11 +193,17 @@ # handle them here. So, we collect unrecognized options (passed on # the command line) into the args variable. pick_args= + mysqld_safe_args= if test "$1" = PICK-ARGS-FROM-ARGV then pick_args=1 shift fi + if test "$1" = MYSQLD-SAFE-ARGS + then + mysqld_safe_args=1 + shift + fi for arg do # the parameter after "=", or the whole $arg if no match @@ -255,6 +261,14 @@ --help) usage ;; *) + if test -n "$mysqld_safe_args" + then + log_error "unknown variable '$arg'" + if test "${arg::8}" != "--loose-" + then + exit 1 + fi + fi if test -n "$pick_args" then append_arg_to_args "$arg" @@ -516,7 +530,7 @@ SET_USER=0 fi -parse_arguments `$print_defaults $defaults --loose-verbose mysqld_safe safe_mysqld mariadb_safe` +parse_arguments MYSQLD-SAFE-ARGS `$print_defaults $defaults --loose-verbose mysqld_safe safe_mysqld mariadb_safe` parse_arguments PICK-ARGS-FROM-ARGV "$@" {noformat} After applying the patch : the execution of mysqld_safe will abort with an error code of 1 and will throw an error. -- ps 27/03: modified the patch not to abort execution in case the variable would be prefixed with _loose-_. |
At the moment, if an invalid parameter is put on the _\[mysqld_safe]_ section of my.cnf, it is not parsed, no warning is throwed and mysqld_safe is continuing execution without an error code. Its not consistent with the usual way of handling incorrect variables (abort the execution and throw an error message) on _mysqld_ and tools such as _mysqldump_. -- How to reproduce : * Add an incorrect variable such as _badvar=1_ on a _\[mysqld_safe]_ section of your my.cnf file * Restart MariaDB using the init script or directly mysqld_safe : it will succeed without a warning -- Here is a quick fix that makes mysqld_safe exit and throw an error to stderr : {noformat}--- mysqld_safe.orig 2014-02-24 05:35:19.000000000 +0100 +++ mysqld_safe 2014-03-27 10:34:32.775201218 +0100 @@ -193,11 +193,17 @@ # handle them here. So, we collect unrecognized options (passed on # the command line) into the args variable. pick_args= + mysqld_safe_args= if test "$1" = PICK-ARGS-FROM-ARGV then pick_args=1 shift fi + if test "$1" = MYSQLD-SAFE-ARGS + then + mysqld_safe_args=1 + shift + fi for arg do # the parameter after "=", or the whole $arg if no match @@ -255,6 +261,14 @@ --help) usage ;; *) + if test -n "$mysqld_safe_args" + then + log_error "unknown variable '$arg'" + if test "${arg::8}" != "--loose-" + then + exit 1 + fi + fi if test -n "$pick_args" then append_arg_to_args "$arg" @@ -516,7 +530,7 @@ SET_USER=0 fi -parse_arguments `$print_defaults $defaults --loose-verbose mysqld_safe safe_mysqld mariadb_safe` +parse_arguments MYSQLD-SAFE-ARGS `$print_defaults $defaults --loose-verbose mysqld_safe safe_mysqld mariadb_safe` parse_arguments PICK-ARGS-FROM-ARGV "$@" {noformat} After applying the patch : the execution of mysqld_safe will abort with an error code of 1 and will throw an error. -- ps 27/03: modified the patch not to abort execution in case the variable would be prefixed with _loose-_. |
Workflow | defaullt [ 37408 ] | MariaDB v2 [ 43061 ] |
Fix Version/s | 5.5.39 [ 15800 ] |
Issue Type | Task [ 3 ] | Bug [ 1 ] |
Affects Version/s | 5.5.38 [ 15400 ] | |
Affects Version/s | 10.0.12 [ 15201 ] |
Fix Version/s | 10.0.13 [ 16000 ] |
Assignee | Sergei Golubchik [ serg ] |
Status | Open [ 1 ] | In Progress [ 3 ] |
Fix Version/s | 10.0.13 [ 16300 ] | |
Fix Version/s | 5.5.39 [ 16301 ] | |
Fix Version/s | 5.5 [ 15800 ] | |
Fix Version/s | 10.0 [ 16000 ] | |
Resolution | Fixed [ 1 ] | |
Status | In Progress [ 3 ] | Closed [ 6 ] |
Workflow | MariaDB v2 [ 43061 ] | MariaDB v3 [ 63713 ] |
Workflow | MariaDB v3 [ 63713 ] | MariaDB v4 [ 147702 ] |