From: Alexander Lakhin <exclusion@gmail.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Test 002_pg_upgrade fails with olddump on Windows
Date: Sat, 25 Nov 2023 23:00:01 +0300
Message-ID: <60d434b9-53d9-9ea1-819b-efebdcf44e41@gmail.com> (raw)
Hello,
When trying to use a custom dump with the test pg_upgrade/002_pg_upgrade,
I observe the following test failure on Windows:
>meson test --suite setup
>echo create database regression>...\dump.sql
>set olddump=...\dump.sql& set oldinstall=.../tmp_install/usr/local/pgsql& meson test pg_upgrade/002_pg_upgrade
1/1 postgresql:pg_upgrade / pg_upgrade/002_pg_upgrade ERROR 11.38s exit status 1
regress_log_002_pg_upgrade.txt contains:
...
[09:07:06.704](3.793s) ok 11 - run of pg_upgrade for new instance
...
[09:07:07.301](0.001s) not ok 15 - old and new dumps match after pg_upgrade
[09:07:07.301](0.000s) # Failed test 'old and new dumps match after pg_upgrade'
# at .../src/bin/pg_upgrade/t/002_pg_upgrade.pl line 452.
[09:07:07.301](0.000s) # got: '1'
# expected: '0'
=== diff of ...\build\testrun\pg_upgrade\002_pg_upgrade\data\tmp_test_ifk8/dump1.sql and
...\build\testrun\pg_upgrade\002_pg_upgrade\data\tmp_test_ifk8/dump2.sql
=== stdout ===
=== stderr ===
=== EOF ===
>dir "testrun\pg_upgrade\002_pg_upgrade\data\tmp_test_ifk8/"
11/25/2023 09:06 AM 2,729 dump1.sql
11/25/2023 09:07 AM 2,590 dump2.sql
>diff -s "testrun\pg_upgrade\002_pg_upgrade\data\tmp_test_ifk8\dump1.sql"
"testrun\pg_upgrade\002_pg_upgrade\data\tmp_test_ifk8\dump2.sql"
Files testrun\pg_upgrade\002_pg_upgrade\data\tmp_test_ifk8\dump1.sql and
testrun\pg_upgrade\002_pg_upgrade\data\tmp_test_ifk8\dump2.sql are identical
As I can see, dump1.sql contains line endings 0d 0a, while dump2.sql — 0a.
The attached patch fixes the issue for me.
Best regards,
Alexander
Attachments:fix_002_pg_upgrade-with-olddump-win.patch (text/x-patch, 397B) downloaddiff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.plindex c6d83d3c21..d34b45e346 100644--- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl+++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl@@ -293,6 +293,7 @@ if (defined($ENV{oldinstall}))
}
open my $fh, ">", $dump1_file or die "could not open dump file";
+ binmode $fh;
print $fh $dump_data;
close $fh;
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: exclusion@gmail.com
Subject: Re: Test 002_pg_upgrade fails with olddump on Windows
In-Reply-To: <60d434b9-53d9-9ea1-819b-efebdcf44e41@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox