Thread: perltidy version
Our instructions in src/tools/pgindent/README says to make sure we use perltidy version v20090616. However, this version no longer appears to be available for download on the link we provide -- the oldest one available is 20140328.
Is it perhaps time to move up to a newer version? Or failing that, perhaps we need to host our own copy of the old version?
Magnus Hagander <magnus@hagander.net> writes: > Our instructions in src/tools/pgindent/README says to make sure we use > perltidy version v20090616. However, this version no longer appears to be > available for download on the link we provide -- the oldest one available > is 20140328. It's available via MetaCPAN: https://metacpan.org/release/SHANCOCK/Perl-Tidy-20090616 Which means it can be installed with 'cpanm Perl::Tidy@20090616' or 'cpan SHANCOCK/Perl-Tidy-20090616.tar.gz' (the latter requires a BackPAN-inclusive mirror configured, e.g. cpan.metacpan.org). Direct tarball download link: https://cpan.metacpan.org/authors/id/S/SH/SHANCOCK/Perl-Tidy-20090616.tar.gz Or directly from BackPAN (the MetaCPAN mirror includes BackPAN): http://backpan.perl.org/authors/id/S/SH/SHANCOCK/Perl-Tidy-20090616.tar.gz > Is it perhaps time to move up to a newer version? Or failing that, perhaps > we need to host our own copy of the old version? BackPAN keeps all distributions ever uploaded to CPAN, unless removal is explicitly requested, e.g. for legal reasons, so there should be no need to host it ourselves. - ilmari -- "The surreality of the universe tends towards a maximum" -- Skud's Law "Never formulate a law or axiom that you're not prepared to live with the consequences of." -- Skud's Meta-Law
On Fri, Mar 2, 2018 at 1:30 PM, Dagfinn Ilmari Mannsåker <ilmari@ilmari.org> wrote:
Magnus Hagander <magnus@hagander.net> writes:
> Our instructions in src/tools/pgindent/README says to make sure we use
> perltidy version v20090616. However, this version no longer appears to be
> available for download on the link we provide -- the oldest one available
> is 20140328.
It's available via MetaCPAN:
https://metacpan.org/release/SHANCOCK/Perl-Tidy-20090616
Which means it can be installed with 'cpanm Perl::Tidy@20090616' or
'cpan SHANCOCK/Perl-Tidy-20090616.tar.gz' (the latter requires a
BackPAN-inclusive mirror configured, e.g. cpan.metacpan.org).
Direct tarball download link:
https://cpan.metacpan.org/authors/id/S/SH/SHANCOCK/Perl- Tidy-20090616.tar.gz
Or directly from BackPAN (the MetaCPAN mirror includes BackPAN):
http://backpan.perl.org/authors/id/S/SH/SHANCOCK/Perl- Tidy-20090616.tar.gz
> Is it perhaps time to move up to a newer version? Or failing that, perhaps
> we need to host our own copy of the old version?
BackPAN keeps all distributions ever uploaded to CPAN, unless removal is
explicitly requested, e.g. for legal reasons, so there should be no need
to host it ourselves.
In that case, we should at least update our instructions for how to install it. But that's definitely a better option than hosting our own copy.
Magnus Hagander wrote: > In that case, we should at least update our instructions for how to install > it. But that's definitely a better option than hosting our own copy. But surely the idea of updating the version to use should be considered further? Maybe they have even improved the output ;-) Has anyone looked? -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Alvaro Herrera <alvherre@alvh.no-ip.org> writes: > Magnus Hagander wrote: >> In that case, we should at least update our instructions for how to install >> it. But that's definitely a better option than hosting our own copy. > But surely the idea of updating the version to use should be considered > further? Maybe they have even improved the output ;-) Has anyone > looked? +1. We're not that far away from it being time to run pgindent/perltidy, so now would be a good time to consider whether we like a newer version's result better. If we do decide to stick on the old version, then yes, improve the pointer. regards, tom lane
On Fri, Mar 2, 2018 at 3:53 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
-- Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> Magnus Hagander wrote:
>> In that case, we should at least update our instructions for how to install
>> it. But that's definitely a better option than hosting our own copy.
> But surely the idea of updating the version to use should be considered
> further? Maybe they have even improved the output ;-) Has anyone
> looked?
+1. We're not that far away from it being time to run pgindent/perltidy,
so now would be a good time to consider whether we like a newer version's
result better.
If we do decide to stick on the old version, then yes, improve the
pointer.
For example, Debian ships with 20140328, which produces the attached diff. I'm not sure if we want to go to whatever is a "common version on most platforms" today, or just "whatever is latest" if we do upgrade. AFAICT RHEL 7 seems to be on 20121207, RHEL 6 on 20090616. And in Ubuntu, 14.04 has 20120701, 16.04 has 20140328, and current devel has 20140328. In general there seems to be very little overlap there, except Debian and Ubuntu covers the same versions.
(Note that this diff is against HEAD -- it's possible a perltidy run with the current version would also generate a diff, I have not compared them to each other)
Attachment
Magnus Hagander <magnus@hagander.net> writes: > On Fri, Mar 2, 2018 at 3:53 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote: >> +1. We're not that far away from it being time to run pgindent/perltidy, >> so now would be a good time to consider whether we like a newer version's >> result better. > For example, Debian ships with 20140328, which produces the attached diff. > I'm not sure if we want to go to whatever is a "common version on most > platforms" today, or just "whatever is latest" if we do upgrade. AFAICT > RHEL 7 seems to be on 20121207, RHEL 6 on 20090616. And in Ubuntu, 14.04 > has 20120701, 16.04 has 20140328, and current devel has 20140328. In > general there seems to be very little overlap there, except Debian and > Ubuntu covers the same versions. > (Note that this diff is against HEAD -- it's possible a perltidy run with > the current version would also generate a diff, I have not compared them to > each other) Yeah, perltidy 20090616 already produces a pretty substantial diff on HEAD; attached. regards, tom lane diff --git a/src/backend/catalog/Catalog.pm b/src/backend/catalog/Catalog.pm index 9ced154..8857eb0 100644 --- a/src/backend/catalog/Catalog.pm +++ b/src/backend/catalog/Catalog.pm @@ -37,7 +37,7 @@ sub Catalogs foreach my $input_file (@_) { my %catalog; - my $is_varlen = 0; + my $is_varlen = 0; $catalog{columns} = []; $catalog{data} = []; @@ -194,8 +194,8 @@ sub Catalogs $atttype .= '[]'; } - $column{type} = $atttype; - $column{name} = $attname; + $column{type} = $atttype; + $column{name} = $attname; $column{is_varlen} = 1 if $is_varlen; foreach my $attopt (@attopts) @@ -278,6 +278,7 @@ sub AddDefaultValues } else { + # Failed to find a value. push @missing_fields, $attname; } @@ -287,7 +288,7 @@ sub AddDefaultValues { $msg = "Missing values for: " . join(', ', @missing_fields); $msg .= "\nShowing other values for context:\n"; - while (my($key, $value) = each %$row) + while (my ($key, $value) = each %$row) { $msg .= "$key => $value, "; } diff --git a/src/backend/catalog/genbki.pl b/src/backend/catalog/genbki.pl index ed90a02..f80f718 100644 --- a/src/backend/catalog/genbki.pl +++ b/src/backend/catalog/genbki.pl @@ -88,10 +88,10 @@ open my $shdescr, '>', $shdescrfile . $tmpext # file's dependencies by src/backend/catalog/Makefile. my $BOOTSTRAP_SUPERUSERID = Catalog::FindDefinedSymbol('pg_authid.h', \@include_path, - 'BOOTSTRAP_SUPERUSERID'); + 'BOOTSTRAP_SUPERUSERID'); my $PG_CATALOG_NAMESPACE = Catalog::FindDefinedSymbol('pg_namespace.h', \@include_path, - 'PG_CATALOG_NAMESPACE'); + 'PG_CATALOG_NAMESPACE'); # Read all the input header files into internal data structures my $catalogs = Catalog::Catalogs(@input_files); @@ -268,7 +268,7 @@ foreach my $catname (@{ $catalogs->{names} }) morph_row_for_schemapg(\%row, $schema); push @{ $schemapg_entries{$table_name} }, sprintf "{ %s }", - join(', ', grep { defined $_ } @row{@attnames}); + join(', ', grep { defined $_ } @row{@attnames}); } # Generate entries for system attributes. @@ -422,11 +422,11 @@ sub morph_row_for_pgattr # compare DefineAttr in bootstrap.c. oidvector and # int2vector are also treated as not-nullable. $row->{attnotnull} = - $type->{typname} eq 'oidvector' ? 't' - : $type->{typname} eq 'int2vector' ? 't' - : $type->{typlen} eq 'NAMEDATALEN' ? 't' - : $type->{typlen} > 0 ? 't' - : 'f'; + $type->{typname} eq 'oidvector' ? 't' + : $type->{typname} eq 'int2vector' ? 't' + : $type->{typlen} eq 'NAMEDATALEN' ? 't' + : $type->{typlen} > 0 ? 't' + : 'f'; } else { @@ -468,11 +468,13 @@ sub morph_row_for_schemapg # Some data types have special formatting rules. if ($atttype eq 'name') { + # add {" ... "} quoting $row->{$attname} = sprintf(qq'{"%s"}', $row->{$attname}); } elsif ($atttype eq 'char') { + # Replace empty string by zero char constant; add single quotes $row->{$attname} = '\0' if $row->{$attname} eq q|""|; $row->{$attname} = sprintf("'%s'", $row->{$attname}); @@ -483,7 +485,7 @@ sub morph_row_for_schemapg # don't change. elsif ($atttype eq 'bool') { - $row->{$attname} = 'true' if $row->{$attname} eq 't'; + $row->{$attname} = 'true' if $row->{$attname} eq 't'; $row->{$attname} = 'false' if $row->{$attname} eq 'f'; } diff --git a/src/backend/utils/Gen_fmgrtab.pl b/src/backend/utils/Gen_fmgrtab.pl index 4ae86df..e8e93fc 100644 --- a/src/backend/utils/Gen_fmgrtab.pl +++ b/src/backend/utils/Gen_fmgrtab.pl @@ -56,9 +56,11 @@ die "No input files.\n" if !$infile; die "No include path; you must specify -I at least once.\n" if !@include_path; my $FirstBootstrapObjectId = - Catalog::FindDefinedSymbol('access/transam.h', \@include_path, 'FirstBootstrapObjectId'); + Catalog::FindDefinedSymbol('access/transam.h', \@include_path, + 'FirstBootstrapObjectId'); my $INTERNALlanguageId = - Catalog::FindDefinedSymbol('catalog/pg_language.h', \@include_path, 'INTERNALlanguageId'); + Catalog::FindDefinedSymbol('catalog/pg_language.h', \@include_path, + 'INTERNALlanguageId'); # Read all the data from the include/catalog files. my $catalogs = Catalog::Catalogs($infile); @@ -216,7 +218,7 @@ foreach my $s (sort { $a->{oid} <=> $b->{oid} } @fmgr) print $tfh " { $s->{oid}, \"$s->{prosrc}\", $s->{nargs}, $bmap{$s->{strict}}, $bmap{$s->{retset}}, $s->{prosrc} }"; - $fmgr_builtin_oid_index[$s->{oid}] = $fmgr_count++; + $fmgr_builtin_oid_index[ $s->{oid} ] = $fmgr_count++; if ($fmgr_count <= $#fmgr) { diff --git a/src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl b/src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl index 1d3a1e4..97b0a07 100644 --- a/src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl +++ b/src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl @@ -10,11 +10,8 @@ program_options_handling_ok('pg_archivecleanup'); my $tempdir = TestLib::tempdir; my @walfiles = ( - '00000001000000370000000C.gz', - '00000001000000370000000D', - '00000001000000370000000E', - '00000001000000370000000F.partial', -); + '00000001000000370000000C.gz', '00000001000000370000000D', + '00000001000000370000000E', '00000001000000370000000F.partial',); sub create_files { @@ -28,32 +25,43 @@ sub create_files create_files(); -command_fails_like(['pg_archivecleanup'], - qr/must specify archive location/, - 'fails if archive location is not specified'); +command_fails_like( + ['pg_archivecleanup'], + qr/must specify archive location/, + 'fails if archive location is not specified'); -command_fails_like(['pg_archivecleanup', $tempdir], - qr/must specify oldest kept WAL file/, - 'fails if oldest kept WAL file name is not specified'); +command_fails_like( + [ 'pg_archivecleanup', $tempdir ], + qr/must specify oldest kept WAL file/, + 'fails if oldest kept WAL file name is not specified'); -command_fails_like(['pg_archivecleanup', 'notexist', 'foo'], - qr/archive location .* does not exist/, - 'fails if archive location does not exist'); +command_fails_like( + [ 'pg_archivecleanup', 'notexist', 'foo' ], + qr/archive location .* does not exist/, + 'fails if archive location does not exist'); -command_fails_like(['pg_archivecleanup', $tempdir, 'foo', 'bar'], - qr/too many command-line arguments/, - 'fails with too many command-line arguments'); +command_fails_like( + [ 'pg_archivecleanup', $tempdir, 'foo', 'bar' ], + qr/too many command-line arguments/, + 'fails with too many command-line arguments'); -command_fails_like(['pg_archivecleanup', $tempdir, 'foo'], - qr/invalid file name argument/, - 'fails with invalid restart file name'); +command_fails_like( + [ 'pg_archivecleanup', $tempdir, 'foo' ], + qr/invalid file name argument/, + 'fails with invalid restart file name'); { + # like command_like but checking stderr my $stderr; - my $result = IPC::Run::run ['pg_archivecleanup', '-d', '-n', $tempdir, $walfiles[2]], '2>', \$stderr; + my $result = + IPC::Run::run [ 'pg_archivecleanup', '-d', '-n', $tempdir, + $walfiles[2] ], '2>', \$stderr; ok($result, "pg_archivecleanup dry run: exit code 0"); - like($stderr, qr/$walfiles[1].*would be removed/, "pg_archivecleanup dry run: matches"); + like( + $stderr, + qr/$walfiles[1].*would be removed/, + "pg_archivecleanup dry run: matches"); foreach my $fn (@walfiles) { ok(-f "$tempdir/$fn", "$fn not removed"); @@ -66,16 +74,23 @@ sub run_check create_files(); - command_ok(['pg_archivecleanup', '-x', '.gz', $tempdir, $walfiles[2] . $suffix], - "$test_name: runs"); - - ok(! -f "$tempdir/$walfiles[0]", "$test_name: first older WAL file was cleaned up"); - ok(! -f "$tempdir/$walfiles[1]", "$test_name: second older WAL file was cleaned up"); - ok(-f "$tempdir/$walfiles[2]", "$test_name: restartfile was not cleaned up"); - ok(-f "$tempdir/$walfiles[3]", "$test_name: newer WAL file was not cleaned up"); - ok(-f "$tempdir/unrelated_file", "$test_name: unrelated file was not cleaned up"); + command_ok( + [ 'pg_archivecleanup', '-x', '.gz', $tempdir, $walfiles[2] . $suffix + ], + "$test_name: runs"); + + ok(!-f "$tempdir/$walfiles[0]", + "$test_name: first older WAL file was cleaned up"); + ok(!-f "$tempdir/$walfiles[1]", + "$test_name: second older WAL file was cleaned up"); + ok(-f "$tempdir/$walfiles[2]", + "$test_name: restartfile was not cleaned up"); + ok(-f "$tempdir/$walfiles[3]", + "$test_name: newer WAL file was not cleaned up"); + ok(-f "$tempdir/unrelated_file", + "$test_name: unrelated file was not cleaned up"); } -run_check('', 'pg_archivecleanup'); -run_check('.partial', 'pg_archivecleanup with .partial file'); +run_check('', 'pg_archivecleanup'); +run_check('.partial', 'pg_archivecleanup with .partial file'); run_check('.00000020.backup', 'pg_archivecleanup with .backup file'); diff --git a/src/bin/pg_basebackup/t/010_pg_basebackup.pl b/src/bin/pg_basebackup/t/010_pg_basebackup.pl index cdf4f5b..18ca77f 100644 --- a/src/bin/pg_basebackup/t/010_pg_basebackup.pl +++ b/src/bin/pg_basebackup/t/010_pg_basebackup.pl @@ -90,8 +90,7 @@ foreach my $dirname ( # These files should not be copied. foreach my $filename ( qw(postgresql.auto.conf.tmp postmaster.opts postmaster.pid tablespace_map current_logfiles.tmp - global/pg_internal.init) - ) + global/pg_internal.init)) { ok(!-f "$tempdir/backup/$filename", "$filename not copied"); } @@ -269,26 +268,34 @@ $node->command_fails( 'pg_basebackup fails with nonexistent replication slot'); $node->command_fails( - [ 'pg_basebackup', '-D', "$tempdir/backupxs_slot", '-C' ], + [ 'pg_basebackup', '-D', "$tempdir/backupxs_slot", '-C' ], 'pg_basebackup -C fails without slot name'); $node->command_fails( - [ 'pg_basebackup', '-D', "$tempdir/backupxs_slot", '-C', '-S', 'slot0', '--no-slot' ], + [ 'pg_basebackup', '-D', + "$tempdir/backupxs_slot", '-C', + '-S', 'slot0', + '--no-slot' ], 'pg_basebackup fails with -C -S --no-slot'); $node->command_ok( - [ 'pg_basebackup', '-D', "$tempdir/backupxs_slot", '-C', '-S', 'slot0' ], + [ 'pg_basebackup', '-D', "$tempdir/backupxs_slot", '-C', '-S', 'slot0' ], 'pg_basebackup -C runs'); -is($node->safe_psql('postgres', q{SELECT slot_name FROM pg_replication_slots WHERE slot_name = 'slot0'}), - 'slot0', - 'replication slot was created'); -isnt($node->safe_psql('postgres', q{SELECT restart_lsn FROM pg_replication_slots WHERE slot_name = 'slot0'}), - '', - 'restart LSN of new slot is not null'); +is( $node->safe_psql( + 'postgres', +q{SELECT slot_name FROM pg_replication_slots WHERE slot_name = 'slot0'}), + 'slot0', + 'replication slot was created'); +isnt( + $node->safe_psql( + 'postgres', +q{SELECT restart_lsn FROM pg_replication_slots WHERE slot_name = 'slot0'}), + '', + 'restart LSN of new slot is not null'); $node->command_fails( - [ 'pg_basebackup', '-D', "$tempdir/backupxs_slot1", '-C', '-S', 'slot0' ], + [ 'pg_basebackup', '-D', "$tempdir/backupxs_slot1", '-C', '-S', 'slot0' ], 'pg_basebackup fails with -C -S and a previously existing slot'); $node->safe_psql('postgres', diff --git a/src/bin/pg_basebackup/t/020_pg_receivewal.pl b/src/bin/pg_basebackup/t/020_pg_receivewal.pl index 64e3a35..1a44c40 100644 --- a/src/bin/pg_basebackup/t/020_pg_receivewal.pl +++ b/src/bin/pg_basebackup/t/020_pg_receivewal.pl @@ -38,7 +38,8 @@ is($slot->{'slot_type'}, 'physical', 'physical replication slot was created'); is($slot->{'restart_lsn'}, '', 'restart LSN of new slot is null'); $primary->command_ok([ 'pg_receivewal', '--slot', $slot_name, '--drop-slot' ], 'dropping a replication slot'); -is($primary->slot($slot_name)->{'slot_type'}, '', 'replication slot was removed'); +is($primary->slot($slot_name)->{'slot_type'}, + '', 'replication slot was removed'); # Generate some WAL. Use --synchronous at the same time to add more # code coverage. Switch to the next segment first so that subsequent diff --git a/src/bin/pg_dump/t/002_pg_dump.pl b/src/bin/pg_dump/t/002_pg_dump.pl index 6f74e15..489898b 100644 --- a/src/bin/pg_dump/t/002_pg_dump.pl +++ b/src/bin/pg_dump/t/002_pg_dump.pl @@ -1207,8 +1207,9 @@ my %tests = ( create_order => 23, create_sql => 'ALTER TABLE dump_test.test_table ENABLE ROW LEVEL SECURITY;', - regexp => qr/^ALTER TABLE dump_test.test_table ENABLE ROW LEVEL SECURITY;/m, - like => { + regexp => + qr/^ALTER TABLE dump_test.test_table ENABLE ROW LEVEL SECURITY;/m, + like => { binary_upgrade => 1, clean => 1, clean_if_exists => 1, @@ -1235,8 +1236,8 @@ my %tests = ( 'ALTER TABLE test_second_table OWNER TO' => { all_runs => 1, catch_all => 'ALTER ... OWNER commands (except post-data objects)', - regexp => qr/^ALTER TABLE dump_test.test_second_table OWNER TO .*;/m, - like => { + regexp => qr/^ALTER TABLE dump_test.test_second_table OWNER TO .*;/m, + like => { binary_upgrade => 1, clean => 1, clean_if_exists => 1, @@ -1261,8 +1262,9 @@ my %tests = ( 'ALTER TABLE test_third_table OWNER TO' => { all_runs => 1, catch_all => 'ALTER ... OWNER commands (except post-data objects)', - regexp => qr/^ALTER TABLE dump_test_second_schema.test_third_table OWNER TO .*;/m, - like => { + regexp => +qr/^ALTER TABLE dump_test_second_schema.test_third_table OWNER TO .*;/m, + like => { binary_upgrade => 1, clean => 1, clean_if_exists => 1, @@ -1313,8 +1315,9 @@ my %tests = ( 'ALTER TABLE measurement_y2006m2 OWNER TO' => { all_runs => 1, catch_all => 'ALTER ... OWNER commands (except post-data objects)', - regexp => qr/^ALTER TABLE dump_test_second_schema.measurement_y2006m2 OWNER TO .*;/m, - like => { + regexp => +qr/^ALTER TABLE dump_test_second_schema.measurement_y2006m2 OWNER TO .*;/m, + like => { binary_upgrade => 1, clean => 1, clean_if_exists => 1, @@ -1339,8 +1342,9 @@ my %tests = ( 'ALTER FOREIGN TABLE foreign_table OWNER TO' => { all_runs => 1, catch_all => 'ALTER ... OWNER commands (except post-data objects)', - regexp => qr/^ALTER FOREIGN TABLE dump_test.foreign_table OWNER TO .*;/m, - like => { + regexp => + qr/^ALTER FOREIGN TABLE dump_test.foreign_table OWNER TO .*;/m, + like => { binary_upgrade => 1, clean => 1, clean_if_exists => 1, @@ -1366,7 +1370,7 @@ my %tests = ( all_runs => 1, catch_all => 'ALTER ... OWNER commands (except post-data objects)', regexp => - qr/^ALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1 OWNER TO .*;/m, +qr/^ALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1 OWNER TO .*;/m, like => { binary_upgrade => 1, clean => 1, @@ -1393,7 +1397,7 @@ my %tests = ( all_runs => 1, catch_all => 'ALTER ... OWNER commands (except post-data objects)', regexp => - qr/^ALTER TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1 OWNER TO .*;/m, +qr/^ALTER TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1 OWNER TO .*;/m, like => { binary_upgrade => 1, clean => 1, @@ -1516,6 +1520,7 @@ qr/^ALTER (?!EVENT TRIGGER|LARGE OBJECT|STATISTICS|PUBLICATION|SUBSCRIPTION)(.*) all_runs => 1, catch_all => 'COMMENT commands', regexp => qr/^COMMENT ON DATABASE postgres IS .*;/m, + # Should appear in the same tests as "CREATE DATABASE postgres" like => { createdb => 1, }, unlike => { @@ -1548,8 +1553,9 @@ qr/^ALTER (?!EVENT TRIGGER|LARGE OBJECT|STATISTICS|PUBLICATION|SUBSCRIPTION)(.*) all_runs => 1, catch_all => 'COMMENT commands', regexp => qr/^COMMENT ON EXTENSION plpgsql IS .*;/m, + # this shouldn't ever get emitted anymore - like => {}, + like => {}, unlike => { binary_upgrade => 1, clean => 1, @@ -1580,8 +1586,9 @@ qr/^ALTER (?!EVENT TRIGGER|LARGE OBJECT|STATISTICS|PUBLICATION|SUBSCRIPTION)(.*) create_order => 36, create_sql => 'COMMENT ON TABLE dump_test.test_table IS \'comment on table\';', - regexp => qr/^COMMENT ON TABLE dump_test.test_table IS 'comment on table';/m, - like => { + regexp => + qr/^COMMENT ON TABLE dump_test.test_table IS 'comment on table';/m, + like => { binary_upgrade => 1, clean => 1, clean_if_exists => 1, @@ -1782,7 +1789,7 @@ qr/^COMMENT ON CONVERSION dump_test.test_conversion IS 'comment on test conversi create_sql => 'COMMENT ON COLLATION test0 IS \'comment on test0 collation\';', regexp => - qr/^COMMENT ON COLLATION public.test0 IS 'comment on test0 collation';/m, +qr/^COMMENT ON COLLATION public.test0 IS 'comment on test0 collation';/m, collation => 1, like => { binary_upgrade => 1, @@ -2060,8 +2067,9 @@ qr/^COMMENT ON TEXT SEARCH TEMPLATE dump_test.alt_ts_temp1 IS 'comment on text s create_order => 68, create_sql => 'COMMENT ON TYPE dump_test.planets IS \'comment on enum type\';', - regexp => qr/^COMMENT ON TYPE dump_test.planets IS 'comment on enum type';/m, - like => { + regexp => + qr/^COMMENT ON TYPE dump_test.planets IS 'comment on enum type';/m, + like => { binary_upgrade => 1, clean => 1, clean_if_exists => 1, @@ -2092,8 +2100,9 @@ qr/^COMMENT ON TEXT SEARCH TEMPLATE dump_test.alt_ts_temp1 IS 'comment on text s create_order => 69, create_sql => 'COMMENT ON TYPE dump_test.textrange IS \'comment on range type\';', - regexp => qr/^COMMENT ON TYPE dump_test.textrange IS 'comment on range type';/m, - like => { + regexp => +qr/^COMMENT ON TYPE dump_test.textrange IS 'comment on range type';/m, + like => { binary_upgrade => 1, clean => 1, clean_if_exists => 1, @@ -2124,8 +2133,9 @@ qr/^COMMENT ON TEXT SEARCH TEMPLATE dump_test.alt_ts_temp1 IS 'comment on text s create_order => 70, create_sql => 'COMMENT ON TYPE dump_test.int42 IS \'comment on regular type\';', - regexp => qr/^COMMENT ON TYPE dump_test.int42 IS 'comment on regular type';/m, - like => { + regexp => + qr/^COMMENT ON TYPE dump_test.int42 IS 'comment on regular type';/m, + like => { binary_upgrade => 1, clean => 1, clean_if_exists => 1, @@ -2157,7 +2167,7 @@ qr/^COMMENT ON TEXT SEARCH TEMPLATE dump_test.alt_ts_temp1 IS 'comment on text s create_sql => 'COMMENT ON TYPE dump_test.undefined IS \'comment on undefined type\';', regexp => - qr/^COMMENT ON TYPE dump_test.undefined IS 'comment on undefined type';/m, +qr/^COMMENT ON TYPE dump_test.undefined IS 'comment on undefined type';/m, like => { binary_upgrade => 1, clean => 1, @@ -2497,9 +2507,10 @@ qr/^COMMENT ON TEXT SEARCH TEMPLATE dump_test.alt_ts_temp1 IS 'comment on text s 'INSERT INTO test_fourth_table' => { all_runs => 1, catch_all => 'INSERT INTO ...', - regexp => qr/^\QINSERT INTO dump_test.test_fourth_table DEFAULT VALUES;\E/m, - like => { column_inserts => 1, }, - unlike => {}, }, + regexp => + qr/^\QINSERT INTO dump_test.test_fourth_table DEFAULT VALUES;\E/m, + like => { column_inserts => 1, }, + unlike => {}, }, 'INSERT INTO test_fifth_table' => { all_runs => 1, @@ -2752,8 +2763,9 @@ qr/CREATE CAST \(timestamp with time zone AS interval\) WITH FUNCTION pg_catalog regexp => qr/^ \QCREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;\E /xm, + # this shouldn't ever get emitted anymore - like => {}, + like => {}, unlike => { binary_upgrade => 1, clean => 1, @@ -4567,8 +4579,9 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog all_runs => 1, catch_all => 'CREATE ... commands', regexp => qr/^CREATE SCHEMA public;/m, + # this shouldn't ever get emitted anymore - like => {}, + like => {}, unlike => { binary_upgrade => 1, clean => 1, @@ -5213,27 +5226,28 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog all_runs => 1, catch_all => 'CREATE ... commands', create_order => 92, - create_sql => 'CREATE INDEX ON dump_test.measurement (city_id, logdate);', + create_sql => + 'CREATE INDEX ON dump_test.measurement (city_id, logdate);', regexp => qr/^ \QCREATE INDEX measurement_city_id_logdate_idx ON ONLY dump_test.measurement USING\E /xm, like => { - binary_upgrade => 1, - clean => 1, - clean_if_exists => 1, - createdb => 1, - defaults => 1, - exclude_test_table => 1, - exclude_test_table_data => 1, - no_blobs => 1, - no_privs => 1, - no_owner => 1, - only_dump_test_schema => 1, - pg_dumpall_dbprivs => 1, - schema_only => 1, - section_post_data => 1, - test_schema_plus_blobs => 1, - with_oids => 1, }, + binary_upgrade => 1, + clean => 1, + clean_if_exists => 1, + createdb => 1, + defaults => 1, + exclude_test_table => 1, + exclude_test_table_data => 1, + no_blobs => 1, + no_privs => 1, + no_owner => 1, + only_dump_test_schema => 1, + pg_dumpall_dbprivs => 1, + schema_only => 1, + section_post_data => 1, + test_schema_plus_blobs => 1, + with_oids => 1, }, unlike => { exclude_dump_test_schema => 1, only_dump_test_table => 1, @@ -5246,28 +5260,29 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog all_runs => 1, catch_all => 'CREATE ... commands', create_order => 93, - create_sql => 'ALTER TABLE dump_test.measurement ADD PRIMARY KEY (city_id, logdate);', + create_sql => +'ALTER TABLE dump_test.measurement ADD PRIMARY KEY (city_id, logdate);', regexp => qr/^ \QALTER TABLE ONLY dump_test.measurement\E \n^\s+ \QADD CONSTRAINT measurement_pkey PRIMARY KEY (city_id, logdate);\E /xm, like => { - binary_upgrade => 1, - clean => 1, - clean_if_exists => 1, - createdb => 1, - defaults => 1, - exclude_test_table => 1, - exclude_test_table_data => 1, - no_blobs => 1, - no_privs => 1, - no_owner => 1, - only_dump_test_schema => 1, - pg_dumpall_dbprivs => 1, - schema_only => 1, - section_post_data => 1, - test_schema_plus_blobs => 1, - with_oids => 1, }, + binary_upgrade => 1, + clean => 1, + clean_if_exists => 1, + createdb => 1, + defaults => 1, + exclude_test_table => 1, + exclude_test_table_data => 1, + no_blobs => 1, + no_privs => 1, + no_owner => 1, + only_dump_test_schema => 1, + pg_dumpall_dbprivs => 1, + schema_only => 1, + section_post_data => 1, + test_schema_plus_blobs => 1, + with_oids => 1, }, unlike => { exclude_dump_test_schema => 1, only_dump_test_table => 1, @@ -5277,9 +5292,9 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog section_pre_data => 1, }, }, 'CREATE INDEX ... ON measurement_y2006_m2' => { - all_runs => 1, - catch_all => 'CREATE ... commands', - regexp => qr/^ + all_runs => 1, + catch_all => 'CREATE ... commands', + regexp => qr/^ \QCREATE INDEX measurement_y2006m2_city_id_logdate_idx ON dump_test_second_schema.measurement_y2006m2 \E /xm, like => { @@ -5308,9 +5323,9 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog test_schema_plus_blobs => 1, }, }, 'ALTER INDEX ... ATTACH PARTITION' => { - all_runs => 1, - catch_all => 'CREATE ... commands', - regexp => qr/^ + all_runs => 1, + catch_all => 'CREATE ... commands', + regexp => qr/^ \QALTER INDEX dump_test.measurement_city_id_logdate_idx ATTACH PARTITION dump_test_second_schema.measurement_y2006m2_city_id_logdate_idx\E /xm, like => { @@ -5339,9 +5354,9 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog test_schema_plus_blobs => 1, }, }, 'ALTER INDEX ... ATTACH PARTITION (primary key)' => { - all_runs => 1, - catch_all => 'CREATE ... commands', - regexp => qr/^ + all_runs => 1, + catch_all => 'CREATE ... commands', + regexp => qr/^ \QALTER INDEX dump_test.measurement_pkey ATTACH PARTITION dump_test_second_schema.measurement_y2006m2_pkey\E /xm, like => { @@ -5463,9 +5478,10 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog all_runs => 1, catch_all => 'DROP ... commands', regexp => qr/^DROP SCHEMA public;/m, + # this shouldn't ever get emitted anymore - like => {}, - unlike => { + like => {}, + unlike => { clean => 1, clean_if_exists => 1, pg_dumpall_globals_clean => 1, }, }, @@ -5474,9 +5490,10 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog all_runs => 1, catch_all => 'DROP ... commands', regexp => qr/^DROP SCHEMA IF EXISTS public;/m, + # this shouldn't ever get emitted anymore - like => {}, - unlike => { + like => {}, + unlike => { clean => 1, clean_if_exists => 1, pg_dumpall_globals_clean => 1, }, }, @@ -5485,10 +5502,11 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog all_runs => 1, catch_all => 'DROP ... commands', regexp => qr/^DROP EXTENSION plpgsql;/m, + # this shouldn't ever get emitted anymore - like => {}, - unlike => { - clean => 1, + like => {}, + unlike => { + clean => 1, clean_if_exists => 1, pg_dumpall_globals_clean => 1, }, }, @@ -5568,9 +5586,10 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog all_runs => 1, catch_all => 'DROP ... commands', regexp => qr/^DROP EXTENSION IF EXISTS plpgsql;/m, + # this shouldn't ever get emitted anymore - like => {}, - unlike => { + like => {}, + unlike => { clean => 1, clean_if_exists => 1, pg_dumpall_globals_clean => 1, }, }, @@ -5979,7 +5998,7 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog create_sql => 'GRANT SELECT ON TABLE dump_test.test_table TO regress_dump_test_role;', regexp => - qr/^GRANT SELECT ON TABLE dump_test.test_table TO regress_dump_test_role;/m, +qr/^GRANT SELECT ON TABLE dump_test.test_table TO regress_dump_test_role;/m, like => { binary_upgrade => 1, clean => 1, @@ -6079,7 +6098,7 @@ qr/^GRANT SELECT ON TABLE dump_test_second_schema.test_third_table TO regress_du TABLE dump_test.measurement TO regress_dump_test_role;', regexp => - qr/^GRANT SELECT ON TABLE dump_test.measurement TO regress_dump_test_role;/m, +qr/^GRANT SELECT ON TABLE dump_test.measurement TO regress_dump_test_role;/m, like => { binary_upgrade => 1, clean => 1, @@ -6340,8 +6359,9 @@ qr/^GRANT SELECT ON TABLE dump_test_second_schema.measurement_y2006m2 TO regress \Q--\E\n\n \QGRANT USAGE ON SCHEMA public TO PUBLIC;\E /xm, + # this shouldn't ever get emitted anymore - like => {}, + like => {}, unlike => { binary_upgrade => 1, clean => 1, @@ -6578,8 +6598,9 @@ qr/^GRANT SELECT ON TABLE dump_test_second_schema.measurement_y2006m2 TO regress catch_all => 'REVOKE commands', create_order => 45, create_sql => 'REVOKE SELECT ON TABLE pg_proc FROM public;', - regexp => qr/^REVOKE SELECT ON TABLE pg_catalog.pg_proc FROM PUBLIC;/m, - like => { + regexp => + qr/^REVOKE SELECT ON TABLE pg_catalog.pg_proc FROM PUBLIC;/m, + like => { binary_upgrade => 1, clean => 1, clean_if_exists => 1, diff --git a/src/bin/pg_rewind/RewindTest.pm b/src/bin/pg_rewind/RewindTest.pm index 00b5b42..7dd8d0b 100644 --- a/src/bin/pg_rewind/RewindTest.pm +++ b/src/bin/pg_rewind/RewindTest.pm @@ -118,11 +118,14 @@ sub setup_cluster my $extra_name = shift; # Initialize master, data checksums are mandatory - $node_master = get_new_node('master' . ($extra_name ? "_${extra_name}" : '')); + $node_master = + get_new_node('master' . ($extra_name ? "_${extra_name}" : '')); $node_master->init(allows_streaming => 1); + # Set wal_keep_segments to prevent WAL segment recycling after enforced # checkpoints in the tests. - $node_master->append_conf('postgresql.conf', qq( + $node_master->append_conf( + 'postgresql.conf', qq( wal_keep_segments = 20 )); } @@ -139,7 +142,8 @@ sub create_standby { my $extra_name = shift; - $node_standby = get_new_node('standby' . ($extra_name ? "_${extra_name}" : '')); + $node_standby = + get_new_node('standby' . ($extra_name ? "_${extra_name}" : '')); $node_master->backup('my_backup'); $node_standby->init_from_backup($node_master, 'my_backup'); my $connstr_master = $node_master->connstr(); diff --git a/src/bin/pgbench/t/001_pgbench_with_server.pl b/src/bin/pgbench/t/001_pgbench_with_server.pl index e585220..e84693d 100644 --- a/src/bin/pgbench/t/001_pgbench_with_server.pl +++ b/src/bin/pgbench/t/001_pgbench_with_server.pl @@ -75,8 +75,10 @@ pgbench( # Initialize pgbench tables scale 1 pgbench( - '-i', 0, [qr{^$}], - [ qr{creating tables}, qr{vacuuming}, qr{creating primary keys}, qr{done\.} ], + '-i', 0, + [qr{^$}], + [ qr{creating tables}, qr{vacuuming}, + qr{creating primary keys}, qr{done\.} ], 'pgbench scale 1 initialization',); # Again, with all possible options @@ -94,8 +96,9 @@ pgbench( # Test interaction of --init-steps with legacy step-selection options pgbench( - '--initialize --init-steps=dtpvgvv --no-vacuum --foreign-keys --unlogged-tables', - 0, [qr{^$}], +'--initialize --init-steps=dtpvgvv --no-vacuum --foreign-keys --unlogged-tables', + 0, + [qr{^$}], [ qr{dropping old tables}, qr{creating tables}, qr{creating primary keys}, @@ -211,13 +214,13 @@ COMMIT; # test expressions pgbench( - '-t 1 -Dfoo=-10.1 -Dbla=false -Di=+3 -Dminint=-9223372036854775808 -Dn=null -Dt=t -Df=of -Dd=1.0', +'-t 1 -Dfoo=-10.1 -Dbla=false -Di=+3 -Dminint=-9223372036854775808 -Dn=null -Dt=t -Df=of -Dd=1.0', 0, [ qr{type: .*/001_pgbench_expressions}, qr{processed: 1/1} ], [ qr{command=1.: int 1\d\b}, - qr{command=2.: int 1\d\d\b}, - qr{command=3.: int 1\d\d\d\b}, - qr{command=4.: int 4\b}, + qr{command=2.: int 1\d\d\b}, + qr{command=3.: int 1\d\d\d\b}, + qr{command=4.: int 4\b}, qr{command=5.: int 5\b}, qr{command=6.: int 6\b}, qr{command=7.: int 7\b}, @@ -258,8 +261,7 @@ pgbench( qr{command=45.: boolean true\b}, qr{command=46.: int 46\b}, qr{command=47.: boolean true\b}, - qr{command=48.: boolean true\b}, - ], + qr{command=48.: boolean true\b}, ], 'pgbench expressions', { '001_pgbench_expressions' => q{-- integer functions \set i1 debug(random(10, 19)) @@ -448,52 +450,34 @@ SELECT LEAST(:i, :i, :i, :i, :i, :i, :i, :i, :i, :i, :i); 0, [qr{exponential parameter must be greater }], q{\set i random_exponential(0, 10, 0.0)} ], - [ 'set zipfian param to 1', + [ 'set zipfian param to 1', 0, [qr{zipfian parameter must be in range \(0, 1\) U \(1, \d+\]}], q{\set i random_zipfian(0, 10, 1)} ], - [ 'set zipfian param too large', + [ 'set zipfian param too large', 0, [qr{zipfian parameter must be in range \(0, 1\) U \(1, \d+\]}], q{\set i random_zipfian(0, 10, 1000000)} ], [ 'set non numeric value', 0, [qr{malformed variable "foo" value: "bla"}], q{\set i :foo + 1} ], - [ 'set no expression', + [ 'set no expression', 1, [qr{syntax error}], q{\set i} ], + [ 'set missing argument', 1, [qr{missing argument}i], q{\set} ], + [ 'set not a bool', 0, + [qr{cannot coerce double to boolean}], q{\set b NOT 0.0} ], + [ 'set not an int', 0, + [qr{cannot coerce boolean to int}], q{\set i TRUE + 2} ], + [ 'set not an double', 0, + [qr{cannot coerce boolean to double}], q{\set d ln(TRUE)} ], + [ 'set case error', 1, - [qr{syntax error}], - q{\set i} ], - [ 'set missing argument', - 1, - [qr{missing argument}i], - q{\set} ], - [ 'set not a bool', - 0, - [ qr{cannot coerce double to boolean} ], - q{\set b NOT 0.0} ], - [ 'set not an int', - 0, - [ qr{cannot coerce boolean to int} ], - q{\set i TRUE + 2} ], - [ 'set not an double', - 0, - [ qr{cannot coerce boolean to double} ], - q{\set d ln(TRUE)} ], - [ 'set case error', - 1, - [ qr{syntax error in command "set"} ], + [qr{syntax error in command "set"}], q{\set i CASE TRUE THEN 1 ELSE 0 END} ], - [ 'set random error', - 0, - [ qr{cannot coerce boolean to int} ], - q{\set b random(FALSE, TRUE)} ], - [ 'set number of args mismatch', - 1, - [ qr{unexpected number of arguments} ], - q{\set d ln(1.0, 2.0))} ], - [ 'set at least one arg', - 1, - [ qr{at least one argument expected} ], - q{\set i greatest())} ], + [ 'set random error', 0, + [qr{cannot coerce boolean to int}], q{\set b random(FALSE, TRUE)} ], + [ 'set number of args mismatch', 1, + [qr{unexpected number of arguments}], q{\set d ln(1.0, 2.0))} ], + [ 'set at least one arg', 1, + [qr{at least one argument expected}], q{\set i greatest())} ], # SETSHELL [ 'setshell not an int', 0, @@ -516,8 +500,8 @@ SELECT LEAST(:i, :i, :i, :i, :i, :i, :i, :i, :i, :i, :i); [ 'misc invalid backslash command', 1, [qr{invalid command .* "nosuchcommand"}], q{\nosuchcommand} ], [ 'misc empty script', 1, [qr{empty command list for script}], q{} ], - [ 'bad boolean', 0, [qr{malformed variable.*trueXXX}], q{\set b :badtrue or true} ], - ); + [ 'bad boolean', 0, + [qr{malformed variable.*trueXXX}], q{\set b :badtrue or true} ],); for my $e (@errors) @@ -526,7 +510,7 @@ for my $e (@errors) my $n = '001_pgbench_error_' . $name; $n =~ s/ /_/g; pgbench( - '-n -t 1 -Dfoo=bla -Dnull=null -Dtrue=true -Done=1 -Dzero=0.0 -Dbadtrue=trueXXX -M prepared', +'-n -t 1 -Dfoo=bla -Dnull=null -Dtrue=true -Done=1 -Dzero=0.0 -Dbadtrue=trueXXX -M prepared', $status, [ $status ? qr{^$} : qr{processed: 0/1} ], $re, @@ -538,7 +522,7 @@ for my $e (@errors) pgbench( '-t 1', 0, [ qr{processed: 1/1}, qr{zipfian cache array overflowed 1 time\(s\)} ], - [ qr{^} ], + [qr{^}], 'pgbench zipfian array overflow on random_zipfian', { '001_pgbench_random_zipfian' => q{ \set i random_zipfian(1, 100, 0.5) diff --git a/src/bin/pgbench/t/002_pgbench_no_server.pl b/src/bin/pgbench/t/002_pgbench_no_server.pl index 6ea55f8..cbc039d 100644 --- a/src/bin/pgbench/t/002_pgbench_no_server.pl +++ b/src/bin/pgbench/t/002_pgbench_no_server.pl @@ -73,11 +73,12 @@ my @options = ( [ 'ambiguous builtin', '-b s', [qr{ambiguous}] ], [ '--progress-timestamp => --progress', '--progress-timestamp', [qr{allowed only under}] ], - [ '-I without init option', '-I dtg', + [ '-I without init option', + '-I dtg', [qr{cannot be used in benchmarking mode}] ], - [ 'invalid init step', '-i -I dta', - [qr{unrecognized initialization step}, - qr{allowed steps are} ] ], + [ 'invalid init step', + '-i -I dta', + [ qr{unrecognized initialization step}, qr{allowed steps are} ] ], # loging sub-options [ 'sampling => log', '--sampling-rate=0.01', diff --git a/src/bin/scripts/t/080_pg_isready.pl b/src/bin/scripts/t/080_pg_isready.pl index d01804d..6da89e1 100644 --- a/src/bin/scripts/t/080_pg_isready.pl +++ b/src/bin/scripts/t/080_pg_isready.pl @@ -16,4 +16,5 @@ $node->init; $node->start; # use a long timeout for the benefit of very slow buildfarm machines -$node->command_ok([qw(pg_isready --timeout=60)], 'succeeds with server running'); +$node->command_ok([qw(pg_isready --timeout=60)], + 'succeeds with server running'); diff --git a/src/bin/scripts/t/100_vacuumdb.pl b/src/bin/scripts/t/100_vacuumdb.pl index 382210e..4c477a2 100644 --- a/src/bin/scripts/t/100_vacuumdb.pl +++ b/src/bin/scripts/t/100_vacuumdb.pl @@ -36,13 +36,17 @@ $node->issues_sql_like( $node->command_ok([qw(vacuumdb -Z --table=pg_am dbname=template1)], 'vacuumdb with connection string'); -$node->command_fails([qw(vacuumdb -Zt pg_am;ABORT postgres)], +$node->command_fails( + [qw(vacuumdb -Zt pg_am;ABORT postgres)], 'trailing command in "-t", without COLUMNS'); + # Unwanted; better if it failed. -$node->command_ok([qw(vacuumdb -Zt pg_am(amname);ABORT postgres)], +$node->command_ok( + [qw(vacuumdb -Zt pg_am(amname);ABORT postgres)], 'trailing command in "-t", with COLUMNS'); -$node->safe_psql('postgres', q| +$node->safe_psql( + 'postgres', q| CREATE TABLE "need""q(uot" (")x" text); CREATE FUNCTION f0(int) RETURNS int LANGUAGE SQL AS 'SELECT $1 * $1'; @@ -53,5 +57,6 @@ $node->safe_psql('postgres', q| |); $node->command_ok([qw|vacuumdb -Z --table="need""q(uot"(")x") postgres|], 'column list'); -$node->command_fails([qw|vacuumdb -Zt funcidx postgres|], +$node->command_fails( + [qw|vacuumdb -Zt funcidx postgres|], 'unqualifed name via functional index'); diff --git a/src/test/ldap/t/001_auth.pl b/src/test/ldap/t/001_auth.pl index a83d96a..7c46f67 100644 --- a/src/test/ldap/t/001_auth.pl +++ b/src/test/ldap/t/001_auth.pl @@ -6,22 +6,22 @@ use Test::More tests => 19; my ($slapd, $ldap_bin_dir, $ldap_schema_dir); -$ldap_bin_dir = undef; # usually in PATH +$ldap_bin_dir = undef; # usually in PATH if ($^O eq 'darwin') { - $slapd = '/usr/local/opt/openldap/libexec/slapd'; + $slapd = '/usr/local/opt/openldap/libexec/slapd'; $ldap_schema_dir = '/usr/local/etc/openldap/schema'; } elsif ($^O eq 'linux') { - $slapd = '/usr/sbin/slapd'; + $slapd = '/usr/sbin/slapd'; $ldap_schema_dir = '/etc/ldap/schema' if -d '/etc/ldap/schema'; $ldap_schema_dir = '/etc/openldap/schema' if -d '/etc/openldap/schema'; } elsif ($^O eq 'freebsd') { - $slapd = '/usr/local/libexec/slapd'; + $slapd = '/usr/local/libexec/slapd'; $ldap_schema_dir = '/usr/local/etc/openldap/schema'; } @@ -32,26 +32,27 @@ elsif ($^O eq 'freebsd') $ENV{PATH} = "$ldap_bin_dir:$ENV{PATH}" if $ldap_bin_dir; -my $ldap_datadir = "${TestLib::tmp_check}/openldap-data"; -my $slapd_certs = "${TestLib::tmp_check}/slapd-certs"; -my $slapd_conf = "${TestLib::tmp_check}/slapd.conf"; +my $ldap_datadir = "${TestLib::tmp_check}/openldap-data"; +my $slapd_certs = "${TestLib::tmp_check}/slapd-certs"; +my $slapd_conf = "${TestLib::tmp_check}/slapd.conf"; my $slapd_pidfile = "${TestLib::tmp_check}/slapd.pid"; my $slapd_logfile = "${TestLib::tmp_check}/slapd.log"; -my $ldap_conf = "${TestLib::tmp_check}/ldap.conf"; -my $ldap_server = 'localhost'; -my $ldap_port = int(rand() * 16384) + 49152; -my $ldaps_port = $ldap_port + 1; -my $ldap_url = "ldap://$ldap_server:$ldap_port"; -my $ldaps_url = "ldaps://$ldap_server:$ldaps_port"; -my $ldap_basedn = 'dc=example,dc=net'; -my $ldap_rootdn = 'cn=Manager,dc=example,dc=net'; -my $ldap_rootpw = 'secret'; -my $ldap_pwfile = "${TestLib::tmp_check}/ldappassword"; +my $ldap_conf = "${TestLib::tmp_check}/ldap.conf"; +my $ldap_server = 'localhost'; +my $ldap_port = int(rand() * 16384) + 49152; +my $ldaps_port = $ldap_port + 1; +my $ldap_url = "ldap://$ldap_server:$ldap_port"; +my $ldaps_url = "ldaps://$ldap_server:$ldaps_port"; +my $ldap_basedn = 'dc=example,dc=net'; +my $ldap_rootdn = 'cn=Manager,dc=example,dc=net'; +my $ldap_rootpw = 'secret'; +my $ldap_pwfile = "${TestLib::tmp_check}/ldappassword"; note "setting up slapd"; -append_to_file($slapd_conf, -qq{include $ldap_schema_dir/core.schema +append_to_file( + $slapd_conf, + qq{include $ldap_schema_dir/core.schema include $ldap_schema_dir/cosine.schema include $ldap_schema_dir/nis.schema include $ldap_schema_dir/inetorgperson.schema @@ -75,16 +76,23 @@ rootdn "$ldap_rootdn" rootpw $ldap_rootpw}); # don't bother to check the server's cert (though perhaps we should) -append_to_file($ldap_conf, -qq{TLS_REQCERT never +append_to_file( + $ldap_conf, + qq{TLS_REQCERT never }); mkdir $ldap_datadir or die; -mkdir $slapd_certs or die; - -system_or_bail "openssl", "req", "-new", "-nodes", "-keyout", "$slapd_certs/ca.key", "-x509", "-out", "$slapd_certs/ca.crt","-subj", "/cn=CA"; -system_or_bail "openssl", "req", "-new", "-nodes", "-keyout", "$slapd_certs/server.key", "-out", "$slapd_certs/server.csr","-subj", "/cn=server"; -system_or_bail "openssl", "x509", "-req", "-in", "$slapd_certs/server.csr", "-CA", "$slapd_certs/ca.crt", "-CAkey", "$slapd_certs/ca.key","-CAcreateserial", "-out", "$slapd_certs/server.crt"; +mkdir $slapd_certs or die; + +system_or_bail "openssl", "req", "-new", "-nodes", "-keyout", + "$slapd_certs/ca.key", "-x509", "-out", "$slapd_certs/ca.crt", "-subj", + "/cn=CA"; +system_or_bail "openssl", "req", "-new", "-nodes", "-keyout", + "$slapd_certs/server.key", "-out", "$slapd_certs/server.csr", "-subj", + "/cn=server"; +system_or_bail "openssl", "x509", "-req", "-in", "$slapd_certs/server.csr", + "-CA", "$slapd_certs/ca.crt", "-CAkey", "$slapd_certs/ca.key", + "-CAcreateserial", "-out", "$slapd_certs/server.crt"; system_or_bail $slapd, '-f', $slapd_conf, '-h', "$ldap_url $ldaps_url"; @@ -96,15 +104,17 @@ END append_to_file($ldap_pwfile, $ldap_rootpw); chmod 0600, $ldap_pwfile or die; -$ENV{'LDAPURI'} = $ldap_url; +$ENV{'LDAPURI'} = $ldap_url; $ENV{'LDAPBINDDN'} = $ldap_rootdn; -$ENV{'LDAPCONF'} = $ldap_conf; +$ENV{'LDAPCONF'} = $ldap_conf; note "loading LDAP data"; -system_or_bail 'ldapadd', '-x', '-y', $ldap_pwfile, '-f', 'authdata.ldif'; -system_or_bail 'ldappasswd', '-x', '-y', $ldap_pwfile, '-s', 'secret1', 'uid=test1,dc=example,dc=net'; -system_or_bail 'ldappasswd', '-x', '-y', $ldap_pwfile, '-s', 'secret2', 'uid=test2,dc=example,dc=net'; +system_or_bail 'ldapadd', '-x', '-y', $ldap_pwfile, '-f', 'authdata.ldif'; +system_or_bail 'ldappasswd', '-x', '-y', $ldap_pwfile, '-s', 'secret1', + 'uid=test1,dc=example,dc=net'; +system_or_bail 'ldappasswd', '-x', '-y', $ldap_pwfile, '-s', 'secret2', + 'uid=test2,dc=example,dc=net'; note "setting up PostgreSQL instance"; @@ -122,50 +132,66 @@ sub test_access { my ($node, $role, $expected_res, $test_name) = @_; - my $res = $node->psql('postgres', 'SELECT 1', extra_params => [ '-U', $role ]); - is($res, $expected_res, $test_name); + my $res = + $node->psql('postgres', 'SELECT 1', extra_params => [ '-U', $role ]); + is($res, $expected_res, $test_name); } note "simple bind"; unlink($node->data_dir . '/pg_hba.conf'); -$node->append_conf('pg_hba.conf', qq{local all all ldap ldapserver=$ldap_server ldapport=$ldap_port ldapprefix="uid=" ldapsuffix=",dc=example,dc=net"}); +$node->append_conf('pg_hba.conf', +qq{local all all ldap ldapserver=$ldap_server ldapport=$ldap_port ldapprefix="uid=" ldapsuffix=",dc=example,dc=net"} +); $node->restart; $ENV{"PGPASSWORD"} = 'wrong'; -test_access($node, 'test0', 2, 'simple bind authentication fails if user not found in LDAP'); -test_access($node, 'test1', 2, 'simple bind authentication fails with wrong password'); +test_access($node, 'test0', 2, + 'simple bind authentication fails if user not found in LDAP'); +test_access($node, 'test1', 2, + 'simple bind authentication fails with wrong password'); $ENV{"PGPASSWORD"} = 'secret1'; test_access($node, 'test1', 0, 'simple bind authentication succeeds'); note "search+bind"; unlink($node->data_dir . '/pg_hba.conf'); -$node->append_conf('pg_hba.conf', qq{local all all ldap ldapserver=$ldap_server ldapport=$ldap_port ldapbasedn="$ldap_basedn"}); +$node->append_conf('pg_hba.conf', +qq{local all all ldap ldapserver=$ldap_server ldapport=$ldap_port ldapbasedn="$ldap_basedn"} +); $node->restart; $ENV{"PGPASSWORD"} = 'wrong'; -test_access($node, 'test0', 2, 'search+bind authentication fails if user not found in LDAP'); -test_access($node, 'test1', 2, 'search+bind authentication fails with wrong password'); +test_access($node, 'test0', 2, + 'search+bind authentication fails if user not found in LDAP'); +test_access($node, 'test1', 2, + 'search+bind authentication fails with wrong password'); $ENV{"PGPASSWORD"} = 'secret1'; test_access($node, 'test1', 0, 'search+bind authentication succeeds'); note "LDAP URLs"; unlink($node->data_dir . '/pg_hba.conf'); -$node->append_conf('pg_hba.conf', qq{local all all ldap ldapurl="$ldap_url/$ldap_basedn?uid?sub"}); +$node->append_conf('pg_hba.conf', + qq{local all all ldap ldapurl="$ldap_url/$ldap_basedn?uid?sub"}); $node->restart; $ENV{"PGPASSWORD"} = 'wrong'; -test_access($node, 'test0', 2, 'search+bind with LDAP URL authentication fails if user not found in LDAP'); -test_access($node, 'test1', 2, 'search+bind with LDAP URL authentication fails with wrong password'); +test_access($node, 'test0', 2, + 'search+bind with LDAP URL authentication fails if user not found in LDAP' +); +test_access($node, 'test1', 2, + 'search+bind with LDAP URL authentication fails with wrong password'); $ENV{"PGPASSWORD"} = 'secret1'; -test_access($node, 'test1', 0, 'search+bind with LDAP URL authentication succeeds'); +test_access($node, 'test1', 0, + 'search+bind with LDAP URL authentication succeeds'); note "search filters"; unlink($node->data_dir . '/pg_hba.conf'); -$node->append_conf('pg_hba.conf', qq{local all all ldap ldapserver=$ldap_server ldapport=$ldap_port ldapbasedn="$ldap_basedn"ldapsearchfilter="(|(uid=\$username)(mail=\$username))"}); +$node->append_conf('pg_hba.conf', +qq{local all all ldap ldapserver=$ldap_server ldapport=$ldap_port ldapbasedn="$ldap_basedn" ldapsearchfilter="(|(uid=\$username)(mail=\$username))"} +); $node->restart; $ENV{"PGPASSWORD"} = 'secret1'; @@ -176,7 +202,9 @@ test_access($node, 'test2@example.net', 0, 'search filter finds by mail'); note "search filters in LDAP URLs"; unlink($node->data_dir . '/pg_hba.conf'); -$node->append_conf('pg_hba.conf', qq{local all all ldap ldapurl="$ldap_url/$ldap_basedn??sub?(|(uid=\$username)(mail=\$username))"}); +$node->append_conf('pg_hba.conf', +qq{local all all ldap ldapurl="$ldap_url/$ldap_basedn??sub?(|(uid=\$username)(mail=\$username))"} +); $node->restart; $ENV{"PGPASSWORD"} = 'secret1'; @@ -188,7 +216,9 @@ test_access($node, 'test2@example.net', 0, 'search filter finds by mail'); # settings. ldapurl is always parsed first, then the other settings # override. It might be useful in a case like this. unlink($node->data_dir . '/pg_hba.conf'); -$node->append_conf('pg_hba.conf', qq{local all all ldap ldapurl="$ldap_url/$ldap_basedn??sub" ldapsearchfilter="(|(uid=\$username)(mail=\$username))"}); +$node->append_conf('pg_hba.conf', +qq{local all all ldap ldapurl="$ldap_url/$ldap_basedn??sub" ldapsearchfilter="(|(uid=\$username)(mail=\$username))"} +); $node->restart; $ENV{"PGPASSWORD"} = 'secret1'; @@ -198,7 +228,9 @@ note "diagnostic message"; # note bad ldapprefix with a question mark that triggers a diagnostic message unlink($node->data_dir . '/pg_hba.conf'); -$node->append_conf('pg_hba.conf', qq{local all all ldap ldapserver=$ldap_server ldapport=$ldap_port ldapprefix="?uid=" ldapsuffix=""}); +$node->append_conf('pg_hba.conf', +qq{local all all ldap ldapserver=$ldap_server ldapport=$ldap_port ldapprefix="?uid=" ldapsuffix=""} +); $node->restart; $ENV{"PGPASSWORD"} = 'secret1'; @@ -208,7 +240,9 @@ note "TLS"; # request StartTLS with ldaptls=1 unlink($node->data_dir . '/pg_hba.conf'); -$node->append_conf('pg_hba.conf', qq{local all all ldap ldapserver=$ldap_server ldapport=$ldap_port ldapbasedn="$ldap_basedn"ldapsearchfilter="(uid=\$username)" ldaptls=1}); +$node->append_conf('pg_hba.conf', +qq{local all all ldap ldapserver=$ldap_server ldapport=$ldap_port ldapbasedn="$ldap_basedn" ldapsearchfilter="(uid=\$username)"ldaptls=1} +); $node->restart; $ENV{"PGPASSWORD"} = 'secret1'; @@ -216,7 +250,9 @@ test_access($node, 'test1', 0, 'StartTLS'); # request LDAPS with ldapscheme=ldaps unlink($node->data_dir . '/pg_hba.conf'); -$node->append_conf('pg_hba.conf', qq{local all all ldap ldapserver=$ldap_server ldapscheme=ldaps ldapport=$ldaps_port ldapbasedn="$ldap_basedn"ldapsearchfilter="(uid=\$username)"}); +$node->append_conf('pg_hba.conf', +qq{local all all ldap ldapserver=$ldap_server ldapscheme=ldaps ldapport=$ldaps_port ldapbasedn="$ldap_basedn" ldapsearchfilter="(uid=\$username)"} +); $node->restart; $ENV{"PGPASSWORD"} = 'secret1'; @@ -224,7 +260,9 @@ test_access($node, 'test1', 0, 'LDAPS'); # request LDAPS with ldapurl=ldaps://... unlink($node->data_dir . '/pg_hba.conf'); -$node->append_conf('pg_hba.conf', qq{local all all ldap ldapurl="$ldaps_url/$ldap_basedn??sub?(uid=\$username)"}); +$node->append_conf('pg_hba.conf', +qq{local all all ldap ldapurl="$ldaps_url/$ldap_basedn??sub?(uid=\$username)"} +); $node->restart; $ENV{"PGPASSWORD"} = 'secret1'; @@ -232,7 +270,9 @@ test_access($node, 'test1', 0, 'LDAPS with URL'); # bad combination of LDAPS and StartTLS unlink($node->data_dir . '/pg_hba.conf'); -$node->append_conf('pg_hba.conf', qq{local all all ldap ldapurl="$ldaps_url/$ldap_basedn??sub?(uid=\$username)" ldaptls=1}); +$node->append_conf('pg_hba.conf', +qq{local all all ldap ldapurl="$ldaps_url/$ldap_basedn??sub?(uid=\$username)" ldaptls=1} +); $node->restart; $ENV{"PGPASSWORD"} = 'secret1'; diff --git a/src/test/modules/brin/t/01_workitems.pl b/src/test/modules/brin/t/01_workitems.pl index 11c9981..c889a83 100644 --- a/src/test/modules/brin/t/01_workitems.pl +++ b/src/test/modules/brin/t/01_workitems.pl @@ -15,25 +15,27 @@ $node->start; $node->safe_psql('postgres', 'create extension pageinspect'); # Create a table with an autosummarizing BRIN index -$node->safe_psql('postgres', +$node->safe_psql( + 'postgres', 'create table brin_wi (a int) with (fillfactor = 10); create index brin_wi_idx on brin_wi using brin (a) with (pages_per_range=1, autosummarize=on); ' ); my $count = $node->safe_psql('postgres', - "select count(*) from brin_page_items(get_raw_page('brin_wi_idx', 2), 'brin_wi_idx'::regclass)" +"select count(*) from brin_page_items(get_raw_page('brin_wi_idx', 2), 'brin_wi_idx'::regclass)" ); is($count, '1', "initial index state is correct"); $node->safe_psql('postgres', 'insert into brin_wi select * from generate_series(1, 100)'); -$node->poll_query_until('postgres', - "select count(*) > 1 from brin_page_items(get_raw_page('brin_wi_idx', 2), 'brin_wi_idx'::regclass)", +$node->poll_query_until( + 'postgres', +"select count(*) > 1 from brin_page_items(get_raw_page('brin_wi_idx', 2), 'brin_wi_idx'::regclass)", 't'); $count = $node->safe_psql('postgres', - "select count(*) > 1 from brin_page_items(get_raw_page('brin_wi_idx', 2), 'brin_wi_idx'::regclass)" +"select count(*) > 1 from brin_page_items(get_raw_page('brin_wi_idx', 2), 'brin_wi_idx'::regclass)" ); is($count, 't', "index got summarized"); $node->stop; diff --git a/src/test/perl/PostgresNode.pm b/src/test/perl/PostgresNode.pm index 8018831..b7c5157 100644 --- a/src/test/perl/PostgresNode.pm +++ b/src/test/perl/PostgresNode.pm @@ -1507,7 +1507,7 @@ sub wait_for_catchup } else { - $lsn_expr = 'pg_current_wal_lsn()' + $lsn_expr = 'pg_current_wal_lsn()'; } print "Waiting for replication conn " . $standby_name . "'s " diff --git a/src/test/perl/TestLib.pm b/src/test/perl/TestLib.pm index fdd4276..5ca43e9 100644 --- a/src/test/perl/TestLib.pm +++ b/src/test/perl/TestLib.pm @@ -235,7 +235,7 @@ sub check_pg_config chomp($stdout); open my $pg_config_h, '<', "$stdout/pg_config.h" or die "$!"; - my $match = (grep {/^$regexp/} <$pg_config_h>); + my $match = (grep { /^$regexp/ } <$pg_config_h>); close $pg_config_h; return $match; } diff --git a/src/test/recovery/t/006_logical_decoding.pl b/src/test/recovery/t/006_logical_decoding.pl index 8b35bc8..7e1759f 100644 --- a/src/test/recovery/t/006_logical_decoding.pl +++ b/src/test/recovery/t/006_logical_decoding.pl @@ -80,8 +80,7 @@ is($stdout_recv, $expected, $node_master->poll_query_until('postgres', "SELECT EXISTS (SELECT 1 FROM pg_replication_slots WHERE slot_name = 'test_slot' AND active_pid IS NULL)" -) - or die "slot never became inactive"; +) or die "slot never became inactive"; $stdout_recv = $node_master->pg_recvlogical_upto( 'postgres', 'test_slot', $endpos, 10, diff --git a/src/test/recovery/t/009_twophase.pl b/src/test/recovery/t/009_twophase.pl index 95f22bc..93c22d1 100644 --- a/src/test/recovery/t/009_twophase.pl +++ b/src/test/recovery/t/009_twophase.pl @@ -333,9 +333,9 @@ $cur_master->psql( # Ensure that last transaction is replayed on standby. my $cur_master_lsn = - $cur_master->safe_psql('postgres', "SELECT pg_current_wal_lsn()"); + $cur_master->safe_psql('postgres', "SELECT pg_current_wal_lsn()"); my $caughtup_query = - "SELECT '$cur_master_lsn'::pg_lsn <= pg_last_wal_replay_lsn()"; + "SELECT '$cur_master_lsn'::pg_lsn <= pg_last_wal_replay_lsn()"; $cur_standby->poll_query_until('postgres', $caughtup_query) or die "Timed out while waiting for standby to catch up"; diff --git a/src/test/recovery/t/013_crash_restart.pl b/src/test/recovery/t/013_crash_restart.pl index 91a8ef9..783c936 100644 --- a/src/test/recovery/t/013_crash_restart.pl +++ b/src/test/recovery/t/013_crash_restart.pl @@ -30,8 +30,9 @@ $node->init(allows_streaming => 1); $node->start(); # by default PostgresNode doesn't doesn't restart after a crash -$node->safe_psql('postgres', - q[ALTER SYSTEM SET restart_after_crash = 1; +$node->safe_psql( + 'postgres', + q[ALTER SYSTEM SET restart_after_crash = 1; ALTER SYSTEM SET log_connections = 1; SELECT pg_reload_conf();]); @@ -68,7 +69,7 @@ INSERT INTO alive VALUES($$committed-before-sigquit$$); SELECT pg_backend_pid(); ]; ok(pump_until($killme, \$killme_stdout, qr/[[:digit:]]+[\r\n]$/m), - 'acquired pid for SIGQUIT'); + 'acquired pid for SIGQUIT'); my $pid = $killme_stdout; chomp($pid); $killme_stdout = ''; @@ -80,7 +81,7 @@ BEGIN; INSERT INTO alive VALUES($$in-progress-before-sigquit$$) RETURNING status; ]; ok(pump_until($killme, \$killme_stdout, qr/in-progress-before-sigquit/m), - 'inserted in-progress-before-sigquit'); + 'inserted in-progress-before-sigquit'); $killme_stdout = ''; $killme_stderr = ''; @@ -93,7 +94,7 @@ SELECT $$psql-connected$$; SELECT pg_sleep(3600); ]; ok(pump_until($monitor, \$monitor_stdout, qr/psql-connected/m), - 'monitor connected'); + 'monitor connected'); $monitor_stdout = ''; $monitor_stderr = ''; @@ -107,8 +108,12 @@ is($ret, 0, "killed process with SIGQUIT"); $killme_stdin .= q[ SELECT 1; ]; -ok(pump_until($killme, \$killme_stderr, qr/WARNING: terminating connection because of crash of another server process|serverclosed the connection unexpectedly/m), - "psql query died successfully after SIGQUIT"); +ok( pump_until( + $killme, + \$killme_stderr, +qr/WARNING: terminating connection because of crash of another server process|server closed the connection unexpectedly/m + ), + "psql query died successfully after SIGQUIT"); $killme_stderr = ''; $killme_stdout = ''; $killme->finish; @@ -116,13 +121,21 @@ $killme->finish; # Wait till server restarts - we should get the WARNING here, but # sometimes the server is unable to send that, if interrupted while # sending. -ok(pump_until($monitor, \$monitor_stderr, qr/WARNING: terminating connection because of crash of another server process|serverclosed the connection unexpectedly/m), - "psql monitor died successfully after SIGQUIT"); +ok( pump_until( + $monitor, + \$monitor_stderr, +qr/WARNING: terminating connection because of crash of another server process|server closed the connection unexpectedly/m + ), + "psql monitor died successfully after SIGQUIT"); $monitor->finish; # Wait till server restarts -is($node->poll_query_until('postgres', 'SELECT $$restarted after sigquit$$;', 'restarted after sigquit'), - "1", "reconnected after SIGQUIT"); +is( $node->poll_query_until( + 'postgres', + 'SELECT $$restarted after sigquit$$;', + 'restarted after sigquit'), + "1", + "reconnected after SIGQUIT"); # restart psql processes, now that the crash cycle finished @@ -137,10 +150,10 @@ $killme_stdin .= q[ SELECT pg_backend_pid(); ]; ok(pump_until($killme, \$killme_stdout, qr/[[:digit:]]+[\r\n]$/m), - "acquired pid for SIGKILL"); + "acquired pid for SIGKILL"); $pid = $killme_stdout; chomp($pid); -$pid = $killme_stdout; +$pid = $killme_stdout; $killme_stdout = ''; $killme_stderr = ''; @@ -151,7 +164,7 @@ BEGIN; INSERT INTO alive VALUES($$in-progress-before-sigkill$$) RETURNING status; ]; ok(pump_until($killme, \$killme_stdout, qr/in-progress-before-sigkill/m), - 'inserted in-progress-before-sigkill'); + 'inserted in-progress-before-sigkill'); $killme_stdout = ''; $killme_stderr = ''; @@ -164,7 +177,7 @@ SELECT $$psql-connected$$; SELECT pg_sleep(3600); ]; ok(pump_until($monitor, \$monitor_stdout, qr/psql-connected/m), - 'monitor connected'); + 'monitor connected'); $monitor_stdout = ''; $monitor_stderr = ''; @@ -179,35 +192,51 @@ is($ret, 0, "killed process with KILL"); $killme_stdin .= q[ SELECT 1; ]; -ok(pump_until($killme, \$killme_stderr, qr/server closed the connection unexpectedly/m), - "psql query died successfully after SIGKILL"); +ok( pump_until( + $killme, \$killme_stderr, + qr/server closed the connection unexpectedly/m), + "psql query died successfully after SIGKILL"); $killme->finish; # Wait till server restarts - we should get the WARNING here, but # sometimes the server is unable to send that, if interrupted while # sending. -ok(pump_until($monitor, \$monitor_stderr, qr/WARNING: terminating connection because of crash of another server process|serverclosed the connection unexpectedly/m), - "psql monitor died successfully after SIGKILL"); +ok( pump_until( + $monitor, + \$monitor_stderr, +qr/WARNING: terminating connection because of crash of another server process|server closed the connection unexpectedly/m + ), + "psql monitor died successfully after SIGKILL"); $monitor->finish; # Wait till server restarts -is($node->poll_query_until('postgres', 'SELECT 1', '1'), "1", "reconnected after SIGKILL"); +is($node->poll_query_until('postgres', 'SELECT 1', '1'), + "1", "reconnected after SIGKILL"); # Make sure the committed rows survived, in-progress ones not -is($node->safe_psql('postgres', 'SELECT * FROM alive'), - "committed-before-sigquit\ncommitted-before-sigkill", 'data survived'); +is( $node->safe_psql('postgres', 'SELECT * FROM alive'), + "committed-before-sigquit\ncommitted-before-sigkill", + 'data survived'); -is($node->safe_psql('postgres', 'INSERT INTO alive VALUES($$before-orderly-restart$$) RETURNING status'), - 'before-orderly-restart', 'can still write after crash restart'); +is( $node->safe_psql( + 'postgres', +'INSERT INTO alive VALUES($$before-orderly-restart$$) RETURNING status'), + 'before-orderly-restart', + 'can still write after crash restart'); # Just to be sure, check that an orderly restart now still works $node->restart(); -is($node->safe_psql('postgres', 'SELECT * FROM alive'), - "committed-before-sigquit\ncommitted-before-sigkill\nbefore-orderly-restart", 'data survived'); +is( $node->safe_psql('postgres', 'SELECT * FROM alive'), +"committed-before-sigquit\ncommitted-before-sigkill\nbefore-orderly-restart", + 'data survived'); -is($node->safe_psql('postgres', 'INSERT INTO alive VALUES($$after-orderly-restart$$) RETURNING status'), - 'after-orderly-restart', 'can still write after orderly restart'); +is( $node->safe_psql( + 'postgres', + 'INSERT INTO alive VALUES($$after-orderly-restart$$) RETURNING status' + ), + 'after-orderly-restart', + 'can still write after orderly restart'); $node->stop(); @@ -221,7 +250,7 @@ sub pump_until if ($psql_timeout->is_expired) { diag("aborting wait: program timed out"); - diag("stream contents: >>", $$stream,"<<"); + diag("stream contents: >>", $$stream, "<<"); diag("pattern searched for: ", $untl); return 0; @@ -229,7 +258,7 @@ sub pump_until if (not $proc->pumpable()) { diag("aborting wait: program died"); - diag("stream contents: >>", $$stream,"<<"); + diag("stream contents: >>", $$stream, "<<"); diag("pattern searched for: ", $untl); return 0; @@ -239,4 +268,4 @@ sub pump_until } return 1; -}; +} diff --git a/src/test/ssl/ServerSetup.pm b/src/test/ssl/ServerSetup.pm index 27a676b..68422ba 100644 --- a/src/test/ssl/ServerSetup.pm +++ b/src/test/ssl/ServerSetup.pm @@ -41,7 +41,8 @@ sub test_connect_ok my ($common_connstr, $connstr, $test_name) = @_; my $cmd = [ - 'psql', '-X', '-A', '-t', '-c', "SELECT \$\$connected with $connstr\$\$", + 'psql', '-X', '-A', '-t', '-c', + "SELECT \$\$connected with $connstr\$\$", '-d', "$common_connstr $connstr" ]; command_ok($cmd, $test_name); @@ -52,7 +53,8 @@ sub test_connect_fails my ($common_connstr, $connstr, $expected_stderr, $test_name) = @_; my $cmd = [ - 'psql', '-X', '-A', '-t', '-c', "SELECT \$\$connected with $connstr\$\$", + 'psql', '-X', '-A', '-t', '-c', + "SELECT \$\$connected with $connstr\$\$", '-d', "$common_connstr $connstr" ]; command_fails_like($cmd, $expected_stderr, $test_name); @@ -89,9 +91,11 @@ sub configure_test_server_for_ssl if (defined($password)) { $node->psql('postgres', -"SET password_encryption='$password_enc'; ALTER USER ssltestuser PASSWORD '$password';"); +"SET password_encryption='$password_enc'; ALTER USER ssltestuser PASSWORD '$password';" + ); $node->psql('postgres', -"SET password_encryption='$password_enc'; ALTER USER anotheruser PASSWORD '$password';"); +"SET password_encryption='$password_enc'; ALTER USER anotheruser PASSWORD '$password';" + ); } # enable logging etc. @@ -149,7 +153,7 @@ sub switch_server_cert sub configure_hba_for_ssl { my ($node, $serverhost, $authmethod) = @_; - my $pgdata = $node->data_dir; + my $pgdata = $node->data_dir; # Only accept SSL connections from localhost. Our tests don't depend on this # but seems best to keep it as narrow as possible for security reasons. diff --git a/src/test/ssl/t/001_ssltests.pl b/src/test/ssl/t/001_ssltests.pl index 4b097a6..2a99ff0 100644 --- a/src/test/ssl/t/001_ssltests.pl +++ b/src/test/ssl/t/001_ssltests.pl @@ -55,93 +55,110 @@ $common_connstr = "user=ssltestuser dbname=trustdb sslcert=invalid hostaddr=$SERVERHOSTADDR host=common-name.pg-ssltest.test"; # The server should not accept non-SSL connections. -test_connect_fails($common_connstr, "sslmode=disable", - qr/\Qno pg_hba.conf entry\E/, - "server doesn't accept non-SSL connections"); +test_connect_fails( + $common_connstr, "sslmode=disable", + qr/\Qno pg_hba.conf entry\E/, + "server doesn't accept non-SSL connections"); # Try without a root cert. In sslmode=require, this should work. In verify-ca # or verify-full mode it should fail. -test_connect_ok($common_connstr, "sslrootcert=invalid sslmode=require", - "connect without server root cert sslmode=require"); -test_connect_fails($common_connstr, "sslrootcert=invalid sslmode=verify-ca", - qr/root certificate file "invalid" does not exist/, - "connect without server root cert sslmode=verify-ca"); -test_connect_fails($common_connstr, "sslrootcert=invalid sslmode=verify-full", - qr/root certificate file "invalid" does not exist/, - "connect without server root cert sslmode=verify-full"); +test_connect_ok( + $common_connstr, + "sslrootcert=invalid sslmode=require", + "connect without server root cert sslmode=require"); +test_connect_fails( + $common_connstr, + "sslrootcert=invalid sslmode=verify-ca", + qr/root certificate file "invalid" does not exist/, + "connect without server root cert sslmode=verify-ca"); +test_connect_fails( + $common_connstr, + "sslrootcert=invalid sslmode=verify-full", + qr/root certificate file "invalid" does not exist/, + "connect without server root cert sslmode=verify-full"); # Try with wrong root cert, should fail. (We're using the client CA as the # root, but the server's key is signed by the server CA.) test_connect_fails($common_connstr, - "sslrootcert=ssl/client_ca.crt sslmode=require", - qr/SSL error/, - "connect with wrong server root cert sslmode=require"); + "sslrootcert=ssl/client_ca.crt sslmode=require", + qr/SSL error/, "connect with wrong server root cert sslmode=require"); test_connect_fails($common_connstr, - "sslrootcert=ssl/client_ca.crt sslmode=verify-ca", - qr/SSL error/, - "connect with wrong server root cert sslmode=verify-ca"); + "sslrootcert=ssl/client_ca.crt sslmode=verify-ca", + qr/SSL error/, "connect with wrong server root cert sslmode=verify-ca"); test_connect_fails($common_connstr, - "sslrootcert=ssl/client_ca.crt sslmode=verify-full", - qr/SSL error/, - "connect with wrong server root cert sslmode=verify-full"); + "sslrootcert=ssl/client_ca.crt sslmode=verify-full", + qr/SSL error/, "connect with wrong server root cert sslmode=verify-full"); # Try with just the server CA's cert. This fails because the root file # must contain the whole chain up to the root CA. test_connect_fails($common_connstr, - "sslrootcert=ssl/server_ca.crt sslmode=verify-ca", - qr/SSL error/, - "connect with server CA cert, without root CA"); + "sslrootcert=ssl/server_ca.crt sslmode=verify-ca", + qr/SSL error/, "connect with server CA cert, without root CA"); # And finally, with the correct root cert. -test_connect_ok($common_connstr, - "sslrootcert=ssl/root+server_ca.crt sslmode=require", - "connect with correct server CA cert file sslmode=require"); -test_connect_ok($common_connstr, - "sslrootcert=ssl/root+server_ca.crt sslmode=verify-ca", - "connect with correct server CA cert file sslmode=verify-ca"); -test_connect_ok($common_connstr, - "sslrootcert=ssl/root+server_ca.crt sslmode=verify-full", - "connect with correct server CA cert file sslmode=verify-full"); +test_connect_ok( + $common_connstr, + "sslrootcert=ssl/root+server_ca.crt sslmode=require", + "connect with correct server CA cert file sslmode=require"); +test_connect_ok( + $common_connstr, + "sslrootcert=ssl/root+server_ca.crt sslmode=verify-ca", + "connect with correct server CA cert file sslmode=verify-ca"); +test_connect_ok( + $common_connstr, + "sslrootcert=ssl/root+server_ca.crt sslmode=verify-full", + "connect with correct server CA cert file sslmode=verify-full"); # Test with cert root file that contains two certificates. The client should # be able to pick the right one, regardless of the order in the file. -test_connect_ok($common_connstr, - "sslrootcert=ssl/both-cas-1.crt sslmode=verify-ca", - "cert root file that contains two certificates, order 1"); -test_connect_ok($common_connstr, - "sslrootcert=ssl/both-cas-2.crt sslmode=verify-ca", - "cert root file that contains two certificates, order 2"); +test_connect_ok( + $common_connstr, + "sslrootcert=ssl/both-cas-1.crt sslmode=verify-ca", + "cert root file that contains two certificates, order 1"); +test_connect_ok( + $common_connstr, + "sslrootcert=ssl/both-cas-2.crt sslmode=verify-ca", + "cert root file that contains two certificates, order 2"); # CRL tests # Invalid CRL filename is the same as no CRL, succeeds -test_connect_ok($common_connstr, - "sslrootcert=ssl/root+server_ca.crt sslmode=verify-ca sslcrl=invalid", - "sslcrl option with invalid file name"); +test_connect_ok( + $common_connstr, + "sslrootcert=ssl/root+server_ca.crt sslmode=verify-ca sslcrl=invalid", + "sslcrl option with invalid file name"); # A CRL belonging to a different CA is not accepted, fails -test_connect_fails($common_connstr, - "sslrootcert=ssl/root+server_ca.crt sslmode=verify-ca sslcrl=ssl/client.crl", - qr/SSL error/, - "CRL belonging to a different CA"); +test_connect_fails( + $common_connstr, +"sslrootcert=ssl/root+server_ca.crt sslmode=verify-ca sslcrl=ssl/client.crl", + qr/SSL error/, + "CRL belonging to a different CA"); # With the correct CRL, succeeds (this cert is not revoked) -test_connect_ok($common_connstr, - "sslrootcert=ssl/root+server_ca.crt sslmode=verify-ca sslcrl=ssl/root+server.crl", - "CRL with a non-revoked cert"); +test_connect_ok( + $common_connstr, +"sslrootcert=ssl/root+server_ca.crt sslmode=verify-ca sslcrl=ssl/root+server.crl", + "CRL with a non-revoked cert"); # Check that connecting with verify-full fails, when the hostname doesn't # match the hostname in the server's certificate. $common_connstr = "user=ssltestuser dbname=trustdb sslcert=invalid sslrootcert=ssl/root+server_ca.crt hostaddr=$SERVERHOSTADDR"; -test_connect_ok($common_connstr, "sslmode=require host=wronghost.test", - "mismatch between host name and server certificate sslmode=require"); -test_connect_ok($common_connstr, "sslmode=verify-ca host=wronghost.test", - "mismatch between host name and server certificate sslmode=verify-ca"); -test_connect_fails($common_connstr, "sslmode=verify-full host=wronghost.test", - qr/\Qserver certificate for "common-name.pg-ssltest.test" does not match host name "wronghost.test"\E/, - "mismatch between host name and server certificate sslmode=verify-full"); +test_connect_ok( + $common_connstr, + "sslmode=require host=wronghost.test", + "mismatch between host name and server certificate sslmode=require"); +test_connect_ok( + $common_connstr, + "sslmode=verify-ca host=wronghost.test", + "mismatch between host name and server certificate sslmode=verify-ca"); +test_connect_fails( + $common_connstr, + "sslmode=verify-full host=wronghost.test", +qr/\Qserver certificate for "common-name.pg-ssltest.test" does not match host name "wronghost.test"\E/, + "mismatch between host name and server certificate sslmode=verify-full"); # Test Subject Alternative Names. switch_server_cert($node, 'server-multiple-alt-names'); @@ -149,20 +166,29 @@ switch_server_cert($node, 'server-multiple-alt-names'); $common_connstr = "user=ssltestuser dbname=trustdb sslcert=invalid sslrootcert=ssl/root+server_ca.crt hostaddr=$SERVERHOSTADDR sslmode=verify-full"; -test_connect_ok($common_connstr, "host=dns1.alt-name.pg-ssltest.test", - "host name matching with X.509 Subject Alternative Names 1"); -test_connect_ok($common_connstr, "host=dns2.alt-name.pg-ssltest.test", - "host name matching with X.509 Subject Alternative Names 2"); -test_connect_ok($common_connstr, "host=foo.wildcard.pg-ssltest.test", - "host name matching with X.509 Subject Alternative Names wildcard"); - -test_connect_fails($common_connstr, "host=wronghost.alt-name.pg-ssltest.test", - qr/\Qserver certificate for "dns1.alt-name.pg-ssltest.test" (and 2 other names) does not match host name"wronghost.alt-name.pg-ssltest.test"\E/, - "host name not matching with X.509 Subject Alternative Names"); -test_connect_fails($common_connstr, - "host=deep.subdomain.wildcard.pg-ssltest.test", - qr/\Qserver certificate for "dns1.alt-name.pg-ssltest.test" (and 2 other names) does not match host name"deep.subdomain.wildcard.pg-ssltest.test"\E/, - "host name not matching with X.509 Subject Alternative Names wildcard"); +test_connect_ok( + $common_connstr, + "host=dns1.alt-name.pg-ssltest.test", + "host name matching with X.509 Subject Alternative Names 1"); +test_connect_ok( + $common_connstr, + "host=dns2.alt-name.pg-ssltest.test", + "host name matching with X.509 Subject Alternative Names 2"); +test_connect_ok( + $common_connstr, + "host=foo.wildcard.pg-ssltest.test", + "host name matching with X.509 Subject Alternative Names wildcard"); + +test_connect_fails( + $common_connstr, + "host=wronghost.alt-name.pg-ssltest.test", +qr/\Qserver certificate for "dns1.alt-name.pg-ssltest.test" (and 2 other names) does not match host name "wronghost.alt-name.pg-ssltest.test"\E/, + "host name not matching with X.509 Subject Alternative Names"); +test_connect_fails( + $common_connstr, + "host=deep.subdomain.wildcard.pg-ssltest.test", +qr/\Qserver certificate for "dns1.alt-name.pg-ssltest.test" (and 2 other names) does not match host name "deep.subdomain.wildcard.pg-ssltest.test"\E/, + "host name not matching with X.509 Subject Alternative Names wildcard"); # Test certificate with a single Subject Alternative Name. (this gives a # slightly different error message, that's all) @@ -171,16 +197,22 @@ switch_server_cert($node, 'server-single-alt-name'); $common_connstr = "user=ssltestuser dbname=trustdb sslcert=invalid sslrootcert=ssl/root+server_ca.crt hostaddr=$SERVERHOSTADDR sslmode=verify-full"; -test_connect_ok($common_connstr, "host=single.alt-name.pg-ssltest.test", - "host name matching with a single X.509 Subject Alternative Name"); - -test_connect_fails($common_connstr, "host=wronghost.alt-name.pg-ssltest.test", - qr/\Qserver certificate for "single.alt-name.pg-ssltest.test" does not match host name "wronghost.alt-name.pg-ssltest.test"\E/, - "host name not matching with a single X.509 Subject Alternative Name"); -test_connect_fails($common_connstr, - "host=deep.subdomain.wildcard.pg-ssltest.test", - qr/\Qserver certificate for "single.alt-name.pg-ssltest.test" does not match host name "deep.subdomain.wildcard.pg-ssltest.test"\E/, - "host name not matching with a single X.509 Subject Alternative Name wildcard"); +test_connect_ok( + $common_connstr, + "host=single.alt-name.pg-ssltest.test", + "host name matching with a single X.509 Subject Alternative Name"); + +test_connect_fails( + $common_connstr, + "host=wronghost.alt-name.pg-ssltest.test", +qr/\Qserver certificate for "single.alt-name.pg-ssltest.test" does not match host name "wronghost.alt-name.pg-ssltest.test"\E/, + "host name not matching with a single X.509 Subject Alternative Name"); +test_connect_fails( + $common_connstr, + "host=deep.subdomain.wildcard.pg-ssltest.test", +qr/\Qserver certificate for "single.alt-name.pg-ssltest.test" does not match host name "deep.subdomain.wildcard.pg-ssltest.test"\E/, +"host name not matching with a single X.509 Subject Alternative Name wildcard" +); # Test server certificate with a CN and SANs. Per RFCs 2818 and 6125, the CN # should be ignored when the certificate has both. @@ -189,13 +221,19 @@ switch_server_cert($node, 'server-cn-and-alt-names'); $common_connstr = "user=ssltestuser dbname=trustdb sslcert=invalid sslrootcert=ssl/root+server_ca.crt hostaddr=$SERVERHOSTADDR sslmode=verify-full"; -test_connect_ok($common_connstr, "host=dns1.alt-name.pg-ssltest.test", - "certificate with both a CN and SANs 1"); -test_connect_ok($common_connstr, "host=dns2.alt-name.pg-ssltest.test", - "certificate with both a CN and SANs 2"); -test_connect_fails($common_connstr, "host=common-name.pg-ssltest.test", - qr/\Qserver certificate for "dns1.alt-name.pg-ssltest.test" (and 1 other name) does not match host name"common-name.pg-ssltest.test"\E/, - "certificate with both a CN and SANs ignores CN"); +test_connect_ok( + $common_connstr, + "host=dns1.alt-name.pg-ssltest.test", + "certificate with both a CN and SANs 1"); +test_connect_ok( + $common_connstr, + "host=dns2.alt-name.pg-ssltest.test", + "certificate with both a CN and SANs 2"); +test_connect_fails( + $common_connstr, + "host=common-name.pg-ssltest.test", +qr/\Qserver certificate for "dns1.alt-name.pg-ssltest.test" (and 1 other name) does not match host name "common-name.pg-ssltest.test"\E/, + "certificate with both a CN and SANs ignores CN"); # Finally, test a server certificate that has no CN or SANs. Of course, that's # not a very sensible certificate, but libpq should handle it gracefully. @@ -203,13 +241,15 @@ switch_server_cert($node, 'server-no-names'); $common_connstr = "user=ssltestuser dbname=trustdb sslcert=invalid sslrootcert=ssl/root+server_ca.crt hostaddr=$SERVERHOSTADDR"; -test_connect_ok($common_connstr, - "sslmode=verify-ca host=common-name.pg-ssltest.test", - "server certificate without CN or SANs sslmode=verify-ca"); -test_connect_fails($common_connstr, - "sslmode=verify-full host=common-name.pg-ssltest.test", - qr/could not get server's host name from server certificate/, - "server certificate without CN or SANs sslmode=verify-full"); +test_connect_ok( + $common_connstr, + "sslmode=verify-ca host=common-name.pg-ssltest.test", + "server certificate without CN or SANs sslmode=verify-ca"); +test_connect_fails( + $common_connstr, + "sslmode=verify-full host=common-name.pg-ssltest.test", + qr/could not get server's host name from server certificate/, + "server certificate without CN or SANs sslmode=verify-full"); # Test that the CRL works switch_server_cert($node, 'server-revoked'); @@ -218,13 +258,15 @@ $common_connstr = "user=ssltestuser dbname=trustdb sslcert=invalid hostaddr=$SERVERHOSTADDR host=common-name.pg-ssltest.test"; # Without the CRL, succeeds. With it, fails. -test_connect_ok($common_connstr, - "sslrootcert=ssl/root+server_ca.crt sslmode=verify-ca", - "connects without client-side CRL"); -test_connect_fails($common_connstr, - "sslrootcert=ssl/root+server_ca.crt sslmode=verify-ca sslcrl=ssl/root+server.crl", - qr/SSL error/, - "does not connect with client-side CRL"); +test_connect_ok( + $common_connstr, + "sslrootcert=ssl/root+server_ca.crt sslmode=verify-ca", + "connects without client-side CRL"); +test_connect_fails( + $common_connstr, +"sslrootcert=ssl/root+server_ca.crt sslmode=verify-ca sslcrl=ssl/root+server.crl", + qr/SSL error/, + "does not connect with client-side CRL"); ### Part 2. Server-side tests. ### @@ -236,47 +278,51 @@ $common_connstr = "sslrootcert=ssl/root+server_ca.crt sslmode=require dbname=certdb hostaddr=$SERVERHOSTADDR"; # no client cert -test_connect_fails($common_connstr, - "user=ssltestuser sslcert=invalid", - qr/connection requires a valid client certificate/, - "certificate authorization fails without client cert"); +test_connect_fails( + $common_connstr, + "user=ssltestuser sslcert=invalid", + qr/connection requires a valid client certificate/, + "certificate authorization fails without client cert"); # correct client cert -test_connect_ok($common_connstr, - "user=ssltestuser sslcert=ssl/client.crt sslkey=ssl/client_tmp.key", - "certificate authorization succeeds with correct client cert"); +test_connect_ok( + $common_connstr, + "user=ssltestuser sslcert=ssl/client.crt sslkey=ssl/client_tmp.key", + "certificate authorization succeeds with correct client cert"); # client key with wrong permissions -test_connect_fails($common_connstr, - "user=ssltestuser sslcert=ssl/client.crt sslkey=ssl/client_wrongperms_tmp.key", - qr!\Qprivate key file "ssl/client_wrongperms_tmp.key" has group or world access\E!, - "certificate authorization fails because of file permissions"); +test_connect_fails( + $common_connstr, +"user=ssltestuser sslcert=ssl/client.crt sslkey=ssl/client_wrongperms_tmp.key", +qr!\Qprivate key file "ssl/client_wrongperms_tmp.key" has group or world access\E!, + "certificate authorization fails because of file permissions"); # client cert belonging to another user -test_connect_fails($common_connstr, - "user=anotheruser sslcert=ssl/client.crt sslkey=ssl/client_tmp.key", - qr/certificate authentication failed for user "anotheruser"/, - "certificate authorization fails with client cert belonging to another user"); +test_connect_fails( + $common_connstr, + "user=anotheruser sslcert=ssl/client.crt sslkey=ssl/client_tmp.key", + qr/certificate authentication failed for user "anotheruser"/, +"certificate authorization fails with client cert belonging to another user"); # revoked client cert -test_connect_fails($common_connstr, - "user=ssltestuser sslcert=ssl/client-revoked.crt sslkey=ssl/client-revoked_tmp.key", - qr/SSL error/, - "certificate authorization fails with revoked client cert"); +test_connect_fails( + $common_connstr, +"user=ssltestuser sslcert=ssl/client-revoked.crt sslkey=ssl/client-revoked_tmp.key", + qr/SSL error/, + "certificate authorization fails with revoked client cert"); # intermediate client_ca.crt is provided by client, and isn't in server's ssl_ca_file switch_server_cert($node, 'server-cn-only', 'root_ca'); $common_connstr = "user=ssltestuser dbname=certdb sslkey=ssl/client_tmp.key sslrootcert=ssl/root+server_ca.crt hostaddr=$SERVERHOSTADDR"; -test_connect_ok($common_connstr, - "sslmode=require sslcert=ssl/client+client_ca.crt", - "intermediate client certificate is provided by client"); +test_connect_ok( + $common_connstr, + "sslmode=require sslcert=ssl/client+client_ca.crt", + "intermediate client certificate is provided by client"); test_connect_fails($common_connstr, "sslmode=require sslcert=ssl/client.crt", - qr/SSL error/, - "intermediate client certificate is missing"); + qr/SSL error/, "intermediate client certificate is missing"); # clean up -unlink("ssl/client_tmp.key", - "ssl/client_wrongperms_tmp.key", - "ssl/client-revoked_tmp.key"); +unlink("ssl/client_tmp.key", "ssl/client_wrongperms_tmp.key", + "ssl/client-revoked_tmp.key"); diff --git a/src/test/ssl/t/002_scram.pl b/src/test/ssl/t/002_scram.pl index 9460763..42e49b2 100644 --- a/src/test/ssl/t/002_scram.pl +++ b/src/test/ssl/t/002_scram.pl @@ -13,7 +13,7 @@ my $SERVERHOSTADDR = '127.0.0.1'; # Determine whether build supports tls-server-end-point. my $supports_tls_server_end_point = - check_pg_config("#define HAVE_X509_GET_SIGNATURE_NID 1"); + check_pg_config("#define HAVE_X509_GET_SIGNATURE_NID 1"); # Allocation of base connection string shared among multiple tests. my $common_connstr; @@ -31,38 +31,41 @@ $ENV{PGPORT} = $node->port; $node->start; # Configure server for SSL connections, with password handling. -configure_test_server_for_ssl($node, $SERVERHOSTADDR, "scram-sha-256", - "pass", "scram-sha-256"); +configure_test_server_for_ssl($node, $SERVERHOSTADDR, "scram-sha-256", "pass", + "scram-sha-256"); switch_server_cert($node, 'server-cn-only'); $ENV{PGPASSWORD} = "pass"; $common_connstr = -"user=ssltestuser dbname=trustdb sslmode=require hostaddr=$SERVERHOSTADDR"; + "user=ssltestuser dbname=trustdb sslmode=require hostaddr=$SERVERHOSTADDR"; # Default settings test_connect_ok($common_connstr, '', - "SCRAM authentication with default channel binding"); + "SCRAM authentication with default channel binding"); # Channel binding settings -test_connect_ok($common_connstr, +test_connect_ok( + $common_connstr, "scram_channel_binding=tls-unique", "SCRAM authentication with tls-unique as channel binding"); -test_connect_ok($common_connstr, - "scram_channel_binding=''", - "SCRAM authentication without channel binding"); +test_connect_ok($common_connstr, "scram_channel_binding=''", + "SCRAM authentication without channel binding"); if ($supports_tls_server_end_point) { - test_connect_ok($common_connstr, - "scram_channel_binding=tls-server-end-point", - "SCRAM authentication with tls-server-end-point as channel binding"); + test_connect_ok( + $common_connstr, + "scram_channel_binding=tls-server-end-point", + "SCRAM authentication with tls-server-end-point as channel binding"); } else { - test_connect_fails($common_connstr, - "scram_channel_binding=tls-server-end-point", - qr/unsupported SCRAM channel-binding type/, - "SCRAM authentication with tls-server-end-point as channel binding"); + test_connect_fails( + $common_connstr, + "scram_channel_binding=tls-server-end-point", + qr/unsupported SCRAM channel-binding type/, + "SCRAM authentication with tls-server-end-point as channel binding"); } -test_connect_fails($common_connstr, +test_connect_fails( + $common_connstr, "scram_channel_binding=not-exists", qr/unsupported SCRAM channel-binding type/, "SCRAM authentication with invalid channel binding"); diff --git a/src/test/subscription/t/005_encoding.pl b/src/test/subscription/t/005_encoding.pl index 65439f1..020bffb 100644 --- a/src/test/subscription/t/005_encoding.pl +++ b/src/test/subscription/t/005_encoding.pl @@ -34,7 +34,7 @@ $node_publisher->wait_for_catchup($appname); # Wait for initial sync to finish as well my $synced_query = - "SELECT count(1) = 0 FROM pg_subscription_rel WHERE srsubstate NOT IN ('s', 'r');"; +"SELECT count(1) = 0 FROM pg_subscription_rel WHERE srsubstate NOT IN ('s', 'r');"; $node_subscriber->poll_query_until('postgres', $synced_query) or die "Timed out while waiting for subscriber to synchronize data"; diff --git a/src/test/subscription/t/006_rewrite.pl b/src/test/subscription/t/006_rewrite.pl index aa1184c..907a913 100644 --- a/src/test/subscription/t/006_rewrite.pl +++ b/src/test/subscription/t/006_rewrite.pl @@ -30,18 +30,19 @@ $node_publisher->wait_for_catchup($appname); # Wait for initial sync to finish as well my $synced_query = - "SELECT count(1) = 0 FROM pg_subscription_rel WHERE srsubstate NOT IN ('s', 'r');"; +"SELECT count(1) = 0 FROM pg_subscription_rel WHERE srsubstate NOT IN ('s', 'r');"; $node_subscriber->poll_query_until('postgres', $synced_query) or die "Timed out while waiting for subscriber to synchronize data"; -$node_publisher->safe_psql('postgres', q{INSERT INTO test1 (a, b) VALUES (1, 'one'), (2, 'two');}); +$node_publisher->safe_psql('postgres', + q{INSERT INTO test1 (a, b) VALUES (1, 'one'), (2, 'two');}); $node_publisher->wait_for_catchup($appname); -is($node_subscriber->safe_psql('postgres', q{SELECT a, b FROM test1}), - qq(1|one +is( $node_subscriber->safe_psql('postgres', q{SELECT a, b FROM test1}), + qq(1|one 2|two), - 'initial data replicated to subscriber'); + 'initial data replicated to subscriber'); # DDL that causes a heap rewrite my $ddl2 = "ALTER TABLE test1 ADD c int NOT NULL DEFAULT 0;"; @@ -50,15 +51,16 @@ $node_publisher->safe_psql('postgres', $ddl2); $node_publisher->wait_for_catchup($appname); -$node_publisher->safe_psql('postgres', q{INSERT INTO test1 (a, b, c) VALUES (3, 'three', 33);}); +$node_publisher->safe_psql('postgres', + q{INSERT INTO test1 (a, b, c) VALUES (3, 'three', 33);}); $node_publisher->wait_for_catchup($appname); -is($node_subscriber->safe_psql('postgres', q{SELECT a, b, c FROM test1}), - qq(1|one|0 +is( $node_subscriber->safe_psql('postgres', q{SELECT a, b, c FROM test1}), + qq(1|one|0 2|two|0 3|three|33), - 'data replicated to subscriber'); + 'data replicated to subscriber'); $node_subscriber->stop; $node_publisher->stop; diff --git a/src/test/subscription/t/007_ddl.pl b/src/test/subscription/t/007_ddl.pl index b219bf3..97a927b 100644 --- a/src/test/subscription/t/007_ddl.pl +++ b/src/test/subscription/t/007_ddl.pl @@ -28,7 +28,8 @@ $node_subscriber->safe_psql('postgres', $node_publisher->wait_for_catchup($appname); -$node_subscriber->safe_psql('postgres', q{ +$node_subscriber->safe_psql( + 'postgres', q{ BEGIN; ALTER SUBSCRIPTION mysub DISABLE; ALTER SUBSCRIPTION mysub SET (slot_name = NONE); diff --git a/src/test/subscription/t/008_diff_schema.pl b/src/test/subscription/t/008_diff_schema.pl index d4849c8..9c4c39e 100644 --- a/src/test/subscription/t/008_diff_schema.pl +++ b/src/test/subscription/t/008_diff_schema.pl @@ -22,11 +22,14 @@ $node_publisher->safe_psql('postgres', "INSERT INTO test_tab VALUES (1, 'foo'), (2, 'bar')"); # Setup structure on subscriber -$node_subscriber->safe_psql('postgres', "CREATE TABLE test_tab (a int primary key, b text, c timestamptz DEFAULT now(),d bigint DEFAULT 999, e int GENERATED BY DEFAULT AS IDENTITY)"); +$node_subscriber->safe_psql('postgres', +"CREATE TABLE test_tab (a int primary key, b text, c timestamptz DEFAULT now(), d bigint DEFAULT 999, e int GENERATED BYDEFAULT AS IDENTITY)" +); # Setup logical replication my $publisher_connstr = $node_publisher->connstr . ' dbname=postgres'; -$node_publisher->safe_psql('postgres', "CREATE PUBLICATION tap_pub FOR TABLE test_tab"); +$node_publisher->safe_psql('postgres', + "CREATE PUBLICATION tap_pub FOR TABLE test_tab"); my $appname = 'tap_sub'; $node_subscriber->safe_psql('postgres', @@ -41,8 +44,8 @@ my $synced_query = $node_subscriber->poll_query_until('postgres', $synced_query) or die "Timed out while waiting for subscriber to synchronize data"; -my $result = - $node_subscriber->safe_psql('postgres', "SELECT count(*), count(c), count(d = 999) FROM test_tab"); +my $result = $node_subscriber->safe_psql('postgres', + "SELECT count(*), count(c), count(d = 999) FROM test_tab"); is($result, qq(2|2|2), 'check initial data was copied to subscriber'); # Update the rows on the publisher and check the additional columns on @@ -51,20 +54,25 @@ $node_publisher->safe_psql('postgres', "UPDATE test_tab SET b = md5(b)"); $node_publisher->wait_for_catchup($appname); -$result = - $node_subscriber->safe_psql('postgres', "SELECT count(*), count(c), count(d = 999), count(e) FROM test_tab"); -is($result, qq(2|2|2|2), 'check extra columns contain local defaults after copy'); +$result = $node_subscriber->safe_psql('postgres', + "SELECT count(*), count(c), count(d = 999), count(e) FROM test_tab"); +is($result, qq(2|2|2|2), + 'check extra columns contain local defaults after copy'); # Change the local values of the extra columns on the subscriber, # update publisher, and check that subscriber retains the expected # values -$node_subscriber->safe_psql('postgres', "UPDATE test_tab SET c = 'epoch'::timestamptz + 987654321 * interval '1s'"); -$node_publisher->safe_psql('postgres', "UPDATE test_tab SET b = md5(a::text)"); +$node_subscriber->safe_psql('postgres', + "UPDATE test_tab SET c = 'epoch'::timestamptz + 987654321 * interval '1s'" +); +$node_publisher->safe_psql('postgres', + "UPDATE test_tab SET b = md5(a::text)"); $node_publisher->wait_for_catchup($appname); -$result = - $node_subscriber->safe_psql('postgres', "SELECT count(*), count(extract(epoch from c) = 987654321), count(d = 999) FROMtest_tab"); +$result = $node_subscriber->safe_psql('postgres', +"SELECT count(*), count(extract(epoch from c) = 987654321), count(d = 999) FROM test_tab" +); is($result, qq(2|2|2), 'check extra columns contain locally changed data'); # Another insert @@ -73,9 +81,10 @@ $node_publisher->safe_psql('postgres', $node_publisher->wait_for_catchup($appname); -$result = - $node_subscriber->safe_psql('postgres', "SELECT count(*), count(c), count(d = 999), count(e) FROM test_tab"); -is($result, qq(3|3|3|3), 'check extra columns contain local defaults after apply'); +$result = $node_subscriber->safe_psql('postgres', + "SELECT count(*), count(c), count(d = 999), count(e) FROM test_tab"); +is($result, qq(3|3|3|3), + 'check extra columns contain local defaults after apply'); $node_subscriber->stop; $node_publisher->stop; diff --git a/src/test/subscription/t/009_matviews.pl b/src/test/subscription/t/009_matviews.pl index c55c62c..0fc2e3e 100644 --- a/src/test/subscription/t/009_matviews.pl +++ b/src/test/subscription/t/009_matviews.pl @@ -22,10 +22,13 @@ $node_subscriber->safe_psql('postgres', "CREATE SUBSCRIPTION mysub CONNECTION '$publisher_connstr application_name=$appname' PUBLICATION mypub;" ); -$node_publisher->safe_psql('postgres', q{CREATE TABLE test1 (a int PRIMARY KEY, b text)}); -$node_publisher->safe_psql('postgres', q{INSERT INTO test1 (a, b) VALUES (1, 'one'), (2, 'two');}); +$node_publisher->safe_psql('postgres', + q{CREATE TABLE test1 (a int PRIMARY KEY, b text)}); +$node_publisher->safe_psql('postgres', + q{INSERT INTO test1 (a, b) VALUES (1, 'one'), (2, 'two');}); -$node_subscriber->safe_psql('postgres', q{CREATE TABLE test1 (a int PRIMARY KEY, b text);}); +$node_subscriber->safe_psql('postgres', + q{CREATE TABLE test1 (a int PRIMARY KEY, b text);}); $node_publisher->wait_for_catchup($appname); @@ -34,8 +37,10 @@ $node_publisher->wait_for_catchup($appname); # need to make sure they are properly ignored. (bug #15044) # create a MV with some data -$node_publisher->safe_psql('postgres', q{CREATE MATERIALIZED VIEW testmv1 AS SELECT * FROM test1;}); +$node_publisher->safe_psql('postgres', + q{CREATE MATERIALIZED VIEW testmv1 AS SELECT * FROM test1;}); $node_publisher->wait_for_catchup($appname); + # There is no equivalent relation on the subscriber, but MV data is # not replicated, so this does not hang. diff --git a/src/tools/git_changelog b/src/tools/git_changelog index 2fc1565..5c41efa 100755 --- a/src/tools/git_changelog +++ b/src/tools/git_changelog @@ -102,9 +102,9 @@ my %rel_tags; { my $commit = $1; my $tag = $2; - if ($tag =~ /^REL_\d+_\d+$/ - || $tag =~ /^REL\d+_\d+$/ - || $tag =~ /^REL\d+_\d+_\d+$/) + if ( $tag =~ /^REL_\d+_\d+$/ + || $tag =~ /^REL\d+_\d+$/ + || $tag =~ /^REL\d+_\d+_\d+$/) { $rel_tags{$commit} = $tag; } diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm index 123292f..f0931f1 100644 --- a/src/tools/msvc/Mkvcbuild.pm +++ b/src/tools/msvc/Mkvcbuild.pm @@ -523,9 +523,9 @@ sub mkvcbuild my $perl_path = $solution->{options}->{perl} . '\lib\CORE\*perl*'; - # ActivePerl 5.16 provided perl516.lib; 5.18 provided libperl518.a - # Starting with ActivePerl 5.24, both perlnn.lib and libperlnn.a are provided. - # In this case, prefer .lib. +# ActivePerl 5.16 provided perl516.lib; 5.18 provided libperl518.a +# Starting with ActivePerl 5.24, both perlnn.lib and libperlnn.a are provided. +# In this case, prefer .lib. my @perl_libs = grep { /perl\d+\.lib$|libperl\d+\.a$/ } glob($perl_path); if (@perl_libs > 0) diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm index 36e9fd7..04133c8 100644 --- a/src/tools/msvc/Solution.pm +++ b/src/tools/msvc/Solution.pm @@ -270,7 +270,8 @@ s{PG_VERSION_STR "[^"]+"}{PG_VERSION_STR "PostgreSQL $self->{strver}$extraver, c print "Generating fmgrtab.c, fmgroids.h, fmgrprotos.h...\n"; chdir('src/backend/utils'); system( -"perl -I ../catalog Gen_fmgrtab.pl -I../../../src/include/ ../../../src/include/catalog/pg_proc.h"); +"perl -I ../catalog Gen_fmgrtab.pl -I../../../src/include/ ../../../src/include/catalog/pg_proc.h" + ); chdir('../../..'); } if (IsNewer( @@ -536,6 +537,7 @@ sub AddProject } else { + # We don't expect the config-specific library to be here, # so don't ask for it in last parameter $proj->AddLibrary( diff --git a/src/tools/msvc/VSObjectFactory.pm b/src/tools/msvc/VSObjectFactory.pm index 2f3480a..3e29089 100644 --- a/src/tools/msvc/VSObjectFactory.pm +++ b/src/tools/msvc/VSObjectFactory.pm @@ -53,8 +53,10 @@ sub CreateSolution { return new VS2015Solution(@_); } - # visual 2017 hasn't changed the nmake version to 15, so adjust the check to support it. - elsif (($visualStudioVersion ge '14.10') or ($visualStudioVersion eq '15.00')) + +# visual 2017 hasn't changed the nmake version to 15, so adjust the check to support it. + elsif (($visualStudioVersion ge '14.10') + or ($visualStudioVersion eq '15.00')) { return new VS2017Solution(@_); } @@ -98,8 +100,10 @@ sub CreateProject { return new VC2015Project(@_); } - # visual 2017 hasn't changed the nmake version to 15, so adjust the check to support it. - elsif (($visualStudioVersion ge '14.10') or ($visualStudioVersion eq '15.00')) + +# visual 2017 hasn't changed the nmake version to 15, so adjust the check to support it. + elsif (($visualStudioVersion ge '14.10') + or ($visualStudioVersion eq '15.00')) { return new VC2017Project(@_); } @@ -132,7 +136,8 @@ sub DetermineVisualStudioVersion sub _GetVisualStudioVersion { my ($major, $minor) = @_; - # visual 2017 hasn't changed the nmake version to 15, so still using the older version for comparison. + +# visual 2017 hasn't changed the nmake version to 15, so still using the older version for comparison. if ($major > 14) { carp diff --git a/src/tools/msvc/vcregress.pl b/src/tools/msvc/vcregress.pl index 314f2c3..300ba32 100644 --- a/src/tools/msvc/vcregress.pl +++ b/src/tools/msvc/vcregress.pl @@ -254,13 +254,16 @@ sub plcheck { next unless -d "$dir/sql" && -d "$dir/expected"; my $lang; - if ($dir eq 'plpgsql/src') { + if ($dir eq 'plpgsql/src') + { $lang = 'plpgsql'; } - elsif ($dir eq 'tcl') { + elsif ($dir eq 'tcl') + { $lang = 'pltcl'; } - else { + else + { $lang = $dir; } if ($lang eq 'plpython')
On Fri, Mar 2, 2018 at 4:49 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Magnus Hagander <magnus@hagander.net> writes:
> On Fri, Mar 2, 2018 at 3:53 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> +1. We're not that far away from it being time to run pgindent/perltidy,
>> so now would be a good time to consider whether we like a newer version's
>> result better.
> For example, Debian ships with 20140328, which produces the attached diff.
> I'm not sure if we want to go to whatever is a "common version on most
> platforms" today, or just "whatever is latest" if we do upgrade. AFAICT
> RHEL 7 seems to be on 20121207, RHEL 6 on 20090616. And in Ubuntu, 14.04
> has 20120701, 16.04 has 20140328, and current devel has 20140328. In
> general there seems to be very little overlap there, except Debian and
> Ubuntu covers the same versions.
> (Note that this diff is against HEAD -- it's possible a perltidy run with
> the current version would also generate a diff, I have not compared them to
> each other)
Yeah, perltidy 20090616 already produces a pretty substantial diff on
HEAD; attached.
Ah yeah, if I apply that one first, the diff from using 20140328 is much smaller. Attached is that one, which means the difference between the two perltidy versions.
Attachment
Magnus Hagander <magnus@hagander.net> writes: > Ah yeah, if I apply that one first, the diff from using 20140328 is much > smaller. Attached is that one, which means the difference between the two > perltidy versions. I'm hardly a Perl guru, so I'm not going to opine on whether these changes are for the better or worse. They're definitely not very extensive, though. If the folks here who do hack Perl a lot think the 20140328 output is better, I'm fine with switching. regards, tom lane
On Sun, Mar 4, 2018 at 9:33 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote: > Magnus Hagander <magnus@hagander.net> writes: >> Ah yeah, if I apply that one first, the diff from using 20140328 is much >> smaller. Attached is that one, which means the difference between the two >> perltidy versions. > > I'm hardly a Perl guru, so I'm not going to opine on whether these > changes are for the better or worse. They're definitely not very > extensive, though. If the folks here who do hack Perl a lot think > the 20140328 output is better, I'm fine with switching. > It's a bit hard to tell just looking at the patch, but some of the removal of leading whitespace looks a bit unfortunate (.e.g. genbki, duplicate_oids). Maybe it would OK when applied. One thing I have found is that string literals need to be broken up to less than the line length or modern perltidy will happily realign them to the start of the line regardless of other settings. I see what looks like some evidence of that here. cheers andrew -- Andrew Dunstan https://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
> On 04 Mar 2018, at 00:03, Tom Lane <tgl@sss.pgh.pa.us> wrote: > > Magnus Hagander <magnus@hagander.net> writes: >> Ah yeah, if I apply that one first, the diff from using 20140328 is much >> smaller. Attached is that one, which means the difference between the two >> perltidy versions. > > I'm hardly a Perl guru, so I'm not going to opine on whether these > changes are for the better or worse. They're definitely not very > extensive, though. If the folks here who do hack Perl a lot think > the 20140328 output is better, I'm fine with switching. The 20140328 format is, IMHO, better in enough ways that I’d recommend switching. The fact that it makes download for users, and documentation writing for the project, easier is another good thing. +1 for going ti 20140328. cheers ./daniel
Magnus Hagander wrote: > For example, Debian ships with 20140328, which produces the attached diff. > I'm not sure if we want to go to whatever is a "common version on most > platforms" today, or just "whatever is latest" if we do upgrade. AFAICT > RHEL 7 seems to be on 20121207, RHEL 6 on 20090616. And in Ubuntu, 14.04 > has 20120701, 16.04 has 20140328, and current devel has 20140328. In > general there seems to be very little overlap there, except Debian and > Ubuntu covers the same versions. here's the changelog https://metacpan.org/source/SHANCOCK/Perl-Tidy-20180220/CHANGES The wikipedia page claims that the latest stable release is 20160302, but that seems to be just because the page is out of date (last update is before the following 2017-05 release) It's hard to form an opinion based on this. I don't think picking one because of its availability in some distribution is useful, since almost everyone is going to have to download a custom one anyway, whichever distribution we pick -- unless it's mine, of course, hah. I think we should just pick some recent one and use it for X years; use that one for all backbranches. I propose X=3. I propose 20170521 (newer ones seem to cater for stuff that I think we mostly don't use). -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
On Mon, Mar 5, 2018 at 2:53 PM, Alvaro Herrera <alvherre@2ndquadrant.com> wrote:
Magnus Hagander wrote:
> For example, Debian ships with 20140328, which produces the attached diff.
> I'm not sure if we want to go to whatever is a "common version on most
> platforms" today, or just "whatever is latest" if we do upgrade. AFAICT
> RHEL 7 seems to be on 20121207, RHEL 6 on 20090616. And in Ubuntu, 14.04
> has 20120701, 16.04 has 20140328, and current devel has 20140328. In
> general there seems to be very little overlap there, except Debian and
> Ubuntu covers the same versions.
here's the changelog
https://metacpan.org/source/SHANCOCK/Perl-Tidy-20180220/ CHANGES
The wikipedia page claims that the latest stable release is 20160302,
but that seems to be just because the page is out of date (last update
is before the following 2017-05 release)
It's hard to form an opinion based on this. I don't think picking one
because of its availability in some distribution is useful, since almost
everyone is going to have to download a custom one anyway, whichever
distribution we pick -- unless it's mine, of course, hah.
I think we should just pick some recent one and use it for X years; use
that one for all backbranches. I propose X=3. I propose 20170521
(newer ones seem to cater for stuff that I think we mostly don't use).
20140328 seems to cover *most* versions. Another argument for that one would be it's the one that we have on Borka, which is where we build the official release tarballs, so we can use that as a stable fallback.
Those are both fairly weak arguments though. As long as we have good instructions for how to make a local install of it that doesn't affect the rest of the system, then that should not matter. And we need such instructions anyway, since it won't be on every distribution.
On 3/5/18 09:02, Magnus Hagander wrote: > I think we should just pick some recent one and use it for X years; use > that one for all backbranches. I propose X=3. I propose 20170521 > (newer ones seem to cater for stuff that I think we mostly don't use). > > > 20140328 seems to cover *most* versions. Another argument for that one > would be it's the one that we have on Borka, which is where we build the > official release tarballs, so we can use that as a stable fallback. > > Those are both fairly weak arguments though. As long as we have good > instructions for how to make a local install of it that doesn't affect > the rest of the system, then that should not matter. And we need such > instructions anyway, since it won't be on every distribution. Did we decide on this? -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Peter Eisentraut wrote: > On 3/5/18 09:02, Magnus Hagander wrote: > > I think we should just pick some recent one and use it for X years; use > > that one for all backbranches. I propose X=3. I propose 20170521 > > (newer ones seem to cater for stuff that I think we mostly don't use). > > > > 20140328 seems to cover *most* versions. Another argument for that one > > would be it's the one that we have on Borka, which is where we build the > > official release tarballs, so we can use that as a stable fallback. > > > > Those are both fairly weak arguments though. As long as we have good > > instructions for how to make a local install of it that doesn't affect > > the rest of the system, then that should not matter. And we need such > > instructions anyway, since it won't be on every distribution. > > Did we decide on this? No agreement yet apparently :-) I still vote we use 20170521 which is recent enough that we won't have to change it in a few years. I further vote that we change the URL in pgindent/README from sourceforge to metacpan.org, https://metacpan.org/pod/distribution/Perl-Tidy/lib/Perl/Tidy.pod -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Alvaro Herrera <alvherre@alvh.no-ip.org> writes: > Peter Eisentraut wrote: >> Did we decide on this? > No agreement yet apparently :-) > I still vote we use 20170521 which is recent enough that we won't have > to change it in a few years. > I further vote that we change the URL in pgindent/README from > sourceforge to metacpan.org, > https://metacpan.org/pod/distribution/Perl-Tidy/lib/Perl/Tidy.pod I have no particular opinion on which version to use, but if we're going to change for this cycle, it's time to do so. I'm intending to do the initial pgindent run pretty soon ... regards, tom lane
On Mon, Apr 23, 2018 at 12:40:00PM -0400, Tom Lane wrote: > Alvaro Herrera <alvherre@alvh.no-ip.org> writes: >> I still vote we use 20170521 which is recent enough that we won't have >> to change it in a few years. That's the version available on Debian sid, so from the prospective of any Debian user this is a handy version to use when sending patches: perltidy/unstable,now 20170521-1 all [installed] >> I further vote that we change the URL in pgindent/README from >> sourceforge to metacpan.org, >> https://metacpan.org/pod/distribution/Perl-Tidy/lib/Perl/Tidy.pod > > I have no particular opinion on which version to use, but if we're going > to change for this cycle, it's time to do so. I'm intending to do the > initial pgindent run pretty soon ... I would vote for using a newer version with v11. -- Michael
Attachment
Michael Paquier <michael@paquier.xyz> writes: > On Mon, Apr 23, 2018 at 12:40:00PM -0400, Tom Lane wrote: >> Alvaro Herrera <alvherre@alvh.no-ip.org> writes: >>> I still vote we use 20170521 which is recent enough that we won't have >>> to change it in a few years. > That's the version available on Debian sid, so from the prospective of > any Debian user this is a handy version to use when sending patches: > perltidy/unstable,now 20170521-1 all [installed] I'm not hearing any objections or counterproposals, so let's go with that version. >>> I further vote that we change the URL in pgindent/README from >>> sourceforge to metacpan.org, >>> https://metacpan.org/pod/distribution/Perl-Tidy/lib/Perl/Tidy.pod Agreed on pointing to cpan, but that page is pretty confusing if you're looking for a non-bleeding-edge version. I suggest linking to https://cpan.metacpan.org/authors/id/S/SH/SHANCOCK/ which presents a handy directory listing. Or we could just point to https://cpan.metacpan.org/authors/id/S/SH/SHANCOCK/Perl-Tidy-20170521.tar.gz regards, tom lane
Tom Lane wrote: > Michael Paquier <michael@paquier.xyz> writes: > > On Mon, Apr 23, 2018 at 12:40:00PM -0400, Tom Lane wrote: > >> Alvaro Herrera <alvherre@alvh.no-ip.org> writes: > >>> I further vote that we change the URL in pgindent/README from > >>> sourceforge to metacpan.org, > >>> https://metacpan.org/pod/distribution/Perl-Tidy/lib/Perl/Tidy.pod > > Agreed on pointing to cpan, but that page is pretty confusing if you're > looking for a non-bleeding-edge version. I suggest linking to > > https://cpan.metacpan.org/authors/id/S/SH/SHANCOCK/ > > which presents a handy directory listing. Works for me. It's true that the other one is confusing unless you know exactly where to click. > Or we could just point to > > https://cpan.metacpan.org/authors/id/S/SH/SHANCOCK/Perl-Tidy-20170521.tar.gz Well, that'd have to be updated whenever we change version, so I'd rather have it go to the directory. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Alvaro Herrera <alvherre@alvh.no-ip.org> writes: > Tom Lane wrote: >> Agreed on pointing to cpan, but that page is pretty confusing if you're >> looking for a non-bleeding-edge version. I suggest linking to >> https://cpan.metacpan.org/authors/id/S/SH/SHANCOCK/ >> which presents a handy directory listing. > Works for me. It's true that the other one is confusing unless you know > exactly where to click. Done like that. Anyone want to cross-check that they get the same results I did? regards, tom lane
Tom Lane wrote: > Alvaro Herrera <alvherre@alvh.no-ip.org> writes: > > Tom Lane wrote: > >> Agreed on pointing to cpan, but that page is pretty confusing if you're > >> looking for a non-bleeding-edge version. I suggest linking to > >> https://cpan.metacpan.org/authors/id/S/SH/SHANCOCK/ > >> which presents a handy directory listing. > > > Works for me. It's true that the other one is confusing unless you know > > exactly where to click. > > Done like that. Anyone want to cross-check that they get the same > results I did? I do. (I also tested the "cpan" install instructions, and they worked flawlessly, ending up with the correct ~/perl5/bin/perltidy binary.) Thanks! -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Moin, On Wed, April 25, 2018 12:35 pm, Tom Lane wrote: > Michael Paquier <michael@paquier.xyz> writes: >> On Mon, Apr 23, 2018 at 12:40:00PM -0400, Tom Lane wrote: >>> Alvaro Herrera <alvherre@alvh.no-ip.org> writes: >>>> I still vote we use 20170521 which is recent enough that we won't have >>>> to change it in a few years. > >> That's the version available on Debian sid, so from the prospective of >> any Debian user this is a handy version to use when sending patches: >> perltidy/unstable,now 20170521-1 all [installed] > > I'm not hearing any objections or counterproposals, so let's go with > that version. > >>>> I further vote that we change the URL in pgindent/README from >>>> sourceforge to metacpan.org, >>>> https://metacpan.org/pod/distribution/Perl-Tidy/lib/Perl/Tidy.pod > > Agreed on pointing to cpan, but that page is pretty confusing if you're > looking for a non-bleeding-edge version. I suggest linking to > > https://cpan.metacpan.org/authors/id/S/SH/SHANCOCK/ > > which presents a handy directory listing. Linking to the author directory can be pretty confusing, because if a new (co-)-maintainer releases something, it will end up not in this directory. But it is possible to point to the specific version PG needs like so: http://search.cpan.org/~shancock/Perl-Tidy-20170521/ That way visitor see the right version, but also have all the other data and see all other (still existing) versions, if they want. If that page is "more confusing" than a directory listing where you have to pick the right file, or not, is of course debatable. Regards, Tels
"Tels" <nospam-pg-abuse@bloodgate.com> writes: > On Wed, April 25, 2018 12:35 pm, Tom Lane wrote: >> Agreed on pointing to cpan, but that page is pretty confusing if you're >> looking for a non-bleeding-edge version. I suggest linking to >> https://cpan.metacpan.org/authors/id/S/SH/SHANCOCK/ >> which presents a handy directory listing. > Linking to the author directory can be pretty confusing, because if a new > (co-)-maintainer releases something, it will end up not in this directory. As long as we're pointing at a specific past release, this seems like not much of a problem. Also, if I understood correctly, we need to expose the author name as part of the install-with-cpan recipe, so taking it out of the other URL seems like little advantage. regards, tom lane