Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit30b2731

Browse files
committed
Fix TAP tests and MSVC scripts for pathnames with spaces.
Change assorted places in our Perl code that did things likesystem("prog $path/file");to do it more likesystem('prog', "$path/file");which is safe against spaces and other special characters in the pathvariable. The latter was already the prevailing style, but a few bitsof code hadn't gotten this memo. Back-patch to 9.4 as relevant.Michael Paquier, Kyotaro HoriguchiDiscussion: <20160704.160213.111134711.horiguchi.kyotaro@lab.ntt.co.jp>
1 parentc575627 commit30b2731

File tree

3 files changed

+39
-20
lines changed

3 files changed

+39
-20
lines changed

‎src/test/perl/PostgresNode.pm

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,8 @@ sub backup
475475
my$name =$self->name;
476476

477477
print"# Taking pg_basebackup$backup_name from node\"$name\"\n";
478-
TestLib::system_or_bail("pg_basebackup -D$backup_path -p$port -x");
478+
TestLib::system_or_bail('pg_basebackup','-D',$backup_path,
479+
'-p',$port,'-x');
479480
print"# Backup finished\n";
480481
}
481482

@@ -763,7 +764,7 @@ sub enable_restoring
763764
my$copy_command =
764765
$TestLib::windows_os
765766
?qq{copy "$path\\\\%f" "%p"}
766-
:qq{cp$path/%f%p};
767+
:qq{cp"$path/%f" "%p"};
767768

768769
$self->append_conf(
769770
'recovery.conf',qq(
@@ -791,7 +792,7 @@ sub enable_archiving
791792
my$copy_command =
792793
$TestLib::windows_os
793794
?qq{copy "%p" "$path\\\\%f"}
794-
:qq{cp%p$path/%f};
795+
:qq{cp"%p" "$path/%f"};
795796

796797
# Enable archive_mode and archive_command on node
797798
$self->append_conf(

‎src/tools/msvc/Install.pm

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -381,12 +381,21 @@ sub GenerateTimezoneFiles
381381
my$mf = read_file("src/timezone/Makefile");
382382
$mf =~s{\\\r?\n}{}g;
383383
$mf =~/^TZDATA\s*:?=\s*(.*)$/m
384-
||die"Could not find TZDATArow in timezone makefile\n";
384+
||die"Could not find TZDATAline in timezone makefile\n";
385385
my@tzfiles =split /\s+/,$1;
386-
unshift@tzfiles,'';
386+
387387
print"Generating timezone files...";
388-
system("$conf\\zic\\zic -d\"$target/share/timezone\""
389-
.join(" src/timezone/data/",@tzfiles));
388+
389+
my@args = ("$conf/zic/zic",
390+
'-d',
391+
"$target/share/timezone");
392+
foreach (@tzfiles)
393+
{
394+
my$tzfile =$_;
395+
push(@args,"src/timezone/data/$tzfile")
396+
}
397+
398+
system(@args);
390399
print"\n";
391400
}
392401

@@ -634,9 +643,10 @@ sub CopyIncludeFiles
634643
nextunless (-d"src/include/$d");
635644

636645
EnsureDirectories("$target/include/server/$d");
637-
system(
638-
qq{xcopy /s /i /q /r /y src\\include\\$d\\*.h "$ctarget\\include\\server\\$d\\"}
639-
) && croak("Failed to copy include directory$d\n");
646+
my@args = ('xcopy','/s','/i','/q','/r','/y',
647+
"src\\include\\$d\\*.h",
648+
"$ctarget\\include\\server\\$d\\");
649+
system(@args) && croak("Failed to copy include directory$d\n");
640650
}
641651
closedir($D);
642652

@@ -689,9 +699,11 @@ sub GenerateNLSFiles
689699

690700
EnsureDirectories($target,"share/locale/$lang",
691701
"share/locale/$lang/LC_MESSAGES");
692-
system(
693-
"\"$nlspath\\bin\\msgfmt\" -o\"$target\\share\\locale\\$lang\\LC_MESSAGES\\$prgm-$majorver.mo\"$_"
694-
) && croak("Could not run msgfmt on$dir\\$_");
702+
my@args = ("$nlspath\\bin\\msgfmt",
703+
'-o',
704+
"$target\\share\\locale\\$lang\\LC_MESSAGES\\$prgm-$majorver.mo",
705+
$_);
706+
system(@args) && croak("Could not run msgfmt on$dir\\$_");
695707
print".";
696708
}
697709
}

‎src/tools/msvc/vcregress.pl

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -412,35 +412,41 @@ sub upgradecheck
412412
print"\nRunning initdb on old cluster\n\n";
413413
standard_initdb()orexit 1;
414414
print"\nStarting old cluster\n\n";
415-
system("pg_ctl start -l$logdir/postmaster1.log -w") == 0orexit 1;
415+
my@args = ('pg_ctl','start','-l',"$logdir/postmaster1.log",'-w');
416+
system(@args) == 0orexit 1;
416417
print"\nSetting up data for upgrading\n\n";
417418
installcheck();
418419

419420
# now we can chdir into the source dir
420421
chdir"$topdir/src/bin/pg_upgrade";
421422
print"\nDumping old cluster\n\n";
422-
system("pg_dumpall -f$tmp_root/dump1.sql") == 0orexit 1;
423+
@args = ('pg_dumpall','-f',"$tmp_root/dump1.sql");
424+
system(@args) == 0orexit 1;
423425
print"\nStopping old cluster\n\n";
424426
system("pg_ctl -m fast stop") == 0orexit 1;
425427
$ENV{PGDATA} ="$data";
426428
print"\nSetting up new cluster\n\n";
427429
standard_initdb()orexit 1;
428430
print"\nRunning pg_upgrade\n\n";
429-
system("pg_upgrade -d$data.old -D$data -b$bindir -B$bindir") == 0
430-
orexit 1;
431+
@args = ('pg_upgrade','-d',"$data.old",'-D',$data,'-b',$bindir,
432+
'-B',$bindir);
433+
system(@args) == 0orexit 1;
431434
print"\nStarting new cluster\n\n";
432-
system("pg_ctl -l$logdir/postmaster2.log -w start") == 0orexit 1;
435+
@args = ('pg_ctl','-l',"$logdir/postmaster2.log",'-w','start');
436+
system(@args) == 0orexit 1;
433437
print"\nSetting up stats on new cluster\n\n";
434438
system(".\\analyze_new_cluster.bat") == 0orexit 1;
435439
print"\nDumping new cluster\n\n";
436-
system("pg_dumpall -f$tmp_root/dump2.sql") == 0orexit 1;
440+
@args = ('pg_dumpall','-f',"$tmp_root/dump2.sql");
441+
system(@args) == 0orexit 1;
437442
print"\nStopping new cluster\n\n";
438443
system("pg_ctl -m fast stop") == 0orexit 1;
439444
print"\nDeleting old cluster\n\n";
440445
system(".\\delete_old_cluster.bat") == 0orexit 1;
441446
print"\nComparing old and new cluster dumps\n\n";
442447

443-
system("diff -q$tmp_root/dump1.sql$tmp_root/dump2.sql");
448+
@args = ('diff','-q',"$tmp_root/dump1.sql","$tmp_root/dump2.sql");
449+
system(@args);
444450
$status =$?;
445451
if (!$status)
446452
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp