Skip to content

Commit 686db12

Browse files
committed
Fix an issue in PostgreSQL::Test::Cluster:psql()
Due to the commit c538592 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
1 parent 0ae3b46 commit 686db12

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2012,12 +2012,15 @@ sub psql
20122012
# We don't use IPC::Run::Simple to limit dependencies.
20132013
#
20142014
# We always die on signal.
2015-
my $core = $ret & 128 ? " (core dumped)" : "";
2016-
die "psql exited with signal "
2017-
. ($ret & 127)
2018-
. "$core: '$$stderr' while running '@psql_params'"
2019-
if $ret & 127;
2020-
$ret = $ret >> 8;
2015+
if (defined $ret)
2016+
{
2017+
my $core = $ret & 128 ? " (core dumped)" : "";
2018+
die "psql exited with signal "
2019+
. ($ret & 127)
2020+
. "$core: '$$stderr' while running '@psql_params'"
2021+
if $ret & 127;
2022+
$ret = $ret >> 8;
2023+
}
20212024

20222025
if ($ret && $params{on_error_die})
20232026
{

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy