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-.