Skip to content

Commit 652ff98

Browse files
committed
Remove PostgreSQL::Test::Utils::perl2host completely
Commit f1ac4a7 disabled this processing, and as nothing has broken (as expected) here we proceed to remove the routine and adjust all the call sites. Backpatch to release 10 Discussion: https://postgr.es/m/0ba775a2-8aa0-0d56-d780-69427cf6f33d@dunslane.net Discussion: https://postgr.es/m/20220125023609.5ohu3nslxgoygihl@alap3.anarazel.de
1 parent 2e30d77 commit 652ff98

File tree

11 files changed

+18
-86
lines changed

11 files changed

+18
-86
lines changed

src/bin/pg_basebackup/t/010_pg_basebackup.pl

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -239,13 +239,11 @@
239239
# for the tablespace directories, which hopefully won't run afoul of
240240
# the 99 character length limit.
241241
my $sys_tempdir = TestLib::tempdir_short;
242-
my $real_sys_tempdir = TestLib::perl2host($sys_tempdir) . "/tempdir";
243-
my $shorter_tempdir = $sys_tempdir . "/tempdir";
244-
dir_symlink "$tempdir", $shorter_tempdir;
242+
my $real_sys_tempdir = "$sys_tempdir/tempdir";
243+
dir_symlink "$tempdir", $real_sys_tempdir;
245244

246245
mkdir "$tempdir/tblspc1";
247246
my $realTsDir = "$real_sys_tempdir/tblspc1";
248-
my $real_tempdir = TestLib::perl2host($tempdir);
249247
$node->safe_psql('postgres',
250248
"CREATE TABLESPACE tblspc1 LOCATION '$realTsDir';");
251249
$node->safe_psql('postgres',
@@ -324,7 +322,7 @@
324322
foreach my $filename (@tempRelationFiles)
325323
{
326324
append_to_file(
327-
"$shorter_tempdir/tblspc1/$tblSpc1Id/$postgresOid/$filename",
325+
"$real_sys_tempdir/tblspc1/$tblSpc1Id/$postgresOid/$filename",
328326
'TEMP_RELATION');
329327
}
330328

@@ -334,9 +332,9 @@
334332

335333
$node->command_ok(
336334
[
337-
'pg_basebackup', '-D',
338-
"$tempdir/backup1", '-Fp',
339-
"-T$realTsDir=$real_tempdir/tbackup/tblspc1"
335+
'pg_basebackup', '-D',
336+
"$tempdir/backup1", '-Fp',
337+
"-T$realTsDir=$tempdir/tbackup/tblspc1",
340338
],
341339
'plain format with tablespaces succeeds with tablespace mapping');
342340
ok(-d "$tempdir/tbackup/tblspc1", 'tablespace was relocated');
@@ -384,7 +382,7 @@
384382

385383
# Also remove temp relation files or tablespace drop will fail.
386384
my $filepath =
387-
"$shorter_tempdir/tblspc1/$tblSpc1Id/$postgresOid/$filename";
385+
"$real_sys_tempdir/tblspc1/$tblSpc1Id/$postgresOid/$filename";
388386

389387
unlink($filepath)
390388
or BAIL_OUT("unable to unlink $filepath");
@@ -404,9 +402,9 @@
404402
$realTsDir =~ s/=/\\=/;
405403
$node->command_ok(
406404
[
407-
'pg_basebackup', '-D',
408-
"$tempdir/backup3", '-Fp',
409-
"-T$realTsDir=$real_tempdir/tbackup/tbl\\=spc2"
405+
'pg_basebackup', '-D',
406+
"$tempdir/backup3", '-Fp',
407+
"-T$realTsDir=$tempdir/tbackup/tbl\\=spc2",
410408
],
411409
'mapping tablespace with = sign in path');
412410
ok(-d "$tempdir/tbackup/tbl=spc2", 'tablespace with = sign was relocated');

src/bin/pg_checksums/t/002_actions.pl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ sub check_relation_corruption
190190
my $basedir = $node->basedir;
191191
my $tablespace_dir = "$basedir/ts_corrupt_dir";
192192
mkdir($tablespace_dir);
193-
$tablespace_dir = TestLib::perl2host($tablespace_dir);
194193
$node->safe_psql('postgres',
195194
"CREATE TABLESPACE ts_corrupt LOCATION '$tablespace_dir';");
196195
check_relation_corruption($node, 'corrupt2', 'ts_corrupt');

src/bin/pg_verifybackup/t/003_corruption.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
# Include a user-defined tablespace in the hopes of detecting problems in that
2020
# area.
21-
my $source_ts_path = TestLib::perl2host(TestLib::tempdir_short());
21+
my $source_ts_path = TestLib::tempdir_short();
2222
my $source_ts_prefix = $source_ts_path;
2323
$source_ts_prefix =~ s!(^[A-Z]:/[^/]*)/.*!$1!;
2424

@@ -107,7 +107,7 @@
107107

108108
# Take a backup and check that it verifies OK.
109109
my $backup_path = $primary->backup_dir . '/' . $name;
110-
my $backup_ts_path = TestLib::perl2host(TestLib::tempdir_short());
110+
my $backup_ts_path = TestLib::tempdir_short();
111111
# The tablespace map parameter confuses Msys2, which tries to mangle
112112
# it. Tell it not to.
113113
# See https://www.msys2.org/wiki/Porting/#filesystem-namespaces

src/bin/pgbench/t/001_pgbench_with_server.pl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,10 @@
1919
# for partitioned tables.
2020
my $ts = $node->basedir . '/regress_pgbench_tap_1_ts_dir';
2121
mkdir $ts or die "cannot create directory $ts";
22-
# this takes care of WIN-specific path issues
23-
my $ets = TestLib::perl2host($ts);
2422

2523
# the next commands will issue a syntax error if the path contains a "'"
2624
$node->safe_psql('postgres',
27-
"CREATE TABLESPACE regress_pgbench_tap_1_ts LOCATION '$ets';");
25+
"CREATE TABLESPACE regress_pgbench_tap_1_ts LOCATION '$ts';");
2826

