killing perl2host

Started by Andrew Dunstanalmost 4 years ago22 messages
#1Andrew Dunstan
andrew@dunslane.net

Largely following a recipe from Andres, I have migrated buildfarm
animals fairywren and jacana to a setup that shouldn't need (and in fact
won't be able to use) PostgreSQL::Test:Utils::perl2host(). AFAICT these
two are the only buildfarm animals that run TAP tests under msys.

See discussion at
</messages/by-id/20220125023609.5ohu3nslxgoygihl@alap3.anarazel.de&gt;

The lesson to be learned, incidentally, is "Don't use the msys targeted
perl to run TAP tests".

I suggest that we apply this patch:

diff --git a/src/test/perl/PostgreSQL/Test/Utils.pm
b/src/test/perl/PostgreSQL/Test/Utils.pm
index 57fcb24089..31e2b0315e 100644
--- a/src/test/perl/PostgreSQL/Test/Utils.pm
+++ b/src/test/perl/PostgreSQL/Test/Utils.pm
@@ -311,7 +311,7 @@ The returned path uses forward slashes but has no
trailing slash.
 sub perl2host
 {
    my ($subject) = @_;
-   return $subject unless $Config{osname} eq 'msys';
+   return $subject;
    if ($is_msys2)
    {
        # get absolute, windows type path

and if nothing breaks in a few days I will set about a more thorough
removal of perl2host() and adjusting everywhere it's called, and we can
forget that the whole sorry mess ever happened :-) I know a number of
people who will be overjoyed.

cheers

andrew

--

Andrew Dunstan
EDB: https://www.enterprisedb.com

#2Andres Freund
andres@anarazel.de
In reply to: Andrew Dunstan (#1)
Re: killing perl2host

Hi,

On 2022-02-16 15:46:28 -0500, Andrew Dunstan wrote:

I suggest that we apply this patch:

+1

and if nothing breaks in a few days I will set about a more thorough
removal of perl2host() and adjusting everywhere it's called, and we can
forget that the whole sorry mess ever happened :-)

I think we would need an error check against using an msys perl when targeting
native windows, otherwise this'll be too hard to debug.

And we probably should set that environment variable that might fix in-tree
tests? Or reject in-tree builds?

Greetings,

Andres Freund

#3Andrew Dunstan
andrew@dunslane.net
In reply to: Andres Freund (#2)
Re: killing perl2host

On 2/16/22 16:01, Andres Freund wrote:

Hi,

On 2022-02-16 15:46:28 -0500, Andrew Dunstan wrote:

I suggest that we apply this patch:

+1

and if nothing breaks in a few days I will set about a more thorough
removal of perl2host() and adjusting everywhere it's called, and we can
forget that the whole sorry mess ever happened :-)

I think we would need an error check against using an msys perl when targeting
native windows, otherwise this'll be too hard to debug.

So something like this in Utils.pm:

die "Msys targeted perl is unsupported for running TAP tests" if
$Config{osname}eq 'msys';

And we probably should set that environment variable that might fix in-tree
tests? Or reject in-tree builds?

I think that's an orthogonal issue, but yes we should probably set it.
Have you tested to make sure it does what we want? I certainly don't
want to reject in-tree builds.

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

#4Andres Freund
andres@anarazel.de
In reply to: Andrew Dunstan (#3)
Re: killing perl2host

Hi,

On February 16, 2022 1:10:35 PM PST, Andrew Dunstan <andrew@dunslane.net> wrote:

On 2/16/22 16:01, Andres Freund wrote:

Hi,

On 2022-02-16 15:46:28 -0500, Andrew Dunstan wrote:

I suggest that we apply this patch:

+1

and if nothing breaks in a few days I will set about a more thorough
removal of perl2host() and adjusting everywhere it's called, and we can
forget that the whole sorry mess ever happened :-)

I think we would need an error check against using an msys perl when targeting
native windows, otherwise this'll be too hard to debug.

So something like this in Utils.pm:

die "Msys targeted perl is unsupported for running TAP tests" if
$Config{osname}eq 'msys';

I don't think we should reject msys general - it's fine as long as the target is msys, no? Msys includes postgres fwiw...

And we probably should set that environment variable that might fix in-tree
tests? Or reject in-tree builds?

I think that's an orthogonal issue, but yes we should probably set it.
Have you tested to make sure it does what we want? I certainly don't
want to reject in-tree builds.

I don't think it's quite orthogonal - msys perl uses sane PATH semantics and thus doesn't have this problem.

Andres
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.

#5Andres Freund
andres@anarazel.de
In reply to: Andres Freund (#4)
Re: killing perl2host

Hi,

On 2022-02-16 14:42:30 -0800, Andres Freund wrote:

On February 16, 2022 1:10:35 PM PST, Andrew Dunstan <andrew@dunslane.net> wrote:

So something like this in Utils.pm:

die "Msys targeted perl is unsupported for running TAP tests" if
$Config{osname}eq 'msys';

I don't think we should reject msys general - it's fine as long as the target is msys, no? Msys includes postgres fwiw...

I think this means we should do the msys test in configure, inside

if test "$enable_tap_tests" = yes; then

and verify that $host_os != msys.

Greetings,

Andres Freund

#6Andrew Dunstan
andrew@dunslane.net
In reply to: Andres Freund (#5)
Re: killing perl2host

On 2/16/22 21:17, Andres Freund wrote:

Hi,

On 2022-02-16 14:42:30 -0800, Andres Freund wrote:

On February 16, 2022 1:10:35 PM PST, Andrew Dunstan <andrew@dunslane.net> wrote:

So something like this in Utils.pm:

die "Msys targeted perl is unsupported for running TAP tests" if
$Config{osname}eq 'msys';

I don't think we should reject msys general - it's fine as long as the target is msys, no? Msys includes postgres fwiw...

I don't think we have or have ever had a buildfarm animal targeting
msys. In general I think of msys as a build environment to create native
binaries. But if we want to support targeting msys we should have an
animal doing that.

I think this means we should do the msys test in configure, inside

if test "$enable_tap_tests" = yes; then

and verify that $host_os != msys.

config/check_modules.pl is probably the right place for the test, as it
will be running with the perl we should be testing, and is only called
if we configure with TAP tests enabled.

perhaps something like:

    my $msystem = $ENV{MSYSTEM} || 'undef';

    die "incompatible perl" if $Config{osname} eq 'msys' && $msystem ne
'MSYS';

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

#7Andres Freund
andres@anarazel.de
In reply to: Andrew Dunstan (#6)
Re: killing perl2host

Hi,

On 2022-02-17 09:20:56 -0500, Andrew Dunstan wrote:

I don't think we have or have ever had a buildfarm animal targeting
msys. In general I think of msys as a build environment to create native
binaries. But if we want to support targeting msys we should have an
animal doing that.

It's pretty much cygwin. Wouldn't hurt to have a dedicated animal though, I
agree. We do have a dedicated path for it in configure.ac:

case $host_os in
...
cygwin*|msys*) template=cygwin ;;

I think this means we should do the msys test in configure, inside

if test "$enable_tap_tests" = yes; then

and verify that $host_os != msys.

config/check_modules.pl is probably the right place for the test, as it
will be running with the perl we should be testing, and is only called
if we configure with TAP tests enabled.

Makes sense.

perhaps something like:

��� my $msystem = $ENV{MSYSTEM} || 'undef';

��� die "incompatible perl" if $Config{osname} eq 'msys' && $msystem ne
'MSYS';

Why tests MSYSTEM instead of $host_os?

Greetings,

Andres Freund

#8Andrew Dunstan
andrew@dunslane.net
In reply to: Andres Freund (#7)
Re: killing perl2host

On 2/17/22 12:12, Andres Freund wrote:

Hi,

On 2022-02-17 09:20:56 -0500, Andrew Dunstan wrote:

I don't think we have or have ever had a buildfarm animal targeting
msys. In general I think of msys as a build environment to create native
binaries. But if we want to support targeting msys we should have an
animal doing that.

It's pretty much cygwin. Wouldn't hurt to have a dedicated animal though, I
agree. We do have a dedicated path for it in configure.ac:

case $host_os in
...
cygwin*|msys*) template=cygwin ;;

I think this means we should do the msys test in configure, inside

if test "$enable_tap_tests" = yes; then

and verify that $host_os != msys.

config/check_modules.pl is probably the right place for the test, as it
will be running with the perl we should be testing, and is only called
if we configure with TAP tests enabled.

Makes sense.

perhaps something like:

    my $msystem = $ENV{MSYSTEM} || 'undef';

    die "incompatible perl" if $Config{osname} eq 'msys' && $msystem ne
'MSYS';

Why tests MSYSTEM instead of $host_os?

Is that available in check_modules.pl? AFAICT it's an unexported shell
variable.

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

#9Andres Freund
andres@anarazel.de
In reply to: Andrew Dunstan (#8)
Re: killing perl2host

On 2022-02-17 13:08:01 -0500, Andrew Dunstan wrote:

perhaps something like:

��� my $msystem = $ENV{MSYSTEM} || 'undef';

��� die "incompatible perl" if $Config{osname} eq 'msys' && $msystem ne
'MSYS';

Why tests MSYSTEM instead of $host_os?

Is that available in check_modules.pl? AFAICT it's an unexported shell
variable.

No, but it could just be passed to it? Or the test just implemented in
configure, as I suggested.

Greetings,

Andres Freund

#10Andrew Dunstan
andrew@dunslane.net
In reply to: Andres Freund (#9)
Re: killing perl2host

On 2/17/22 13:10, Andres Freund wrote:

On 2022-02-17 13:08:01 -0500, Andrew Dunstan wrote:

perhaps something like:

    my $msystem = $ENV{MSYSTEM} || 'undef';

    die "incompatible perl" if $Config{osname} eq 'msys' && $msystem ne
'MSYS';

Why tests MSYSTEM instead of $host_os?

Is that available in check_modules.pl? AFAICT it's an unexported shell
variable.

No, but it could just be passed to it?

Sure, that could be done, but what's the issue? Msys2 normally defines
MSYSTEM for you - see /etc/msystem which is sourced by /etc/profile.

Or the test just implemented in
configure, as I suggested.

No, because we don't know which perl will be invoked by $PROVE. That's
why we set up check_modules.pl in the first place.

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

#11Andres Freund
andres@anarazel.de
In reply to: Andrew Dunstan (#10)
Re: killing perl2host

Hi,

On 2022-02-17 14:40:01 -0500, Andrew Dunstan wrote:

Sure, that could be done, but what's the issue? Msys2 normally defines
MSYSTEM for you - see /etc/msystem which is sourced by /etc/profile.

It seems not a great idea to me to use different sources of truth about build
target. And I think it's not hard to get the actual host_os and MSYSTEM to
disagree:
- afaics it's quite possible to run configure outside of a login msys shell
- you could do an msys build in a ucrt shell, but specify --host=x86_64-pc-msys,
or the other way round

There's probably also some stuff about cross building from linux, but that
doesn't matter much, because right now wine doesn't get through even the base
regression tests (although it gets through initdb these days, which is nice).

Or the test just implemented in
configure, as I suggested.

No, because we don't know which perl will be invoked by $PROVE. That's
why we set up check_modules.pl in the first place.

Ah.

Greetings,

Andres Freund

#12Andrew Dunstan
andrew@dunslane.net
In reply to: Andres Freund (#11)
Re: killing perl2host

On 2/17/22 15:09, Andres Freund wrote:

Hi,

On 2022-02-17 14:40:01 -0500, Andrew Dunstan wrote:

Sure, that could be done, but what's the issue? Msys2 normally defines
MSYSTEM for you - see /etc/msystem which is sourced by /etc/profile.

It seems not a great idea to me to use different sources of truth about build
target. And I think it's not hard to get the actual host_os and MSYSTEM to
disagree:
- afaics it's quite possible to run configure outside of a login msys shell
- you could do an msys build in a ucrt shell, but specify --host=x86_64-pc-msys,
or the other way round

Very well. I think the easiest way will be to stash $host_os in the
environment and let the script pick it up similarly to what I suggested
with MSYSTEM.

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

#13Andres Freund
andres@anarazel.de
In reply to: Andrew Dunstan (#12)
Re: killing perl2host

On 2022-02-17 15:23:36 -0500, Andrew Dunstan wrote:

Very well. I think the easiest way will be to stash $host_os in the
environment and let the script pick it up similarly to what I suggested
with MSYSTEM.

WFM.

#14Andrew Dunstan
andrew@dunslane.net
In reply to: Andres Freund (#13)
1 attachment(s)
Re: killing perl2host

On 2/17/22 15:46, Andres Freund wrote:

On 2022-02-17 15:23:36 -0500, Andrew Dunstan wrote:

Very well. I think the easiest way will be to stash $host_os in the
environment and let the script pick it up similarly to what I suggested
with MSYSTEM.

WFM.

OK, here's a patch.

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

Attachments:

msys-prove-detection.patchtext/x-patch; charset=UTF-8; name=msys-prove-detection.patchDownload
diff --git a/config/check_modules.pl b/config/check_modules.pl
index cc0a7ab0e7..470c3e9c14 100644
--- a/config/check_modules.pl
+++ b/config/check_modules.pl
@@ -6,6 +6,7 @@
 #
 use strict;
 use warnings;
+use Config;
 
 use IPC::Run 0.79;
 
@@ -19,5 +20,9 @@ diag("IPC::Run::VERSION: $IPC::Run::VERSION");
 diag("Test::More::VERSION: $Test::More::VERSION");
 diag("Time::HiRes::VERSION: $Time::HiRes::VERSION");
 
+# Check that if prove is using msys perl it is for an msys target
+ok(($ENV{__CONFIG_HOST_OS__} || "") eq 'msys',
+   "Msys perl used for correct target")
+  if $Config{osname} eq 'msys';
 ok(1);
 done_testing();
diff --git a/configure b/configure
index ba635a0062..5e3af5c35b 100755
--- a/configure
+++ b/configure
@@ -19453,6 +19453,7 @@ fi
   # installation than perl, eg on MSys, so we have to check using prove.
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Perl modules required for TAP tests" >&5
 $as_echo_n "checking for Perl modules required for TAP tests... " >&6; }
+  __CONFIG_HOST_OS__=$host_os; export __CONFIG_HOST_OS__
   modulestderr=`"$PROVE" "$srcdir/config/check_modules.pl" 2>&1 >/dev/null`
   if test $? -eq 0; then
     # log the module version details, but don't show them interactively
diff --git a/configure.ac b/configure.ac
index 16167329fc..d00e92357e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2396,6 +2396,7 @@ if test "$enable_tap_tests" = yes; then
   # AX_PROG_PERL_MODULES here, but prove might be part of a different Perl
   # installation than perl, eg on MSys, so we have to check using prove.
   AC_MSG_CHECKING(for Perl modules required for TAP tests)
+  __CONFIG_HOST_OS__=$host_os; export __CONFIG_HOST_OS__
   [modulestderr=`"$PROVE" "$srcdir/config/check_modules.pl" 2>&1 >/dev/null`]
   if test $? -eq 0; then
     # log the module version details, but don't show them interactively
#15Andrew Dunstan
andrew@dunslane.net
In reply to: Andres Freund (#7)
Re: killing perl2host

On 2/17/22 12:12, Andres Freund wrote:

Hi,

On 2022-02-17 09:20:56 -0500, Andrew Dunstan wrote:

I don't think we have or have ever had a buildfarm animal targeting
msys. In general I think of msys as a build environment to create native
binaries. But if we want to support targeting msys we should have an
animal doing that.

It's pretty much cygwin. Wouldn't hurt to have a dedicated animal though, I
agree. We do have a dedicated path for it in configure.ac:

case $host_os in
...
cygwin*|msys*) template=cygwin ;;

FYI I tested it while in wait mode for something else, and it fell over
at the first hurdle:

running bootstrap script ... 2022-02-18 22:25:45.119 UTC [34860] FATAL: 
could not create shared memory segment: Function not implemented
2022-02-18 22:25:45.119 UTC [34860] DETAIL:  Failed system call was
shmget(key=1407374884304065, size=56, 03600).
child process exited with exit code 1

I'm not intending to put any more effort into supporting it.

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

#16Andrew Dunstan
andrew@dunslane.net
In reply to: Andrew Dunstan (#15)
Re: killing perl2host

On 2/18/22 17:34, Andrew Dunstan wrote:

On 2/17/22 12:12, Andres Freund wrote:

Hi,

On 2022-02-17 09:20:56 -0500, Andrew Dunstan wrote:

I don't think we have or have ever had a buildfarm animal targeting
msys. In general I think of msys as a build environment to create native
binaries. But if we want to support targeting msys we should have an
animal doing that.

It's pretty much cygwin. Wouldn't hurt to have a dedicated animal though, I
agree. We do have a dedicated path for it in configure.ac:

case $host_os in
...
cygwin*|msys*) template=cygwin ;;

FYI I tested it while in wait mode for something else, and it fell over
at the first hurdle:

running bootstrap script ... 2022-02-18 22:25:45.119 UTC [34860] FATAL: 
could not create shared memory segment: Function not implemented
2022-02-18 22:25:45.119 UTC [34860] DETAIL:  Failed system call was
shmget(key=1407374884304065, size=56, 03600).
child process exited with exit code 1

I'm not intending to put any more effort into supporting it.

See also
</messages/by-id/6b467edc-4018-521f-ab18-171f098557ca@2ndquadrant.com&gt;
where Peter says:

MSYS2 doesn't ship with cygserver AFAICT, so you can't run a
PostgreSQL server, but everything else should work.

which explains this perfectly. If we can't run a server then any sort of
buildfarm/CI support seems moot.

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

#17Andrew Dunstan
andrew@dunslane.net
In reply to: Andrew Dunstan (#1)
2 attachment(s)
Re: killing perl2host

On 2/16/22 15:46, Andrew Dunstan wrote:

Largely following a recipe from Andres, I have migrated buildfarm
animals fairywren and jacana to a setup that shouldn't need (and in fact
won't be able to use) PostgreSQL::Test:Utils::perl2host(). AFAICT these
two are the only buildfarm animals that run TAP tests under msys.

[...]

I suggest that we apply this patch:

[...]

and if nothing breaks in a few days I will set about a more thorough
removal of perl2host() and adjusting everywhere it's called, and we can
forget that the whole sorry mess ever happened :-) I know a number of
people who will be overjoyed.

OK, nothing broke, so here are two more invasive patches. The first
removes perl2host completely and adjusts  all the places that use it.
The second removes almost all the remaining msys special processing in
TAP tests.

I have tested these and they appear to work fine.

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

Attachments:

0001-remove-perl2host-completely.patchtext/x-patch; charset=UTF-8; name=0001-remove-perl2host-completely.patchDownload
From 50d09dab80bb14ec14f36e95037a72cc075957fe Mon Sep 17 00:00:00 2001
From: Andrew Dunstan <andrew@dunslane.net>
Date: Fri, 18 Feb 2022 17:00:03 -0500
Subject: [PATCH 1/2] remove perl2host completely

---
 src/bin/pg_basebackup/t/010_pg_basebackup.pl  | 18 +++---
 src/bin/pg_checksums/t/002_actions.pl         |  1 -
 src/bin/pg_verifybackup/t/003_corruption.pl   |  4 +-
 src/bin/pg_verifybackup/t/008_untar.pl        |  3 +-
 src/bin/pgbench/t/001_pgbench_with_server.pl  |  4 +-
 src/bin/scripts/t/090_reindexdb.pl            |  1 -
 .../modules/test_misc/t/002_tablespace.pl     |  4 +-
 src/test/perl/PostgreSQL/Test/Cluster.pm      |  4 +-
 src/test/perl/PostgreSQL/Test/Utils.pm        | 58 -------------------
 src/test/recovery/t/014_unlogged_reinit.pl    |  4 +-
 src/test/recovery/t/017_shm.pl                |  2 +-
 src/test/recovery/t/018_wal_optimize.pl       |  2 -
 .../recovery/t/025_stuck_on_old_timeline.pl   |  2 +-
 src/test/recovery/t/027_stream_regress.pl     |  4 +-
 src/test/ssl/t/001_ssltests.pl                |  4 +-
 src/test/ssl/t/002_scram.pl                   |  2 +-
 src/test/ssl/t/003_sslinfo.pl                 |  2 +-
 17 files changed, 25 insertions(+), 94 deletions(-)

diff --git a/src/bin/pg_basebackup/t/010_pg_basebackup.pl b/src/bin/pg_basebackup/t/010_pg_basebackup.pl
index 8c70e5b32b..75d6810d3e 100644
--- a/src/bin/pg_basebackup/t/010_pg_basebackup.pl
+++ b/src/bin/pg_basebackup/t/010_pg_basebackup.pl
@@ -261,13 +261,11 @@ $node->start;
 # for the tablespace directories, which hopefully won't run afoul of
 # the 99 character length limit.
 my $sys_tempdir = PostgreSQL::Test::Utils::tempdir_short;
-my $real_sys_tempdir = PostgreSQL::Test::Utils::perl2host($sys_tempdir) . "/tempdir";
-my $shorter_tempdir =  $sys_tempdir . "/tempdir";
-dir_symlink "$tempdir", $shorter_tempdir;
+my $real_sys_tempdir = "$sys_tempdir/tempdir";
+dir_symlink "$tempdir", $real_sys_tempdir;
 
 mkdir "$tempdir/tblspc1";
 my $realTsDir    = "$real_sys_tempdir/tblspc1";
-my $real_tempdir = PostgreSQL::Test::Utils::perl2host($tempdir);
 $node->safe_psql('postgres',
 	"CREATE TABLESPACE tblspc1 LOCATION '$realTsDir';");
 $node->safe_psql('postgres',
@@ -346,7 +344,7 @@ my $tblSpc1Id = basename(
 foreach my $filename (@tempRelationFiles)
 {
 	append_to_file(
-		"$shorter_tempdir/tblspc1/$tblSpc1Id/$postgresOid/$filename",
+		"$real_sys_tempdir/tblspc1/$tblSpc1Id/$postgresOid/$filename",
 		'TEMP_RELATION');
 }
 
@@ -358,7 +356,7 @@ $node->command_ok(
 	[
 		@pg_basebackup_defs, '-D',
 		"$tempdir/backup1",  '-Fp',
-		"-T$realTsDir=$real_tempdir/tbackup/tblspc1",
+		"-T$realTsDir=$tempdir/tbackup/tblspc1",
 	],
 	'plain format with tablespaces succeeds with tablespace mapping');
 ok(-d "$tempdir/tbackup/tblspc1", 'tablespace was relocated');
@@ -406,7 +404,7 @@ foreach my $filename (@tempRelationFiles)
 
 	# Also remove temp relation files or tablespace drop will fail.
 	my $filepath =
-	  "$shorter_tempdir/tblspc1/$tblSpc1Id/$postgresOid/$filename";
+	  "$real_sys_tempdir/tblspc1/$tblSpc1Id/$postgresOid/$filename";
 
 	unlink($filepath)
 	  or BAIL_OUT("unable to unlink $filepath");
@@ -428,7 +426,7 @@ $node->command_ok(
 	[
 		@pg_basebackup_defs, '-D',
 		"$tempdir/backup3",  '-Fp',
-		"-T$realTsDir=$real_tempdir/tbackup/tbl\\=spc2",
+		"-T$realTsDir=$tempdir/tbackup/tbl\\=spc2",
 	],
 	'mapping tablespace with = sign in path');
 ok(-d "$tempdir/tbackup/tbl=spc2", 'tablespace with = sign was relocated');
@@ -517,7 +515,7 @@ $node->command_ok(
 	[ @pg_basebackup_defs, '--target', 'blackhole', '-X', 'none' ],
 	'backup target blackhole');
 $node->command_ok(
-	[ @pg_basebackup_defs, '--target', "server:$real_tempdir/backuponserver", '-X', 'none' ],
+	[ @pg_basebackup_defs, '--target', "server:$tempdir/backuponserver", '-X', 'none' ],
 	'backup target server');
 ok(-f "$tempdir/backuponserver/base.tar", 'backup tar was created');
 rmtree("$tempdir/backuponserver");
@@ -526,7 +524,7 @@ $node->command_ok(
 	[qw(createuser --replication --role=pg_write_server_files backupuser)],
 	'create backup user');
 $node->command_ok(
-	[ @pg_basebackup_defs, '-U', 'backupuser', '--target', "server:$real_tempdir/backuponserver", '-X', 'none' ],
+	[ @pg_basebackup_defs, '-U', 'backupuser', '--target', "server:$tempdir/backuponserver", '-X', 'none' ],
 	'backup target server');
 ok(-f "$tempdir/backuponserver/base.tar", 'backup tar was created as non-superuser');
 rmtree("$tempdir/backuponserver");
diff --git a/src/bin/pg_checksums/t/002_actions.pl b/src/bin/pg_checksums/t/002_actions.pl
index 5563244f11..751f732451 100644
--- a/src/bin/pg_checksums/t/002_actions.pl
+++ b/src/bin/pg_checksums/t/002_actions.pl
@@ -207,7 +207,6 @@ check_relation_corruption($node, 'corrupt1', 'pg_default');
 my $basedir        = $node->basedir;
 my $tablespace_dir = "$basedir/ts_corrupt_dir";
 mkdir($tablespace_dir);
-$tablespace_dir = PostgreSQL::Test::Utils::perl2host($tablespace_dir);
 $node->safe_psql('postgres',
 	"CREATE TABLESPACE ts_corrupt LOCATION '$tablespace_dir';");
 check_relation_corruption($node, 'corrupt2', 'ts_corrupt');
diff --git a/src/bin/pg_verifybackup/t/003_corruption.pl b/src/bin/pg_verifybackup/t/003_corruption.pl
index f402d301ac..406c0c9877 100644
--- a/src/bin/pg_verifybackup/t/003_corruption.pl
+++ b/src/bin/pg_verifybackup/t/003_corruption.pl
@@ -18,7 +18,7 @@ $primary->start;
 
 # Include a user-defined tablespace in the hopes of detecting problems in that
 # area.
-my $source_ts_path   = PostgreSQL::Test::Utils::perl2host(PostgreSQL::Test::Utils::tempdir_short());
+my $source_ts_path   =PostgreSQL::Test::Utils::tempdir_short();
 my $source_ts_prefix = $source_ts_path;
 $source_ts_prefix =~ s!(^[A-Z]:/[^/]*)/.*!$1!;
 
@@ -107,7 +107,7 @@ for my $scenario (@scenario)
 
 		# Take a backup and check that it verifies OK.
 		my $backup_path    = $primary->backup_dir . '/' . $name;
-		my $backup_ts_path = PostgreSQL::Test::Utils::perl2host(PostgreSQL::Test::Utils::tempdir_short());
+		my $backup_ts_path = PostgreSQL::Test::Utils::tempdir_short();
 		# The tablespace map parameter confuses Msys2, which tries to mangle
 		# it. Tell it not to.
 		# See https://www.msys2.org/wiki/Porting/#filesystem-namespaces
diff --git a/src/bin/pg_verifybackup/t/008_untar.pl b/src/bin/pg_verifybackup/t/008_untar.pl
index 6927ca4c74..383203d0b8 100644
--- a/src/bin/pg_verifybackup/t/008_untar.pl
+++ b/src/bin/pg_verifybackup/t/008_untar.pl
@@ -18,7 +18,6 @@ $primary->init(allows_streaming => 1);
 $primary->start;
 
 my $backup_path = $primary->backup_dir . '/server-backup';
-my $real_backup_path = PostgreSQL::Test::Utils::perl2host($backup_path);
 my $extract_path = $primary->backup_dir . '/extracted-backup';
 
 my @test_configuration = (
@@ -61,7 +60,7 @@ for my $tc (@test_configuration)
 		# Take a server-side backup.
 		my @backup = (
 			'pg_basebackup', '--no-sync', '-cfast', '--target',
-			"server:$real_backup_path", '-Xfetch'
+			"server:$backup_path", '-Xfetch'
 		);
 		push @backup, @{$tc->{'backup_flags'}};
 		$primary->command_ok(\@backup,
diff --git a/src/bin/pgbench/t/001_pgbench_with_server.pl b/src/bin/pgbench/t/001_pgbench_with_server.pl
index 8b03900f32..f1341092fe 100644
--- a/src/bin/pgbench/t/001_pgbench_with_server.pl
+++ b/src/bin/pgbench/t/001_pgbench_with_server.pl
@@ -19,12 +19,10 @@ $node->start;
 # for partitioned tables.
 my $ts = $node->basedir . '/regress_pgbench_tap_1_ts_dir';
 mkdir $ts or die "cannot create directory $ts";
-# this takes care of WIN-specific path issues
-my $ets = PostgreSQL::Test::Utils::perl2host($ts);
 
 # the next commands will issue a syntax error if the path contains a "'"
 $node->safe_psql('postgres',
-	"CREATE TABLESPACE regress_pgbench_tap_1_ts LOCATION '$ets';");
+	"CREATE TABLESPACE regress_pgbench_tap_1_ts LOCATION '$ts';");
 
 # Test concurrent OID generation via pg_enum_oid_index.  This indirectly
 # exercises LWLock and spinlock concurrency.
diff --git a/src/bin/scripts/t/090_reindexdb.pl b/src/bin/scripts/t/090_reindexdb.pl
index 70cd7606dd..398fc4e6bb 100644
--- a/src/bin/scripts/t/090_reindexdb.pl
+++ b/src/bin/scripts/t/090_reindexdb.pl
@@ -21,7 +21,6 @@ $ENV{PGOPTIONS} = '--client-min-messages=WARNING';
 # Create a tablespace for testing.
 my $tbspace_path = $node->basedir . '/regress_reindex_tbspace';
 mkdir $tbspace_path or die "cannot create directory $tbspace_path";
-$tbspace_path = PostgreSQL::Test::Utils::perl2host($tbspace_path);
 my $tbspace_name = 'reindex_tbspace';
 $node->safe_psql('postgres',
 	"CREATE TABLESPACE $tbspace_name LOCATION '$tbspace_path';");
diff --git a/src/test/modules/test_misc/t/002_tablespace.pl b/src/test/modules/test_misc/t/002_tablespace.pl
index 6fea419bb8..04e54394c1 100644
--- a/src/test/modules/test_misc/t/002_tablespace.pl
+++ b/src/test/modules/test_misc/t/002_tablespace.pl
@@ -14,10 +14,10 @@ $node->start;
 
 # Create a couple of directories to use as tablespaces.
 my $basedir = $node->basedir();
-my $TS1_LOCATION = PostgreSQL::Test::Utils::perl2host("$basedir/ts1");
+my $TS1_LOCATION = "$basedir/ts1";
 $TS1_LOCATION =~ s/\/\.\//\//g; # collapse foo/./bar to foo/bar
 mkdir($TS1_LOCATION);
-my $TS2_LOCATION = PostgreSQL::Test::Utils::perl2host("$basedir/ts2");
+my $TS2_LOCATION = "$basedir/ts2";
 $TS2_LOCATION =~ s/\/\.\//\//g;
 mkdir($TS2_LOCATION);
 
diff --git a/src/test/perl/PostgreSQL/Test/Cluster.pm b/src/test/perl/PostgreSQL/Test/Cluster.pm
index ed70eff374..702b4c2b1c 100644
--- a/src/test/perl/PostgreSQL/Test/Cluster.pm
+++ b/src/test/perl/PostgreSQL/Test/Cluster.pm
@@ -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";
diff --git a/src/test/perl/PostgreSQL/Test/Utils.pm b/src/test/perl/PostgreSQL/Test/Utils.pm
index 31e2b0315e..fc8ca74194 100644
--- a/src/test/perl/PostgreSQL/Test/Utils.pm
+++ b/src/test/perl/PostgreSQL/Test/Utils.pm
@@ -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"};
diff --git a/src/test/recovery/t/014_unlogged_reinit.pl b/src/test/recovery/t/014_unlogged_reinit.pl
index da77c1211f..f3199fbd2e 100644
--- a/src/test/recovery/t/014_unlogged_reinit.pl
+++ b/src/test/recovery/t/014_unlogged_reinit.pl
@@ -33,9 +33,7 @@ ok(-f "$pgdata/$baseUnloggedPath",        'main fork in base exists');
 
 my $tablespaceDir = PostgreSQL::Test::Utils::tempdir;
 
-my $realTSDir = PostgreSQL::Test::Utils::perl2host($tablespaceDir);
-
-$node->safe_psql('postgres', "CREATE TABLESPACE ts1 LOCATION '$realTSDir'");
+$node->safe_psql('postgres', "CREATE TABLESPACE ts1 LOCATION '$tablespaceDir'");
 $node->safe_psql('postgres',
 	'CREATE UNLOGGED TABLE ts1_unlogged (id int) TABLESPACE ts1');
 
diff --git a/src/test/recovery/t/017_shm.pl b/src/test/recovery/t/017_shm.pl
index 678a252165..88f9e2b9cd 100644
--- a/src/test/recovery/t/017_shm.pl
+++ b/src/test/recovery/t/017_shm.pl
@@ -112,7 +112,7 @@ log_ipcs();
 $gnat->start;
 log_ipcs();
 
-my $regress_shlib = PostgreSQL::Test::Utils::perl2host($ENV{REGRESS_SHLIB});
+my $regress_shlib = $ENV{REGRESS_SHLIB};
 $gnat->safe_psql('postgres', <<EOSQL);
 CREATE FUNCTION wait_pid(int)
    RETURNS void
diff --git a/src/test/recovery/t/018_wal_optimize.pl b/src/test/recovery/t/018_wal_optimize.pl
index 1410e2f03b..4700d49c10 100644
--- a/src/test/recovery/t/018_wal_optimize.pl
+++ b/src/test/recovery/t/018_wal_optimize.pl
@@ -60,7 +60,6 @@ wal_skip_threshold = 0
 	# Setup
 	my $tablespace_dir = $node->basedir . '/tablespace_other';
 	mkdir($tablespace_dir);
-	$tablespace_dir = PostgreSQL::Test::Utils::perl2host($tablespace_dir);
 	my $result;
 
 	# Test redo of CREATE TABLESPACE.
@@ -152,7 +151,6 @@ wal_skip_threshold = 0
 		$copy_file, qq(20000,30000
 20001,30001
 20002,30002));
-	$copy_file = PostgreSQL::Test::Utils::perl2host($copy_file);
 
 	# Test truncation with inserted tuples using both INSERT and COPY.  Tuples
 	# inserted after the truncation should be seen.
diff --git a/src/test/recovery/t/025_stuck_on_old_timeline.pl b/src/test/recovery/t/025_stuck_on_old_timeline.pl
index d113c8cc9c..fd821242e8 100644
--- a/src/test/recovery/t/025_stuck_on_old_timeline.pl
+++ b/src/test/recovery/t/025_stuck_on_old_timeline.pl
@@ -28,7 +28,7 @@ $node_primary->init(allows_streaming => 1, has_archiving => 1);
 # Note: consistent use of forward slashes here avoids any escaping problems
 # that arise from use of backslashes. That means we need to double-quote all
 # the paths in the archive_command
-my $perlbin = PostgreSQL::Test::Utils::perl2host($^X);
+my $perlbin = $^X;
 $perlbin =~ s!\\!/!g if $PostgreSQL::Test::Utils::windows_os;
 my $archivedir_primary = $node_primary->archive_dir;
 $archivedir_primary =~ s!\\!/!g if $PostgreSQL::Test::Utils::windows_os;
diff --git a/src/test/recovery/t/027_stream_regress.pl b/src/test/recovery/t/027_stream_regress.pl
index 4f82a54f93..c40951b7ba 100644
--- a/src/test/recovery/t/027_stream_regress.pl
+++ b/src/test/recovery/t/027_stream_regress.pl
@@ -48,8 +48,8 @@ $node_standby_1->append_conf('postgresql.conf',
 	'max_standby_streaming_delay = 600s');
 $node_standby_1->start;
 
-my $dlpath = PostgreSQL::Test::Utils::perl2host(dirname($ENV{REGRESS_SHLIB}));
-my $outputdir = PostgreSQL::Test::Utils::perl2host($PostgreSQL::Test::Utils::tmp_check);
+my $dlpath = dirname($ENV{REGRESS_SHLIB});
+my $outputdir = $PostgreSQL::Test::Utils::tmp_check;
 
 # Run the regression tests against the primary.
 my $extra_opts = $ENV{EXTRA_REGRESS_OPTS} || "";
diff --git a/src/test/ssl/t/001_ssltests.pl b/src/test/ssl/t/001_ssltests.pl
index b8f8b65a8f..5c5b16fbe7 100644
--- a/src/test/ssl/t/001_ssltests.pl
+++ b/src/test/ssl/t/001_ssltests.pl
@@ -51,7 +51,7 @@ foreach my $keyfile (@keys)
 	  "couldn't copy ssl/$keyfile to $cert_tempdir/$keyfile for permissions change: $!";
 	chmod 0600, "$cert_tempdir/$keyfile"
 	  or die "failed to change permissions on $cert_tempdir/$keyfile: $!";
-	$key{$keyfile} = PostgreSQL::Test::Utils::perl2host("$cert_tempdir/$keyfile");
+	$key{$keyfile} = "$cert_tempdir/$keyfile";
 	$key{$keyfile} =~ s!\\!/!g if $PostgreSQL::Test::Utils::windows_os;
 }
 
@@ -63,7 +63,7 @@ copy("ssl/client.key", "$cert_tempdir/client_wrongperms.key")
   "couldn't copy ssl/client_key to $cert_tempdir/client_wrongperms.key for permission change: $!";
 chmod 0644, "$cert_tempdir/client_wrongperms.key"
   or die "failed to change permissions on $cert_tempdir/client_wrongperms.key: $!";
-$key{'client_wrongperms.key'} = PostgreSQL::Test::Utils::perl2host("$cert_tempdir/client_wrongperms.key");
+$key{'client_wrongperms.key'} = "$cert_tempdir/client_wrongperms.key";
 $key{'client_wrongperms.key'} =~ s!\\!/!g if $PostgreSQL::Test::Utils::windows_os;
 #### Set up the server.
 
diff --git a/src/test/ssl/t/002_scram.pl b/src/test/ssl/t/002_scram.pl
index 41d231c55d..4decd7a506 100644
--- a/src/test/ssl/t/002_scram.pl
+++ b/src/test/ssl/t/002_scram.pl
@@ -94,7 +94,7 @@ $node->connect_fails(
 # be used in a different test, so the name of this temporary client key
 # is chosen here to be unique.
 my $cert_tempdir = PostgreSQL::Test::Utils::tempdir();
-my $client_tmp_key = PostgreSQL::Test::Utils::perl2host("$cert_tempdir/client_scram.key");
+my $client_tmp_key = "$cert_tempdir/client_scram.key";
 copy("ssl/client.key", "$cert_tempdir/client_scram.key")
   or die
   "couldn't copy ssl/client_key to $cert_tempdir/client_scram.key for permission change: $!";
diff --git a/src/test/ssl/t/003_sslinfo.pl b/src/test/ssl/t/003_sslinfo.pl
index f008ea6594..95742081f3 100644
--- a/src/test/ssl/t/003_sslinfo.pl
+++ b/src/test/ssl/t/003_sslinfo.pl
@@ -34,7 +34,7 @@ my $common_connstr;
 # The client's private key must not be world-readable, so take a copy
 # of the key stored in the code tree and update its permissions.
 my $cert_tempdir = PostgreSQL::Test::Utils::tempdir();
-my $client_tmp_key = PostgreSQL::Test::Utils::perl2host("$cert_tempdir/client_ext.key");
+my $client_tmp_key = "$cert_tempdir/client_ext.key";
 copy("ssl/client_ext.key", "$cert_tempdir/client_ext.key")
   or die
   "couldn't copy ssl/client_ext.key to $cert_tempdir/client_ext.key for permissions change: $!";
-- 
2.34.1

0002-remove-most-msys-special-processing.patchtext/x-patch; charset=UTF-8; name=0002-remove-most-msys-special-processing.patchDownload
From 234607d44f055ee5d2081bfa0add8aea9a44ad2e Mon Sep 17 00:00:00 2001
From: Andrew Dunstan <andrew@dunslane.net>
Date: Sat, 19 Feb 2022 11:28:35 -0500
Subject: [PATCH 2/2] remove most msys special processing

---
 src/bin/pg_ctl/t/001_start_stop.pl        | 11 +----------
 src/bin/pg_rewind/t/RewindTest.pm         |  1 -
 src/test/perl/PostgreSQL/Test/Cluster.pm  | 15 +--------------
 src/test/perl/PostgreSQL/Test/Utils.pm    |  6 ------
 src/test/recovery/t/021_row_visibility.pl |  3 ---
 src/test/recovery/t/cp_history_files      |  7 -------
 6 files changed, 2 insertions(+), 41 deletions(-)

diff --git a/src/bin/pg_ctl/t/001_start_stop.pl b/src/bin/pg_ctl/t/001_start_stop.pl
index 7d3fbc3f6a..653b979760 100644
--- a/src/bin/pg_ctl/t/001_start_stop.pl
+++ b/src/bin/pg_ctl/t/001_start_stop.pl
@@ -47,16 +47,7 @@ my $ctlcmd = [
 	'pg_ctl', 'start', '-D', "$tempdir/data", '-l',
 	"$PostgreSQL::Test::Utils::log_path/001_start_stop_server.log"
 ];
-if ($Config{osname} ne 'msys')
-{
-	command_like($ctlcmd, qr/done.*server started/s, 'pg_ctl start');
-}
-else
-{
-
-	# use the version of command_like that doesn't hang on Msys here
-	command_like_safe($ctlcmd, qr/done.*server started/s, 'pg_ctl start');
-}
+command_like_safe($ctlcmd, qr/done.*server started/s, 'pg_ctl start');
 
 # sleep here is because Windows builds can't check postmaster.pid exactly,
 # so they may mistake a pre-existing postmaster.pid for one created by the
diff --git a/src/bin/pg_rewind/t/RewindTest.pm b/src/bin/pg_rewind/t/RewindTest.pm
index 60e3234788..2fedc626cc 100644
--- a/src/bin/pg_rewind/t/RewindTest.pm
+++ b/src/bin/pg_rewind/t/RewindTest.pm
@@ -115,7 +115,6 @@ sub check_query
 	}
 	else
 	{
-		$stdout =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
 		is($stdout, $expected_stdout, "$test_name: query result matches");
 	}
 	return;
diff --git a/src/test/perl/PostgreSQL/Test/Cluster.pm b/src/test/perl/PostgreSQL/Test/Cluster.pm
index 702b4c2b1c..be05845248 100644
--- a/src/test/perl/PostgreSQL/Test/Cluster.pm
+++ b/src/test/perl/PostgreSQL/Test/Cluster.pm
@@ -904,9 +904,7 @@ sub kill9
 	local %ENV = $self->_get_env();
 
 	print "### Killing node \"$name\" using signal 9\n";
-	# kill(9, ...) fails under msys Perl 5.8.8, so fall back on pg_ctl.
-	kill(9, $self->{_pid})
-	  or PostgreSQL::Test::Utils::system_or_bail('pg_ctl', 'kill', 'KILL', $self->{_pid});
+	kill(9, $self->{_pid});
 	$self->{_pid} = undef;
 	return;
 }
@@ -1845,19 +1843,13 @@ sub psql
 		}
 	};
 
-	# Note: on Windows, IPC::Run seems to convert \r\n to \n in program output
-	# if we're using native Perl, but not if we're using MSys Perl.  So do it
-	# by hand in the latter case, here and elsewhere.
-
 	if (defined $$stdout)
 	{
-		$$stdout =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
 		chomp $$stdout;
 	}
 
 	if (defined $$stderr)
 	{
-		$$stderr =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
 		chomp $$stderr;
 	}
 
@@ -2337,9 +2329,7 @@ sub poll_query_until
 		my $result = IPC::Run::run $cmd, '<', \$query,
 		  '>', \$stdout, '2>', \$stderr;
 
-		$stdout =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
 		chomp($stdout);
-		$stderr =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
 		chomp($stderr);
 
 		if ($stdout eq $expected && $stderr eq '')
@@ -2849,9 +2839,6 @@ sub pg_recvlogical_upto
 		}
 	};
 
-	$stdout =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
-	$stderr =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
-
 	if (wantarray)
 	{
 		return ($ret, $stdout, $stderr, $timeout);
diff --git a/src/test/perl/PostgreSQL/Test/Utils.pm b/src/test/perl/PostgreSQL/Test/Utils.pm
index fc8ca74194..2c0c72f57a 100644
--- a/src/test/perl/PostgreSQL/Test/Utils.pm
+++ b/src/test/perl/PostgreSQL/Test/Utils.pm
@@ -401,7 +401,6 @@ sub run_command
 	my ($cmd) = @_;
 	my ($stdout, $stderr);
 	my $result = IPC::Run::run $cmd, '>', \$stdout, '2>', \$stderr;
-	foreach ($stderr, $stdout) { s/\r\n/\n/g if $Config{osname} eq 'msys'; }
 	chomp($stdout);
 	chomp($stderr);
 	return ($stdout, $stderr);
@@ -486,7 +485,6 @@ sub slurp_file
 	$contents = <$fh>;
 	close $fh;
 
-	$contents =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
 	return $contents;
 }
 
@@ -844,7 +842,6 @@ sub command_like
 	my $result = IPC::Run::run $cmd, '>', \$stdout, '2>', \$stderr;
 	ok($result, "$test_name: exit code 0");
 	is($stderr, '', "$test_name: no stderr");
-	$stdout =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
 	like($stdout, $expected_stdout, "$test_name: matches");
 	return;
 }
@@ -897,7 +894,6 @@ sub command_fails_like
 	print("# Running: " . join(" ", @{$cmd}) . "\n");
 	my $result = IPC::Run::run $cmd, '>', \$stdout, '2>', \$stderr;
 	ok(!$result, "$test_name: exit code not 0");
-	$stderr =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
 	like($stderr, $expected_stderr, "$test_name: matches");
 	return;
 }
@@ -942,8 +938,6 @@ sub command_checks_all
 	  if $ret & 127;
 	$ret = $ret >> 8;
 
-	foreach ($stderr, $stdout) { s/\r\n/\n/g if $Config{osname} eq 'msys'; }
-
 	# check status
 	ok($ret == $expected_ret,
 		"$test_name status (got $ret vs expected $expected_ret)");
diff --git a/src/test/recovery/t/021_row_visibility.pl b/src/test/recovery/t/021_row_visibility.pl
index e2743518de..75cd487451 100644
--- a/src/test/recovery/t/021_row_visibility.pl
+++ b/src/test/recovery/t/021_row_visibility.pl
@@ -182,9 +182,6 @@ sub send_query_and_wait
 	$$psql{run}->pump_nb();
 	while (1)
 	{
-		# See PostgreSQL::Test::Cluster.pm's psql()
-		$$psql{stdout} =~ s/\r\n/\n/g if $Config{osname} eq 'msys';
-
 		last if $$psql{stdout} =~ /$untl/;
 
 		if ($psql_timeout->is_expired)
diff --git a/src/test/recovery/t/cp_history_files b/src/test/recovery/t/cp_history_files
index 66f1b598fe..cfeea41e5b 100644
--- a/src/test/recovery/t/cp_history_files
+++ b/src/test/recovery/t/cp_history_files
@@ -7,11 +7,4 @@ use warnings;
 die "wrong number of arguments" if @ARGV != 2;
 my ($source, $target) = @ARGV;
 exit if $source !~ /history/;
-if ($^O eq 'msys')
-{
-    # make a windows path look like an msys path if necessary
-    $source =~ s!^([A-Za-z]):!'/' . lc($1)!e;
-    $source =~ s!\\!/!g;
-}
-
 copy($source, $target) or die "couldn't copy $source to $target: $!";
-- 
2.34.1

#18Andrew Dunstan
andrew@dunslane.net
In reply to: Andrew Dunstan (#17)
Re: killing perl2host

On 2/19/22 13:04, Andrew Dunstan wrote:

On 2/16/22 15:46, Andrew Dunstan wrote:

Largely following a recipe from Andres, I have migrated buildfarm
animals fairywren and jacana to a setup that shouldn't need (and in fact
won't be able to use) PostgreSQL::Test:Utils::perl2host(). AFAICT these
two are the only buildfarm animals that run TAP tests under msys.

[...]

I suggest that we apply this patch:

[...]

and if nothing breaks in a few days I will set about a more thorough
removal of perl2host() and adjusting everywhere it's called, and we can
forget that the whole sorry mess ever happened :-) I know a number of
people who will be overjoyed.

OK, nothing broke, so here are two more invasive patches. The first
removes perl2host completely and adjusts  all the places that use it.
The second removes almost all the remaining msys special processing in
TAP tests.

I have tested these and they appear to work fine.

It turns out we can also remove the skip code in
src/bin/pg_dump/t/010_dump_connstr.pl

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

#19Andres Freund
andres@anarazel.de
In reply to: Andrew Dunstan (#17)
Re: killing perl2host

Hi,

On 2022-02-19 13:04:05 -0500, Andrew Dunstan wrote:

OK, nothing broke, so here are two more invasive patches.

Great!

The first
removes perl2host completely and adjusts� all the places that use it.
The second removes almost all the remaining msys special processing in
TAP tests.

Hm. Do we have to worry about backpatched bugfixes breaking in the
backbranches? Or are you planning to backpatch this stuff?

Greetings,

Andres Freund

#20Andrew Dunstan
andrew@dunslane.net
In reply to: Andres Freund (#19)
Re: killing perl2host

On 2/19/22 16:34, Andres Freund wrote:

Hi,

On 2022-02-19 13:04:05 -0500, Andrew Dunstan wrote:

OK, nothing broke, so here are two more invasive patches.

Great!

The first
removes perl2host completely and adjusts  all the places that use it.
The second removes almost all the remaining msys special processing in
TAP tests.

Hm. Do we have to worry about backpatched bugfixes breaking in the
backbranches? Or are you planning to backpatch this stuff?

I will backpatch it. That'll be a bit of fun given how much the TAP
tests change, but I think it's worth it.

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

#21Andres Freund
andres@anarazel.de
In reply to: Andrew Dunstan (#20)
Re: killing perl2host

On 2022-02-19 16:51:18 -0500, Andrew Dunstan wrote:

I will backpatch it. That'll be a bit of fun given how much the TAP
tests change, but I think it's worth it.

Agreed. And thanks.

#22Thomas Munro
thomas.munro@gmail.com
In reply to: Andrew Dunstan (#20)
Re: killing perl2host

On Sun, Feb 20, 2022 at 10:51 AM Andrew Dunstan <andrew@dunslane.net> wrote:

On 2/19/22 16:34, Andres Freund wrote:

The first
removes perl2host completely and adjusts all the places that use it.
The second removes almost all the remaining msys special processing in
TAP tests.

Very nice improvement. Thanks for sorting this out. I didn't enjoy
playing "Wordle" with the build farm.