Make all Perl warnings fatal

There are a lot of Perl scripts in the tree, mostly code generation
and TAP tests.  Occasionally, these scripts produce warnings.  These
are probably always mistakes on the developer side (true positives).
Typical examples are warnings from genbki.pl or related when you make
a mess in the catalog files during development, or warnings from tests
when they massage a config file that looks different on different
hosts, or mistakes during merges (e.g., duplicate subroutine
definitions), or just mistakes that weren't noticed because there is a
lot of output in a verbose build.

This changes all warnings into fatal errors, by replacing

    use warnings;

by

    use warnings FATAL => 'all';

in all Perl files.

Discussion: https://www.postgresql.org/message-id/flat/06f899fd-1826-05ab-42d6-adeb1fd5e200%40eisentraut.org
This commit is contained in:
Peter Eisentraut 2023-12-29 18:01:53 +01:00
parent 7418767f11
commit c538592959
278 changed files with 282 additions and 280 deletions

View File

@ -5,7 +5,7 @@
# but specify them anyway for documentation's sake.)
#
use strict;
use warnings;
use warnings FATAL => 'all';
use Config;
use IPC::Run 0.79;

View File

@ -2,7 +2,7 @@
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;

View File

@ -3,7 +3,7 @@
# Test CREATE INDEX CONCURRENTLY with concurrent modifications
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;

View File

@ -3,7 +3,7 @@
# Test CREATE INDEX CONCURRENTLY with concurrent prepared-xact modifications
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;

View File

@ -5,7 +5,7 @@
# presence of breaking sort order changes.
#
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;
use Test::More;

View File

@ -2,7 +2,7 @@
# Test integrity of intermediate states by PITR to those states
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;
use Test::More;

View File

@ -2,7 +2,7 @@
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;

View File

@ -1,7 +1,7 @@
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;

View File

@ -3,7 +3,7 @@
# Test generic xlog record work for bloom index replication.
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;
use Test::More;

View File

@ -9,7 +9,7 @@
#
use strict;
use warnings;
use warnings FATAL => 'all';
die "Usage: $0 OUTPUT_FILE\n" if @ARGV != 1;
my $output_file = $ARGV[0];

View File

@ -3,7 +3,7 @@
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
# make sure we are in a sane environment.
use DBI();

View File

