From fdf2ee62e6365b2da3a288a90f1607d4ce5caf92 Mon Sep 17 00:00:00 2001 From: Tom Lane <tgl@sss.pgh.pa.us> Date: Mon, 11 Jul 2016 11:24:04 -0400 Subject: [PATCH] Fix TAP tests and MSVC scripts for pathnames with spaces. Back-patch relevant parts of commit 30b2731bd into 9.1-9.3. Michael Paquier, Kyotaro Horiguchi Discussion: <20160704.160213.111134711.horiguchi.kyotaro@lab.ntt.co.jp> --- src/tools/msvc/Install.pm | 32 ++++++++++++++++++++++---------- src/tools/msvc/vcregress.pl | 22 ++++++++++++++-------- 2 files changed, 36 insertions(+), 18 deletions(-) diff --git a/src/tools/msvc/Install.pm b/src/tools/msvc/Install.pm index 7205e232842..671d860ca34 100644 --- a/src/tools/msvc/Install.pm +++ b/src/tools/msvc/Install.pm @@ -309,12 +309,21 @@ sub GenerateTimezoneFiles my $mf = read_file("src/timezone/Makefile"); $mf =~ s{\\\s*[\r\n]+}{}mg; $mf =~ /^TZDATA\s*:?=\s*(.*)$/m - || die "Could not find TZDATA row in timezone makefile\n"; + || die "Could not find TZDATA line in timezone makefile\n"; my @tzfiles = split /\s+/, $1; - unshift @tzfiles, ''; + print "Generating timezone files..."; - system("$conf\\zic\\zic -d \"$target/share/timezone\" " - . join(" src/timezone/data/", @tzfiles)); + + my @args = ("$conf/zic/zic", + '-d', + "$target/share/timezone"); + foreach (@tzfiles) + { + my $tzfile = $_; + push(@args, "src/timezone/data/$tzfile") + } + + system(@args); print "\n"; } @@ -542,9 +551,10 @@ sub CopyIncludeFiles next unless (-d "src/include/$d"); EnsureDirectories("$target/include/server/$d"); - system( -qq{xcopy /s /i /q /r /y src\\include\\$d\\*.h "$ctarget\\include\\server\\$d\\"} - ) && croak("Failed to copy include directory $d\n"); + my @args = ('xcopy', '/s', '/i', '/q', '/r', '/y', + "src\\include\\$d\\*.h", + "$ctarget\\include\\server\\$d\\"); + system(@args) && croak("Failed to copy include directory $d\n"); } closedir($D); @@ -597,9 +607,11 @@ sub GenerateNLSFiles EnsureDirectories($target, "share/locale/$lang", "share/locale/$lang/LC_MESSAGES"); - system( -"\"$nlspath\\bin\\msgfmt\" -o \"$target\\share\\locale\\$lang\\LC_MESSAGES\\$prgm-$majorver.mo\" $_" - ) && croak("Could not run msgfmt on $dir\\$_"); + my @args = ("$nlspath\\bin\\msgfmt", + '-o', + "$target\\share\\locale\\$lang\\LC_MESSAGES\\$prgm-$majorver.mo", + $_); + system(@args) && croak("Could not run msgfmt on $dir\\$_"); print "."; } } diff --git a/src/tools/msvc/vcregress.pl b/src/tools/msvc/vcregress.pl index adbfa9f8db9..e1d6e71eda0 100644 --- a/src/tools/msvc/vcregress.pl +++ b/src/tools/msvc/vcregress.pl @@ -270,7 +270,7 @@ sub upgradecheck Install($tmp_install, $config); # Install does a chdir, so change back after that chdir $cwd; - my ($bindir,$libdir,$oldsrc,$newsrc) = + my ($bindir,$libdir,$oldsrc,$newsrc) = ("$tmp_install/bin", "$tmp_install/lib", $topdir, $topdir); $ENV{PATH} = "$bindir;$ENV{PATH}"; my $data = "$tmp_root/data"; @@ -280,34 +280,40 @@ sub upgradecheck print "\nRunning initdb on old cluster\n\n"; standard_initdb() or exit 1; print "\nStarting old cluster\n\n"; - system("pg_ctl start -l $logdir/postmaster1.log -w") == 0 or exit 1; + my @args = ('pg_ctl', 'start', '-l', "$logdir/postmaster1.log", '-w'); + system(@args) == 0 or exit 1; print "\nSetting up data for upgrading\n\n"; installcheck(); # now we can chdir into the source dir chdir "$topdir/contrib/pg_upgrade"; print "\nDumping old cluster\n\n"; - system("pg_dumpall -f $tmp_root/dump1.sql") == 0 or exit 1; + @args = ('pg_dumpall', '-f', "$tmp_root/dump1.sql"); + system(@args) == 0 or exit 1; print "\nStopping old cluster\n\n"; system("pg_ctl -m fast stop") == 0 or exit 1; $ENV{PGDATA} = "$data"; print "\nSetting up new cluster\n\n"; standard_initdb() or exit 1; print "\nRunning pg_upgrade\n\n"; - system("pg_upgrade -d $data.old -D $data -b $bindir -B $bindir") == 0 - or exit 1; + @args = ('pg_upgrade', '-d', "$data.old", '-D', $data, '-b', $bindir, + '-B', $bindir); + system(@args) == 0 or exit 1; print "\nStarting new cluster\n\n"; - system("pg_ctl -l $logdir/postmaster2.log -w start") == 0 or exit 1; + @args = ('pg_ctl', '-l', "$logdir/postmaster2.log", '-w', 'start'); + system(@args) == 0 or exit 1; print "\nSetting up stats on new cluster\n\n"; system(".\\analyze_new_cluster.bat") == 0 or exit 1; print "\nDumping new cluster\n\n"; - system("pg_dumpall -f $tmp_root/dump2.sql") == 0 or exit 1; + @args = ('pg_dumpall', '-f', "$tmp_root/dump2.sql"); + system(@args) == 0 or exit 1; print "\nStopping new cluster\n\n"; system("pg_ctl -m fast stop") == 0 or exit 1; print "\nDeleting old cluster\n\n"; system(".\\delete_old_cluster.bat") == 0 or exit 1; print "\nComparing old and new cluster dumps\n\n"; - system("diff -q $tmp_root/dump1.sql $tmp_root/dump2.sql"); + @args = ('diff', '-q', "$tmp_root/dump1.sql", "$tmp_root/dump2.sql"); + system(@args); $status = $?; if (!$status) { -- GitLab