Re: Make all Perl warnings fatal

Peter Eisentraut <peter@eisentraut.org>

From: Peter Eisentraut <peter@eisentraut.org>
To: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2024-01-12T15:33:44Z
Lists: pgsql-hackers
On 11.01.24 12:29, Bharath Rupireddy wrote:
> On Sat, Dec 30, 2023 at 12:57 AM Peter Eisentraut <peter@eisentraut.org> wrote:
>>
>> committed
> 
> With the commit c5385929 converting perl warnings to FATAL, use of
> psql/safe_psql with timeout parameters [1] fail with the following
> error:
> 
> Use of uninitialized value $ret in bitwise and (&) at
> /home/ubuntu/postgres/src/test/recovery/../../../src/test/perl/PostgreSQL/Test/Cluster.pm
> line 2015.

I think what is actually relevant is the timed_out parameter, otherwise 
the psql/safe_psql function ends up calling "die" and you don't get any 
further.

> Perhaps assigning a default error code to $ret instead of undef in
> PostgreSQL::Test::Cluster - psql() function is the solution.

I would put this code

     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;

inside a if (defined $ret) block.

Then the behavior would be that the whole function returns undef on 
timeout, which is usefully different from returning 0 (and matches 
previous behavior).




Commits

  1. Add missing FATAL => 'all' to a use warnings in Perl

  2. Make all Perl warnings fatal in 043_wal_replay_wait.pl

  3. Add tap test for pg_signal_autovacuum role

  4. Implement pg_wal_replay_wait() stored procedure

  5. Fix an issue in PostgreSQL::Test::Cluster:psql()

  6. Make all Perl warnings fatal

  7. Fix a warning in Perl test code

  8. Avoid use of Perl getprotobyname