git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0ae3b46)
Fix an issue in PostgreSQL::Test::Cluster:psql()
2024年1月18日 07:46:42 +0000 (08:46 +0100)
2024年1月18日 07:46:42 +0000 (08:46 +0100)
Due to the commit c5385929 which made all Perl warnings to fatal, use
of PostgreSQL::Test::Cluster:psql() and safe_psql() with timeout
started to fail with the following error:

Use of uninitialized value $ret in bitwise and (&) at
..src/test/perl/PostgreSQL/Test/Cluster.pm line 2015.

Fix that by placing $ret conversion code in psql() in an if (defined
$ret) block.

With this change, the behavior of psql() becomes same as before, that
is, the whole function returns undef on timeout, which is usefully
different from returning 0.

Author: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/06f899fd-1826-05ab-42d6-adeb1fd5e200%40eisentraut.org


diff --git a/src/test/perl/PostgreSQL/Test/Cluster.pm b/src/test/perl/PostgreSQL/Test/Cluster.pm
index 406c405015bfa317d430f418da3db14d6720f46b..e2e70d0dbf9ad24c58e8c9830975081159219779 100644 (file)
--- a/src/test/perl/PostgreSQL/Test/Cluster.pm
+++ b/src/test/perl/PostgreSQL/Test/Cluster.pm
@@ -2012,12 +2012,15 @@ sub psql
# We don't use IPC::Run::Simple to limit dependencies.
#
# We always die on signal.
- my $core = $ret & 128 ? " (core dumped)" : "";
- die "psql exited with signal "
- . ($ret & 127)
- . "$core: '$$stderr' while running '@psql_params'"
- if $ret & 127;
- $ret = $ret >> 8;
+ if (defined $ret)
+ {
+ my $core = $ret & 128 ? " (core dumped)" : "";
+ die "psql exited with signal "
+ . ($ret & 127)
+ . "$core: '$$stderr' while running '@psql_params'"
+ if $ret & 127;
+ $ret = $ret >> 8;
+ }
if ($ret && $params{on_error_die})
{
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /