]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Fix 003_extrafiles.pl test for the Windows
authorAndrew Dunstan <andrew@dunslane.net>
Tue, 30 Jan 2024 22:09:44 +0000 (17:09 -0500)
committerAndrew Dunstan <andrew@dunslane.net>
Tue, 30 Jan 2024 22:12:37 +0000 (17:12 -0500)
File::Find converts backslashes to slashes in the newer Perl versions.
See: https://github.com/Perl/perl5/commit/414f14df98cb1c9a20f92c5c54948b67c09f072d

So, do the same conversion for Windows before comparing paths. To
support all Perl versions, always convert them on Windows regardless of
the Perl's version.

Author: Nazir Bilal Yavuz <byavuz81@gmail.com>

Backpatch to all live branches

src/bin/pg_rewind/t/003_extrafiles.pl

index c4040bd5620d5eabb2eceaef9157a5fc64ec2032..984f174662d0822edf9ecb7445835e0d923e94a1 100644 (file)
@@ -67,6 +67,19 @@ sub run_test
                },
                $test_master_datadir);
        @paths = sort @paths;
+
+       # File::Find converts backslashes to slashes in the newer Perl
+       # versions. To support all Perl versions, do the same conversion
+       # for Windows before comparing the paths.
+       if ($PostgreSQL::Test::Utils::windows_os)
+       {
+               for my $filename (@paths)
+               {
+                       $filename =~ s{\\}{/}g;
+               }
+               $test_primary_datadir =~ s{\\}{/}g;
+       }
+
        is_deeply(
                \@paths,
                [