2927
# Test concurrent OID generation via pg_enum_oid_index. This indirectly
3028
# exercises LWLock and spinlock concurrency.

src/bin/scripts/t/090_reindexdb.pl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
# Create a tablespace for testing.
2222
my $tbspace_path = $node->basedir . '/regress_reindex_tbspace';
2323
mkdir $tbspace_path or die "cannot create directory $tbspace_path";
24-
$tbspace_path = TestLib::perl2host($tbspace_path);
2524
my $tbspace_name = 'reindex_tbspace';
2625
$node->safe_psql('postgres',
2726
"CREATE TABLESPACE $tbspace_name LOCATION '$tbspace_path';");

src/test/perl/PostgresNode.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,7 @@ primary_conninfo='$root_connstr'
10161016
sub enable_restoring
10171017
{
10181018
my ($self, $root_node, $standby) = @_;
1019-
my $path = TestLib::perl2host($root_node->archive_dir);
1019+
my $path = $root_node->archive_dir;
10201020
my $name = $self->name;
10211021

10221022
print "### Enabling WAL restore for node \"$name\"\n";
@@ -1084,7 +1084,7 @@ sub set_standby_mode
10841084
sub enable_archiving
10851085
{
10861086
my ($self) = @_;
1087-
my $path = TestLib::perl2host($self->archive_dir);
1087+
my $path = $self->archive_dir;
10881088
my $name = $self->name;
10891089

10901090
print "### Enabling WAL archiving for node \"$name\"\n";

src/test/perl/TestLib.pm

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ TestLib - helper module for writing PostgreSQL's C<prove> tests.
2424
2525
# Miscellanea
2626
print "on Windows" if $TestLib::windows_os;
27-
my $path = TestLib::perl2host($backup_dir);
2827
ok(check_mode_recursive($stream_dir, 0700, 0600),
2928
"check stream dir permissions");
3029
TestLib::system_log('pg_ctl', 'kill', 'QUIT', $slow_pid);
@@ -298,61 +297,6 @@ sub tempdir_short
298297

299298
=pod
300299
301-
=item perl2host()
302-
303-
Translate a virtual file name to a host file name. Currently, this is a no-op
304-
except for the case of Perl=msys and host=mingw32. The subject need not
305-
exist, but its parent or grandparent directory must exist unless cygpath is
306-
available.
307-
308-
The returned path uses forward slashes but has no trailing slash.
309-
310-
=cut
311-
312-
sub perl2host
313-
{
314-
my ($subject) = @_;
315-
return $subject unless $Config{osname} eq 'msys';
316-
if ($is_msys2)
317-
{
318-
# get absolute, windows type path
319-
my $path = qx{cygpath -a -m "$subject"};
320-
if (!$?)
321-
{
322-
chomp $path;
323-
$path =~ s!/$!!;
324-
return $path if $path;
325-
}
326-
# fall through if this didn't work.
327-
}
328-
my $here = cwd;
329-
my $leaf;
330-
if (chdir $subject)
331-
{
332-
$leaf = '';
333-
}
334-
else
335-
{
336-
$leaf = '/' . basename $subject;
337-
my $parent = dirname $subject;
338-
if (!chdir $parent)
339-
{
340-
$leaf = '/' . basename($parent) . $leaf;
341-
$parent = dirname $parent;
342-
chdir $parent or die "could not chdir \"$parent\": $!";
343-
}
344-
}
345-
346-
# this odd way of calling 'pwd -W' is the only way that seems to work.
347-
my $dir = qx{sh -c "pwd -W"};
348-
chomp $dir;
349-
$dir =~ s!/$!!;
350-
chdir $here;
351-
return $dir . $leaf;
352-
}
353-
354-
=pod
355-
356300
=item has_wal_read_bug()
357301
358302
Returns true if $tmp_check is subject to a sparc64+ext4 bug that causes WAL
@@ -708,8 +652,6 @@ sub dir_symlink
708652
my $newname = shift;
709653
if ($windows_os)
710654
{
711-
$oldname = perl2host($oldname);
712-
$newname = perl2host($newname);
713655
$oldname =~ s,/,\\,g;
714656
$newname =~ s,/,\\,g;
715657
my $cmd = qq{mklink /j "$newname" "$oldname"};

src/test/recovery/t/014_unlogged_reinit.pl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@
3333

3434
my $tablespaceDir = TestLib::tempdir;
3535

36-
my $realTSDir = TestLib::perl2host($tablespaceDir);
37-
38-
$node->safe_psql('postgres', "CREATE TABLESPACE ts1 LOCATION '$realTSDir'");
36+
$node->safe_psql('postgres', "CREATE TABLESPACE ts1 LOCATION '$tablespaceDir'");
3937
$node->safe_psql('postgres',
4038
'CREATE UNLOGGED TABLE ts1_unlogged (id int) TABLESPACE ts1');
4139

src/test/recovery/t/017_shm.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ sub log_ipcs
116116
$gnat->start;
117117
log_ipcs();
118118

119-
my $regress_shlib = TestLib::perl2host($ENV{REGRESS_SHLIB});
119+
my $regress_shlib = $ENV{REGRESS_SHLIB};
120120
$gnat->safe_psql('postgres', <<EOSQL);
121121
CREATE FUNCTION wait_pid(int)
122122
RETURNS void

src/test/recovery/t/018_wal_optimize.pl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ sub run_wal_optimize
6060
# Setup
6161
my $tablespace_dir = $node->basedir . '/tablespace_other';
6262
mkdir($tablespace_dir);
63-
$tablespace_dir = TestLib::perl2host($tablespace_dir);
6463
my $result;
6564

6665
# Test redo of CREATE TABLESPACE.
@@ -152,7 +151,6 @@ sub run_wal_optimize
152151
$copy_file, qq(20000,30000
153152
20001,30001
154153
20002,30002));
155-
$copy_file = TestLib::perl2host($copy_file);
156154

157155
# Test truncation with inserted tuples using both INSERT and COPY. Tuples
158156
# inserted after the truncation should be seen.

src/test/recovery/t/025_stuck_on_old_timeline.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
# Note: consistent use of forward slashes here avoids any escaping problems
2929
# that arise from use of backslashes. That means we need to double-quote all
3030
# the paths in the archive_command
31-
my $perlbin = TestLib::perl2host($^X);
31+
my $perlbin = $^X;
3232
$perlbin =~ s!\\!/!g if $TestLib::windows_os;
3333
my $archivedir_primary = $node_primary->archive_dir;
3434
$archivedir_primary =~ s!\\!/!g if $TestLib::windows_os;

0 commit comments

Comments
 (0)