Skip to content

Commit 8b49392

Browse files
committed
Tweak regex to avoid a bug in Perl 5.16.3.
For some reason, 5.16.3 (and perhaps slightly earlier/later versions) go into an infinite loop with the version-replacement regex installed by commit fc0d0ce. We can work around that by using an explicit "\n" instead of the line-start metacharacter "^". Reported-by: Sami Imseih <samimseih@gmail.com> Discussion: https://postgr.es/m/CAA5RZ0u9dV3CdKqkqdusA_RdvBkwWe0c0rxcFWj++VYoutFYSw@mail.gmail.com
1 parent 7717f63 commit 8b49392

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ sub adjust_old_dumpfile
296296

297297
# Same with version argument to pg_restore_relation_stats() or
298298
# pg_restore_attribute_stats().
299-
$dump =~ s {(^\s+'version',) '\d+'::integer,$}
299+
$dump =~ s {\n(\s+'version',) '\d+'::integer,$}
300300
{$1 '000000'::integer,}mg;
301301

302302
if ($old_version < 16)
@@ -645,7 +645,7 @@ sub adjust_new_dumpfile
645645

646646
# Same with version argument to pg_restore_relation_stats() or
647647
# pg_restore_attribute_stats().
648-
$dump =~ s {(^\s+'version',) '\d+'::integer,$}
648+
$dump =~ s {\n(\s+'version',) '\d+'::integer,$}
649649
{$1 '000000'::integer,}mg;
650650

651651
# pre-v16 dumps do not know about XMLSERIALIZE(NO INDENT).

0 commit comments

Comments
 (0)