1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-21 05:21:08 +03:00

Change qr/foo$/m to qr/foo\n/m, for Perl 5.8.8.

In each case, absence of a trailing newline would itself constitute a
PostgreSQL bug.  Therefore, this slightly enhances the changed tests.
This works around a bug that last appeared in Perl 5.8.8, fixing
src/test/modules/test_pg_dump when run against that version.  Commit
e7293e3271 worked around the bug, but the
subsequent addition of test_pg_dump introduced affected code.  As that
commit had shown, slight increases in pattern complexity can suppress
the bug.  This commit edits qr/foo$/m patterns too complex to encounter
the bug today, for style consistency and robustness against unrelated
pattern changes.  Back-patch to 9.6, where test_pg_dump was introduced.

As of this writing, a fresh MSYS installation includes an affected Perl
5.8.8.  The Perl 5.8.8 in Red Hat Enterprise Linux 5.11 carries a patch
that renders it unaffected, but the Perl 5.8.5 of Red Hat Enterprise
Linux 4.4 is affected.
This commit is contained in:
Noah Misch
2016-11-07 20:27:30 -05:00
parent e3e66d8a98
commit 650b967076
4 changed files with 32 additions and 30 deletions

View File

@@ -46,6 +46,10 @@ against them and evaluate the results. For example:
$node->stop('fast');
Test::More::like entails use of the qr// operator. Avoid Perl 5.8.8 bug
#39185 by not using the "$" regular expression metacharacter in qr// when also
using the "/m" modifier. Instead of "$", use "\n" or "(?=\n|\z)".
Read the Test::More documentation for more on how to write tests:
perldoc Test::More