1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-07 00:36:50 +03:00

Remove PostgreSQL::Test::Utils::perl2host completely

Commit f1ac4a74de 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
This commit is contained in:
Andrew Dunstan
2022-02-18 17:00:03 -05:00
parent cf12541f2b
commit 95d981338b
17 changed files with 25 additions and 94 deletions

View File

@ -1076,7 +1076,7 @@ primary_conninfo='$root_connstr'
sub enable_restoring
{
my ($self, $root_node, $standby) = @_;
my $path = PostgreSQL::Test::Utils::perl2host($root_node->archive_dir);
my $path = $root_node->archive_dir;
my $name = $self->name;
print "### Enabling WAL restore for node \"$name\"\n";
@ -1144,7 +1144,7 @@ sub set_standby_mode
sub enable_archiving
{
my ($self) = @_;
my $path = PostgreSQL::Test::Utils::perl2host($self->archive_dir);
my $path = $self->archive_dir;
my $name = $self->name;
print "### Enabling WAL archiving for node \"$name\"\n";

View File

@ -24,7 +24,6 @@ PostgreSQL::Test::Utils - helper module for writing PostgreSQL's C<prove> tests.
# Miscellanea
print "on Windows" if $PostgreSQL::Test::Utils::windows_os;
my $path = PostgreSQL::Test::Utils::perl2host($backup_dir);
ok(check_mode_recursive($stream_dir, 0700, 0600),
"check stream dir permissions");
PostgreSQL::Test::Utils::system_log('pg_ctl', 'kill', 'QUIT', $slow_pid);
@ -297,61 +296,6 @@ sub tempdir_short
=pod
=item perl2host()
Translate a virtual file name to a host file name. Currently, this is a no-op
except for the case of Perl=msys and host=mingw32. The subject need not
exist, but its parent or grandparent directory must exist unless cygpath is
available.
The returned path uses forward slashes but has no trailing slash.
=cut
sub perl2host
{
my ($subject) = @_;
return $subject;
if ($is_msys2)
{
# get absolute, windows type path
my $path = qx{cygpath -a -m "$subject"};
if (!$?)
{
chomp $path;
$path =~ s!/$!!;
return $path if $path;
}
# fall through if this didn't work.
}
my $here = cwd;
my $leaf;
if (chdir $subject)
{
$leaf = '';
}
else
{
$leaf = '/' . basename $subject;
my $parent = dirname $subject;
if (!chdir $parent)
{
$leaf = '/' . basename($parent) . $leaf;
$parent = dirname $parent;
chdir $parent or die "could not chdir \"$parent\": $!";
}
}
# this odd way of calling 'pwd -W' is the only way that seems to work.
my $dir = qx{sh -c "pwd -W"};
chomp $dir;
$dir =~ s!/$!!;
chdir $here;
return $dir . $leaf;
}
=pod
=item has_wal_read_bug()
Returns true if $tmp_check is subject to a sparc64+ext4 bug that causes WAL
@ -727,8 +671,6 @@ sub dir_symlink
my $newname = shift;
if ($windows_os)
{
$oldname = perl2host($oldname);
$newname = perl2host($newname);
$oldname =~ s,/,\\,g;
$newname =~ s,/,\\,g;
my $cmd = qq{mklink /j "$newname" "$oldname"};