@ -5,7 +5,7 @@
# contrib/intarray/bench/create_test.pl
use strict;
use warnings;
use warnings FATAL => 'all';
print <<EOT;
create table message (

View File

@ -2,7 +2,7 @@
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Utils;
use Test::More;

View File

@ -2,7 +2,7 @@
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;

View File

@ -3,7 +3,7 @@
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
my $integer = '[+-]?[0-9]+';
my $real = '[+-]?[0-9]+\.[0-9]+';

View File

@ -5,7 +5,7 @@
# this script will sort any table with the segment data type in its last column
use strict;
use warnings;
use warnings FATAL => 'all';
my @rows;

View File

@ -4,7 +4,7 @@
# Test replication statistics data in pg_stat_replication_slots is sane after
# drop replication slot and restart.
use strict;
use warnings;
use warnings FATAL => 'all';
use File::Path qw(rmtree);
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;

View File

@ -2,7 +2,7 @@
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Utils;
use Test::More;

View File

@ -4,7 +4,7 @@
# Copyright (c) 2000-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
print
"<!-- autogenerated from src/backend/utils/errcodes.txt, do not edit -->\n";

View File

@ -5,7 +5,7 @@
# Copyright (c) 2019-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
my @sql_versions = reverse sort ('1992', '2016', '2023');

View File

@ -4,7 +4,7 @@
# Copyright (c) 2000-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
my $targets_meson_file = $ARGV[0];
open my $targets_meson, '<', $targets_meson_file or die;

View File

@ -3,7 +3,7 @@
# doc/src/sgml/mk_feature_tables.pl
use strict;
use warnings;
use warnings FATAL => 'all';
my $yesno = $ARGV[0];

View File

@ -14,7 +14,7 @@
package Catalog;
use strict;
use warnings;
use warnings FATAL => 'all';
use File::Compare;

View File

@ -14,7 +14,7 @@
#----------------------------------------------------------------------
use strict;
use warnings;
use warnings FATAL => 'all';
use Getopt::Long;
use FindBin;

View File

@ -16,7 +16,7 @@
#----------------------------------------------------------------------
use strict;
use warnings;
use warnings FATAL => 'all';
use File::Basename;
use Getopt::Long;

View File

@ -7,7 +7,7 @@
# Copyright (c) 2009-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
my $gram_filename = $ARGV[0];
my $kwlist_filename = $ARGV[1];

View File

@ -1,7 +1,7 @@
#!/usr/bin/perl
use strict;
use warnings;
use warnings FATAL => 'all';
use Getopt::Long;
my $outdir_path = '';

View File

@ -4,7 +4,7 @@
# Copyright (c) 2000-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
use Getopt::Long;
my $output_path = '.';

View File

@ -7,7 +7,7 @@
#-------------------------------------------------------------------------
use strict;
use warnings;
use warnings FATAL => 'all';
m/^\s*probe / || next;
s/^\s*probe ([^(]*)(.*);/$1$2/;

View File

@ -17,7 +17,7 @@
use Catalog;
use strict;
use warnings;
use warnings FATAL => 'all';
use Getopt::Long;
my $output_path = '';

View File

@ -15,7 +15,7 @@
#----------------------------------------------------------------------
use strict;
use warnings;
use warnings FATAL => 'all';
use Getopt::Long;
my $output_path = '.';

View File

@ -4,7 +4,7 @@
# Copyright (c) 2000-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
use Getopt::Long;
my $outfile = '';

View File

@ -25,7 +25,7 @@
# # and Unicode name (not used in this script)
use strict;
use warnings;
use warnings FATAL => 'all';
use convutils;

View File

@ -14,7 +14,7 @@
# and the "b" field is the hex byte sequence for GB18030
use strict;
use warnings;
use warnings FATAL => 'all';
use convutils;

View File

@ -8,7 +8,7 @@
# "euc-jis-2004-std.txt" (http://x0213.org)
use strict;
use warnings;
use warnings FATAL => 'all';
use convutils;

View File

@ -12,7 +12,7 @@
# organization's ftp site.
use strict;
use warnings;
use warnings FATAL => 'all';
use convutils;

View File

@ -17,7 +17,7 @@
# # and Unicode name (not used in this script)
use strict;
use warnings;
use warnings FATAL => 'all';
use convutils;

View File

@ -18,7 +18,7 @@
# # and Unicode name (not used in this script)
use strict;
use warnings;
use warnings FATAL => 'all';
use convutils;

View File

@ -14,7 +14,7 @@
# and the "b" field is the hex byte sequence for GB18030
use strict;
use warnings;
use warnings FATAL => 'all';
use convutils;

View File

@ -16,7 +16,7 @@
# # and Unicode name (not used in this script)
use strict;
use warnings;
use warnings FATAL => 'all';
use convutils;

View File

@ -8,7 +8,7 @@
# "sjis-0213-2004-std.txt" (http://x0213.org)
use strict;
use warnings;
use warnings FATAL => 'all';
use convutils;

View File

@ -11,7 +11,7 @@
# ftp site.
use strict;
use warnings;
use warnings FATAL => 'all';
use convutils;

View File

@ -14,7 +14,7 @@
# and the "b" field is the hex byte sequence for UHC
use strict;
use warnings;
use warnings FATAL => 'all';
use convutils;

View File

@ -16,7 +16,7 @@
# # and Unicode name (not used in this script)
use strict;
use warnings;
use warnings FATAL => 'all';
use convutils;

View File

@ -6,7 +6,7 @@
package convutils;
use strict;
use warnings;
use warnings FATAL => 'all';
use Carp;
use Exporter 'import';

View File

@ -6,7 +6,7 @@
# Successful initdb consumes much time and I/O.
use strict;
use warnings;
use warnings FATAL => 'all';
use Fcntl ':mode';
use File::stat qw{lstat};
use PostgreSQL::Test::Cluster;

View File

@ -2,7 +2,7 @@
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Utils;
use Test::More;

View File

@ -2,7 +2,7 @@
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;

View File

@ -2,7 +2,7 @@
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;

View File

@ -2,7 +2,7 @@
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;

View File

@ -5,7 +5,7 @@
# presence of breaking sort order changes.
#
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;
use Test::More;

View File

@ -2,7 +2,7 @@
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Utils;
use Test::More;

View File

@ -2,7 +2,7 @@
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
use File::Basename qw(basename dirname);
use File::Path qw(rmtree);
use PostgreSQL::Test::Cluster;

View File

@ -1,7 +1,7 @@
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;
use Test::More;

View File

@ -2,7 +2,7 @@
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Utils;
use PostgreSQL::Test::Cluster;
use Test::More;

View File

@ -2,7 +2,7 @@
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Utils;
use PostgreSQL::Test::Cluster;
use Test::More;

View File

@ -2,7 +2,7 @@
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Utils;
use Test::More;

View File

@ -5,7 +5,7 @@
# an initialized cluster.
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;

View File

@ -1,7 +1,7 @@
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Utils;
use Test::More;

View File

@ -1,7 +1,7 @@
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
use File::Compare;
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;

View File

@ -4,7 +4,7 @@
# properly even when the reference backup is on a different timeline.
use strict;
use warnings;
use warnings FATAL => 'all';
use File::Compare;
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;

View File

@ -6,7 +6,7 @@
# pg_combinebackup does not produce a manifest when run with --no-manifest.
use strict;
use warnings;
use warnings FATAL => 'all';
use File::Compare;
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;

View File

@ -5,7 +5,7 @@
# prior backup.
use strict;
use warnings;
use warnings FATAL => 'all';
use File::Compare;
use File::Path qw(rmtree);
use PostgreSQL::Test::Cluster;

View File

@ -2,7 +2,7 @@
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Utils;
use Test::More;

View File

@ -2,7 +2,7 @@
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;
use Test::More;

View File

@ -2,7 +2,7 @@
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;

View File

@ -2,7 +2,7 @@
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;

View File

@ -2,7 +2,7 @@
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;

View File

@ -2,7 +2,7 @@
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;

View File

@ -2,7 +2,7 @@
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;

View File

@ -2,7 +2,7 @@
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;

View File

@ -2,7 +2,7 @@
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;

View File

@ -2,7 +2,7 @@
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;

View File

@ -2,7 +2,7 @@
# Copyright (c) 2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;

View File

@ -2,7 +2,7 @@
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;

View File

@ -2,7 +2,7 @@
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;

View File

@ -4,7 +4,7 @@
# Tests for handling a corrupted pg_control
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;

View File

@ -2,7 +2,7 @@
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Utils;
use Test::More;

View File

@ -2,7 +2,7 @@
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Utils;
use Test::More;

View File

@ -4,7 +4,7 @@
# Test how pg_rewind reacts to extra files and directories in the data dirs.
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Utils;
use Test::More;

View File

@ -5,7 +5,7 @@
# Test pg_rewind when the target's pg_wal directory is a symlink.
#
use strict;
use warnings;
use warnings FATAL => 'all';
use File::Copy;
use File::Path qw(rmtree);
use PostgreSQL::Test::Utils;

View File

@ -6,7 +6,7 @@
# on the same timeline runs successfully.
#
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Utils;
use Test::More;

View File

@ -5,7 +5,7 @@
# Test checking options of pg_rewind.
#
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Utils;
use Test::More;

View File

@ -25,7 +25,7 @@
# as is.
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Utils;
use Test::More;

View File

@ -31,7 +31,7 @@
# nodes.
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;
use Test::More;

View File

@ -2,7 +2,7 @@
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Utils;
use Test::More;

View File

@ -32,7 +32,7 @@ package RewindTest;
# to run psql against the primary and standby servers, respectively.
use strict;
use warnings;
use warnings FATAL => 'all';
use Carp;
use Exporter 'import';

View File

@ -2,7 +2,7 @@
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Utils;
use Test::More;

View File

@ -2,7 +2,7 @@
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Utils;
use Test::More;

View File

@ -1,7 +1,7 @@
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Utils;
use Test::More;

View File

@ -2,7 +2,7 @@
# Set of tests for pg_upgrade, including cross-version checks.
use strict;
use warnings;
use warnings FATAL => 'all';
use Cwd qw(abs_path);
use File::Basename qw(dirname);

View File

@ -3,7 +3,7 @@
# Tests for upgrading logical replication slots
use strict;
use warnings;
use warnings FATAL => 'all';
use File::Find qw(find);

View File

@ -2,7 +2,7 @@
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Utils;
use Test::More;

View File

@ -4,7 +4,7 @@
# Verify that we can take and verify backups with various checksum types.
use strict;
use warnings;
use warnings FATAL => 'all';
use File::Path qw(rmtree);
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;

View File

@ -4,7 +4,7 @@
# Verify that various forms of corruption are detected by pg_verifybackup.
use strict;
use warnings;
use warnings FATAL => 'all';
use File::Path qw(rmtree);
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;

View File

@ -4,7 +4,7 @@
# Verify the behavior of assorted pg_verifybackup options.
use strict;
use warnings;
use warnings FATAL => 'all';
use File::Path qw(rmtree);
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;

View File

@ -5,7 +5,7 @@
# problems.
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;
use Test::More;

View File

@ -4,7 +4,7 @@
# Verify that pg_verifybackup handles hex-encoded filenames correctly.
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;
use Test::More;

View File

@ -4,7 +4,7 @@
# Test pg_verifybackup's WAL verification.
use strict;
use warnings;
use warnings FATAL => 'all';
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;
use Test::More;

View File

@ -6,7 +6,7 @@
# format.
use strict;
use warnings;
use warnings FATAL => 'all';
use File::Path qw(rmtree);
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;

Some files were not shown because too many files have changed in this diff Show More