@ -664,6 +664,49 @@ static int sst_append_env_var(wsp::env& env,
return - env . error ( ) ;
}
# ifdef __WIN__
/*
Space , single quote , ampersand , backquote , I / O redirection
characters , caret , all brackets , plus , exclamation and comma
characters require text to be enclosed in double quotes :
*/
# define IS_SPECIAL(c) \
( isspace ( c ) | | c = = ' \' ' | | c = = ' & ' | | c = = ' ` ' | | c = = ' | ' | | \
c = = ' > ' | | c = = ' < ' | | c = = ' ; ' | | c = = ' ^ ' | | \
c = = ' [ ' | | c = = ' ] ' | | c = = ' { ' | | c = = ' } ' | | \
c = = ' ( ' | | c = = ' ) ' | | c = = ' + ' | | c = = ' ! ' | | \
c = = ' , ' )
/*
Inside values , equals character are interpreted as special
character and requires quotation :
*/
# define IS_SPECIAL_V(c) (IS_SPECIAL(c) || c == '=')
/*
Double quotation mark and percent characters require escaping :
*/
# define IS_REQ_ESCAPING(c) (c == '""' || c == '%')
# else
/*
Space , single quote , ampersand , backquote , and I / O redirection
characters require text to be enclosed in double quotes . The
semicolon is used to separate shell commands , so it must be
enclosed in double quotes as well :
*/
# define IS_SPECIAL(c) \
( isspace ( c ) | | c = = ' \' ' | | c = = ' & ' | | c = = ' ` ' | | c = = ' | ' | | \
c = = ' > ' | | c = = ' < ' | | c = = ' ; ' )
/*
Inside values , characters are interpreted as in parameter names :
*/
# define IS_SPECIAL_V(c) IS_SPECIAL(c)
/*
Double quotation mark and backslash characters require
backslash prefixing , the dollar symbol is used to substitute
a variable value , therefore it also requires escaping :
*/
# define IS_REQ_ESCAPING(c) (c == '"' || c == '\\' || c == '$')
# endif
static size_t estimate_cmd_len ( bool * extra_args )
{
/*
@ -688,22 +731,16 @@ static size_t estimate_cmd_len (bool* extra_args)
char c ;
while ( ( c = * arg + + ) ! = 0 )
{
/*
Space , single quote , ampersand , and I / O redirection characters
require text to be enclosed in double quotes :
*/
if ( isspace ( c ) | | c = = ' \' ' | | c = = ' & ' | | c = = ' | ' | |
# ifdef __WIN__
c = = ' > ' | | c = = ' < ' )
# else
/*
The semicolon is used to separate shell commands , so it must be
enclosed in double quotes as well :
*/
c = = ' > ' | | c = = ' < ' | | c = = ' ; ' )
# endif
if ( IS_SPECIAL ( c ) )
{
quotation = true ;
}
else if ( IS_REQ_ESCAPING ( c ) )
{
cmd_len + + ;
# ifdef __WIN__
quotation = true ;
# endif
}
/*
If the equals symbol is encountered , then we need to separately
@ -723,58 +760,20 @@ static size_t estimate_cmd_len (bool* extra_args)
}
while ( ( c = * arg + + ) ! = 0 )
{
/*
Space , single quote , ampersand , and I / O redirection characters
require text to be enclosed in double quotes :
*/
if ( isspace ( c ) | | c = = ' \' ' | | c = = ' & ' | | c = = ' | ' | |
# ifdef __WIN__
c = = ' > ' | | c = = ' < ' )
# else
/*
The semicolon is used to separate shell commands , so it must be
enclosed in double quotes as well :
*/
c = = ' > ' | | c = = ' < ' | | c = = ' ; ' )
# endif
if ( IS_SPECIAL_V ( c ) )
{
quotation = true ;
}
/*
Double quotation mark or backslash symbol requires backslash
prefixing :
*/
# ifdef __WIN__
else if ( c = = ' " ' | | c = = ' \\ ' )
# else
/*
The dollar symbol is used to substitute a variable , therefore
it also requires escaping :
*/
else if ( c = = ' " ' | | c = = ' \\ ' | | c = = ' $ ' )
# endif
else if ( IS_REQ_ESCAPING ( c ) )
{
cmd_len + + ;
# ifdef __WIN__
quotation = true ;
# endif
}
}
break ;
}
/*
Double quotation mark or backslash symbol requires backslash
prefixing :
*/
# ifdef __WIN__
else if ( c = = ' " ' | | c = = ' \\ ' )
# else
/*
The dollar symbol is used to substitute a variable , therefore
it also requires escaping :
*/
else if ( c = = ' " ' | | c = = ' \\ ' | | c = = ' $ ' )
# endif
{
cmd_len + + ;
}
}
/* Perhaps we need to quote the entire argument or its right part: */
if ( quotation )
@ -817,22 +816,16 @@ static void copy_orig_argv (char* cmd_str)
char c ;
while ( ( c = * arg_scan + + ) ! = 0 )
{
/*
Space , single quote , ampersand , and I / O redirection characters
require text to be enclosed in double quotes :
*/
if ( isspace ( c ) | | c = = ' \' ' | | c = = ' & ' | | c = = ' | ' | |
# ifdef __WIN__
c = = ' > ' | | c = = ' < ' )
# else
/*
The semicolon is used to separate shell commands , so it must be
enclosed in double quotes as well :
*/
c = = ' > ' | | c = = ' < ' | | c = = ' ; ' )
# endif
if ( IS_SPECIAL ( c ) )
{
quotation = true ;
}
else if ( IS_REQ_ESCAPING ( c ) )
{
plain = false ;
# ifdef __WIN__
quotation = true ;
# endif
}
/*
If the equals symbol is encountered , then we need to separately
@ -868,13 +861,13 @@ static void copy_orig_argv (char* cmd_str)
while ( m )
{
c = * arg + + ;
if ( IS_REQ_ESCAPING ( c ) )
{
# ifdef __WIN__
if ( c = = ' " ' | | c = = ' \\ ' )
* cmd_str + + = c ;
# else
if ( c = = ' " ' | | c = = ' \\ ' | | c = = ' $ ' )
# endif
{
* cmd_str + + = ' \\ ' ;
# endif
}
* cmd_str + + = c ;
m - - ;
@ -903,58 +896,20 @@ static void copy_orig_argv (char* cmd_str)
/* Let's deal with the left side of the expression: */
while ( ( c = * arg_scan + + ) ! = 0 )
{
/*
Space , single quote , ampersand , and I / O redirection characters
require text to be enclosed in double quotes :
*/
if ( isspace ( c ) | | c = = ' \' ' | | c = = ' & ' | | c = = ' | ' | |
# ifdef __WIN__
c = = ' > ' | | c = = ' < ' )
# else
/*
The semicolon is used to separate shell commands , so it must be
enclosed in double quotes as well :
*/
c = = ' > ' | | c = = ' < ' | | c = = ' ; ' )
# endif
if ( IS_SPECIAL_V ( c ) )
{
quotation = true ;
}
/*
Double quotation mark or backslash symbol requires backslash
prefixing :
*/
# ifdef __WIN__
else if ( c = = ' " ' | | c = = ' \\ ' )
# else
/*
The dollar symbol is used to substitute a variable , therefore
it also requires escaping :
*/
else if ( c = = ' " ' | | c = = ' \\ ' | | c = = ' $ ' )
# endif
else if ( IS_REQ_ESCAPING ( c ) )
{
plain = false ;
# ifdef __WIN__
quotation = true ;
# endif
}
}
break ;
}
/*
Double quotation mark or backslash symbol requires backslash
prefixing :
*/
# ifdef __WIN__
else if ( c = = ' " ' | | c = = ' \\ ' )
# else
/*
The dollar symbol is used to substitute a variable , therefore
it also requires escaping :
*/
else if ( c = = ' " ' | | c = = ' \\ ' | | c = = ' $ ' )
# endif
{
plain = false ;
}
}
if ( n )
{
@ -977,13 +932,13 @@ static void copy_orig_argv (char* cmd_str)
{
while ( ( c = * arg + + ) ! = 0 )
{
if ( IS_REQ_ESCAPING ( c ) )
{
# ifdef __WIN__
if ( c = = ' " ' | | c = = ' \\ ' )
* cmd_str + + = c ;
# else
if ( c = = ' " ' | | c = = ' \\ ' | | c = = ' $ ' )
# endif
{
* cmd_str + + = ' \\ ' ;
# endif
}
* cmd_str + + = c ;
}
@ -1352,7 +1307,7 @@ static int sst_donate_mysqldump (const char* addr,
WSREP_SST_OPT_GTID " '%s:%lld' "
WSREP_SST_OPT_GTID_DOMAIN_ID " '%d' "
" %s " ,
addr , port , mysqld_port , mysqld_unix_port ,
addr , port , mysqld_port , mysqld_unix_port ,
wsrep_defaults_file , uuid_str ,
( long long ) seqno , wsrep_gtid_domain_id ,
bypass ? " " WSREP_SST_OPT_BYPASS : " " ) ;
@ -1476,7 +1431,7 @@ static int sst_flush_tables(THD* thd)
WSREP_WARN ( " Current client character set is non-supported parser character set: %s " , current_charset - > csname ) ;
thd - > variables . character_set_client = & my_charset_latin1 ;
WSREP_WARN ( " For SST temporally setting character set to : %s " ,
my_charset_latin1 . csname ) ;
my_charset_latin1 . csname ) ;
}
if ( run_sql_command ( thd , " FLUSH TABLES WITH READ LOCK " ) )
@ -1544,7 +1499,7 @@ static void sst_disallow_writes (THD* thd, bool yes)
WSREP_WARN ( " Current client character set is non-supported parser character set: %s " , current_charset - > csname ) ;
thd - > variables . character_set_client = & my_charset_latin1 ;
WSREP_WARN ( " For SST temporally setting character set to : %s " ,
my_charset_latin1 . csname ) ;
my_charset_latin1 . csname ) ;
}
snprintf ( query_str , query_max , " SET GLOBAL innodb_disallow_writes=%d " ,