escape_for_shell() function escapes characters with "special" meaning to the shell, like \ or #, and also puts the result string into single quotes. Within single quotes these special characters do not have a special meaning though, especially a \ inside single quotes is just a regular character, eg:
$ echo \\
\
$ echo '\\'
\\
So for example a password containing a #, like secr#t, becomes 'secr\#t', while the correctly shell-escaped forms would be either secr\#t (with backslash but without single qoutes) or 'secr#t' (in single quotes, but without backslash). This then breaks invocation of external scripts like master_ip_failover and master_ip_online_change
The fix for this would be simple: do not put the already backslash-escaped string into extra single quotes:
escape_for_shell() function escapes characters with "special" meaning to the shell, like \ or #, and also puts the result string into single quotes. Within single quotes these special characters do not have a special meaning though, especially a \ inside single quotes is just a regular character, eg:
So for example a password containing a #, like
secr#t
, becomes'secr\#t'
, while the correctly shell-escaped forms would be eithersecr\#t
(with backslash but without single qoutes) or'secr#t'
(in single quotes, but without backslash). This then breaks invocation of external scripts likemaster_ip_failover
andmaster_ip_online_change
The fix for this would be simple: do not put the already backslash-escaped string into extra single quotes: