mysql-multilib-r1.eclass: Fix password reading from my.cnf
We are reading multiple sections from my.cnf at once from my.cnf when
looking for the password for the mysql root user in
mysql-multilib-r1_pkg_config().
If each section has set a password option this will result in the following
invalid password value (with "set -x"):
++ local extra_options=
++ //usr/bin/my_print_defaults client mysql
++ sed -n '/^--password=/s,--password=,,gp'
+ MYSQL_ROOT_PASSWORD='*****
*****'
+ [[ *****
***** == \*\*\*\*\* ]]
+ set +x
Like you can see the two passwords are concatenated via newline in one
string which is not what we want.
With this commit we will no longer read all sections at once instead we
read section per section. We are now also telling the user where we are
looking for the password and where we found one. In addition this commit
adds a sanity check for newline to catch scenarios where the user for
example has inadvertently set multiple password options in one section
which we can't handle: In that case it is better to prompt for a password
like no password was set in my.cnf instead of initializing mysqld with a
mysql root password the user is not expecting.
Gentoo-Bug: https://bugs.gentoo.org/510724