Double quotes on password prompt breaks the script #251

Open
blopper opened this Issue Oct 8, 2016 · 2 comments

Projects

None yet

2 participants

@blopper
blopper commented Oct 8, 2016

If you have double quotes ( " ) in your root mysql password mysqltuner will exit with an error unable to match " This is a shell error, see output bellow

`# ./mysqltuner.pl

MySQLTuner 1.7.0 - Major Hayden major@mhtx.net
Bug reports, feature requests, and downloads at http://mysqltuner.com/
Run with '--help' for additional options and output filtering

[--] Skipped version check for MySQLTuner script
Please enter your MySQL administrative login: root
Please enter your MySQL administrative password: sh: -c: line 0: unexpected EOF while looking for matching "' sh: -c: line 1: syntax error: unexpected end of file [!!] Attempted to use login credentials, but they were invalid. [root@D2189 major-MySQLTuner-perl-3c53f7b]#

@jmrenouard
Collaborator

Hi @blopper

Main issue regarding support double quotes password is that Unixoid Os interpolated systematically $ character as a environment variables.

So this is not an issue we can solve easily.

We will have other issue telling us that double quote password with $ doesn't work.

So I will need help if someone have a better idea regarding this issue.

Thanks for your feedback.

@jmrenouard

@blopper
blopper commented Oct 11, 2016 edited

$(printf '%q' $user_raw_passwd_input) perhaps would do?

[root@D2189 ~]# raw='fuck"shit$up!@#$%^&*()'
[root@D2189 ~]# printf '%q\n' $raw
fuck\"shit\$up\!@#\$%\^\&\*\(\)

@jmrenouard jmrenouard added enhancement and removed Questions labels Oct 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment