Skip to content
Browse files

MDEV-20185: Windows: Use of uninitialized value $bpath in string eq

The execution of mtr in the Windows environment fails due to
the fact that the new code from MDEV-18565 does not take into
account the need to add the ".exe" extension to the names of
executable files when searching for pre-requisites that are
needed to run SST scripts (especially when using mariabackup)
and when searching paths to some other Galera utilities.
This patch fixes this flaw.

Also adding paths to the PATH environment variable is now
done with the correct delimiter character.
  • Loading branch information...
Julius Goryavsky
Julius Goryavsky committed Jul 30, 2019
1 parent 137d8ed commit c93f96e2ec3d4beb9bd2ed2b2cf509d88a165809
Showing with 25 additions and 14 deletions.
  1. +22 −11 mysql-test/
  2. +3 −3 mysql-test/
@@ -445,26 +445,36 @@ ()
# ADD scripts to $PATH to that wsrep_sst_* can be found
my ($spath) = grep { -f "$_/wsrep_sst_rsync"; } "$bindir/scripts", $path_client_bindir;
mtr_error("No SST scripts") unless $spath;
my $separator= (IS_WINDOWS) ? ';' : ':';

# ADD mysql client library path to path so that wsrep_notify_cmd can find mysql
# client for loading the tables. (Don't assume each machine has mysql install)
my ($cpath) = grep { -f "$_/mysql"; } "$bindir/scripts", $path_client_bindir;
mtr_error("No scritps") unless $cpath;
$ENV{PATH}="$cpath:$ENV{PATH}" unless $cpath eq $spath;
$ENV{PATH}="$cpath$separator$ENV{PATH}" unless $cpath eq $spath;

# ADD my_print_defaults script path to path so that SST scripts can find it
my ($epath) = grep { -f "$_/my_print_defaults"; } "$bindir/extra", $path_client_bindir;
my $my_print_defaults_exe=
my $epath= "";
if ($my_print_defaults_exe ne "") {
$epath= dirname($my_print_defaults_exe);
mtr_error("No my_print_defaults") unless $epath;
$ENV{PATH}="$epath:$ENV{PATH}" unless ($epath eq $spath) or
($epath eq $cpath);
$ENV{PATH}="$epath$separator$ENV{PATH}" unless ($epath eq $spath) or
($epath eq $cpath);

$extra_path= $epath;

if (which("socat")) {
} elsif (which("nc")) {
if (!IS_WINDOWS) {
if (which("socat")) {
} elsif (which("nc")) {

# Check whether WSREP_PROVIDER environment variable is set.
@@ -511,8 +521,9 @@ ()
if ($mariabackup_exe ne "") {
my ($bpath) = grep { -f "$_/mariabackup"; } "$bindir/extra/mariabackup$opt_vs_config", $path_client_bindir;
$ENV{PATH}="$bpath:$ENV{PATH}" unless $bpath eq $extra_path;
my $bpath= dirname($mariabackup_exe);
my $separator= (IS_WINDOWS) ? ';' : ':';
$ENV{PATH}="$bpath$separator$ENV{PATH}" unless $bpath eq $extra_path;

$mariabackup_path= $bpath;

@@ -54,11 +54,11 @@ sub skip_combinations {
$skip{'include/'} = 'Need mariabackup'
unless ::have_mariabackup();

$skip{'include/'} = 'Need ss'
unless ::which("ss");
$skip{'include/'} = 'Need socket statistics utility'
unless IS_WINDOWS || ::which("ss");

$skip{'include/'} = 'Need socat or nc'

$skip{'include/'} = 'Need garbd'
unless ::have_garbd();

0 comments on commit c93f96e

Please sign in to comment.
You can’t perform that action at this time.