public inbox for [email protected]help / color / mirror / Atom feed
[PATCH v24 4/7] default to --with-lz4 3+ messages / 3 participants [nested] [flat]
* [PATCH v24 4/7] default to --with-lz4 @ 2021-02-14 04:11 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 3+ messages in thread From: Justin Pryzby @ 2021-02-14 04:11 UTC (permalink / raw) this is meant to excercize the new feature in the CIs, and not meant to be merged --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 63940b78a0..1fb0f07323 100644 --- a/configure.ac +++ b/configure.ac @@ -990,8 +990,8 @@ AC_SUBST(with_zlib) # LZ4 # AC_MSG_CHECKING([whether to build with LZ4 support]) -PGAC_ARG_BOOL(with, lz4, no, [build with LZ4 support], - [AC_DEFINE([USE_LZ4], 1, [Define to 1 to build with LZ4 support. (--with-lz4)])]) +PGAC_ARG_BOOL(without, lz4, no, [build without LZ4 support], + [AC_DEFINE([USE_LZ4], 1, [Define to 1 to build without LZ4 support. (--without-lz4)])]) AC_SUBST(with_lz4) # -- 2.17.0 --YZ5djTAD1cGYuMQK Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0005-fixups.patch.patch" ^ permalink raw reply [nested|flat] 3+ messages in thread
* What about Perl autodie? @ 2024-02-07 14:05 Peter Eisentraut <[email protected]> 2024-02-07 16:51 ` Re: What about Perl autodie? Greg Sabino Mullane <[email protected]> 0 siblings, 1 reply; 3+ messages in thread From: Peter Eisentraut @ 2024-02-07 14:05 UTC (permalink / raw) To: pgsql-hackers I came across the Perl autodie pragma (https://perldoc.perl.org/autodie). This seems pretty useful; is this something we can use? Any drawbacks? Any minimum Perl version? Attached is a sample patch of the kind of thing I'd be interested in. The existing error handling of file operations in Perl is pretty cumbersome, and this would simplify that. Btw., here is a sample error message from autodie: Can't open '../src/include/mb/pg_wchar.h' for reading: 'No such file or directory' at ../src/include/catalog/../../backend/catalog/genbki.pl line 391 which seems as good or better than the stuff we produce manually. From 4ada07b13ecde8b3c0d120583202a38de062239f Mon Sep 17 00:00:00 2001 From: Peter Eisentraut <[email protected]> Date: Wed, 7 Feb 2024 14:59:36 +0100 Subject: [PATCH] WIP: Make some use of Perl autodie pragma --- src/backend/catalog/Catalog.pm | 11 ++++++----- src/backend/catalog/genbki.pl | 24 +++++++++--------------- 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/src/backend/catalog/Catalog.pm b/src/backend/catalog/Catalog.pm index 55a8877aede..fa42d472df1 100644 --- a/src/backend/catalog/Catalog.pm +++ b/src/backend/catalog/Catalog.pm @@ -15,6 +15,7 @@ package Catalog; use strict; use warnings FATAL => 'all'; +use autodie; use File::Compare; @@ -48,7 +49,7 @@ sub ParseHeader $catalog{foreign_keys} = []; $catalog{client_code} = []; - open(my $ifh, '<', $input_file) || die "$input_file: $!"; + open(my $ifh, '<', $input_file); # Scan the input file. while (<$ifh>) @@ -307,7 +308,7 @@ sub ParseData { my ($input_file, $schema, $preserve_formatting) = @_; - open(my $ifd, '<', $input_file) || die "$input_file: $!"; + open(my $ifd, '<', $input_file); $input_file =~ /(\w+)\.dat$/ or die "Input file $input_file needs to be a .dat file.\n"; my $catname = $1; @@ -531,11 +532,11 @@ sub RenameTempFile if (-f $final_name && compare($temp_name, $final_name) == 0) { - unlink($temp_name) || die "unlink: $temp_name: $!"; + unlink($temp_name); } else { - rename($temp_name, $final_name) || die "rename: $temp_name: $!"; + rename($temp_name, $final_name); } return; } @@ -553,7 +554,7 @@ sub FindDefinedSymbol $include_path .= '/'; } my $file = $include_path . $catalog_header; - open(my $find_defined_symbol, '<', $file) || die "$file: $!"; + open(my $find_defined_symbol, '<', $file); while (<$find_defined_symbol>) { if (/^#define\s+\Q$symbol\E\s+(\S+)/) diff --git a/src/backend/catalog/genbki.pl b/src/backend/catalog/genbki.pl index 94afdc5491d..dc8cba037fd 100644 --- a/src/backend/catalog/genbki.pl +++ b/src/backend/catalog/genbki.pl @@ -15,6 +15,7 @@ use strict; use warnings FATAL => 'all'; +use autodie; use Getopt::Long; use FindBin; @@ -386,7 +387,7 @@ my %encids; my $encfile = $include_path . 'mb/pg_wchar.h'; -open(my $ef, '<', $encfile) || die "$encfile: $!"; +open(my $ef, '<', $encfile); # We're parsing an enum, so start with 0 and increment # every time we find an enum member. @@ -435,23 +436,17 @@ # Open temp files my $tmpext = ".tmp$$"; my $bkifile = $output_path . 'postgres.bki'; -open my $bki, '>', $bkifile . $tmpext - or die "can't open $bkifile$tmpext: $!"; +open my $bki, '>', $bkifile . $tmpext; my $schemafile = $output_path . 'schemapg.h'; -open my $schemapg, '>', $schemafile . $tmpext - or die "can't open $schemafile$tmpext: $!"; +open my $schemapg, '>', $schemafile . $tmpext; my $fk_info_file = $output_path . 'system_fk_info.h'; -open my $fk_info, '>', $fk_info_file . $tmpext - or die "can't open $fk_info_file$tmpext: $!"; +open my $fk_info, '>', $fk_info_file . $tmpext; my $constraints_file = $output_path . 'system_constraints.sql'; -open my $constraints, '>', $constraints_file . $tmpext - or die "can't open $constraints_file$tmpext: $!"; +open my $constraints, '>', $constraints_file . $tmpext; my $syscache_ids_file = $output_path . 'syscache_ids.h'; -open my $syscache_ids_fh, '>', $syscache_ids_file . $tmpext - or die "can't open $syscache_ids_file$tmpext: $!"; +open my $syscache_ids_fh, '>', $syscache_ids_file . $tmpext; my $syscache_info_file = $output_path . 'syscache_info.h'; -open my $syscache_info_fh, '>', $syscache_info_file . $tmpext - or die "can't open $syscache_info_file$tmpext: $!"; +open my $syscache_info_fh, '>', $syscache_info_file . $tmpext; # Generate postgres.bki and pg_*_d.h headers. @@ -469,8 +464,7 @@ # Create one definition header with macro definitions for each catalog. my $def_file = $output_path . $catname . '_d.h'; - open my $def, '>', $def_file . $tmpext - or die "can't open $def_file$tmpext: $!"; + open my $def, '>', $def_file . $tmpext; print_boilerplate($def, "${catname}_d.h", "Macro definitions for $catname"); -- 2.43.0 Attachments: [text/plain] 0001-WIP-Make-some-use-of-Perl-autodie-pragma.patch (4.1K, ../../[email protected]/2-0001-WIP-Make-some-use-of-Perl-autodie-pragma.patch) download | inline diff: From 4ada07b13ecde8b3c0d120583202a38de062239f Mon Sep 17 00:00:00 2001 From: Peter Eisentraut <[email protected]> Date: Wed, 7 Feb 2024 14:59:36 +0100 Subject: [PATCH] WIP: Make some use of Perl autodie pragma --- src/backend/catalog/Catalog.pm | 11 ++++++----- src/backend/catalog/genbki.pl | 24 +++++++++--------------- 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/src/backend/catalog/Catalog.pm b/src/backend/catalog/Catalog.pm index 55a8877aede..fa42d472df1 100644 --- a/src/backend/catalog/Catalog.pm +++ b/src/backend/catalog/Catalog.pm @@ -15,6 +15,7 @@ package Catalog; use strict; use warnings FATAL => 'all'; +use autodie; use File::Compare; @@ -48,7 +49,7 @@ sub ParseHeader $catalog{foreign_keys} = []; $catalog{client_code} = []; - open(my $ifh, '<', $input_file) || die "$input_file: $!"; + open(my $ifh, '<', $input_file); # Scan the input file. while (<$ifh>) @@ -307,7 +308,7 @@ sub ParseData { my ($input_file, $schema, $preserve_formatting) = @_; - open(my $ifd, '<', $input_file) || die "$input_file: $!"; + open(my $ifd, '<', $input_file); $input_file =~ /(\w+)\.dat$/ or die "Input file $input_file needs to be a .dat file.\n"; my $catname = $1; @@ -531,11 +532,11 @@ sub RenameTempFile if (-f $final_name && compare($temp_name, $final_name) == 0) { - unlink($temp_name) || die "unlink: $temp_name: $!"; + unlink($temp_name); } else { - rename($temp_name, $final_name) || die "rename: $temp_name: $!"; + rename($temp_name, $final_name); } return; } @@ -553,7 +554,7 @@ sub FindDefinedSymbol $include_path .= '/'; } my $file = $include_path . $catalog_header; - open(my $find_defined_symbol, '<', $file) || die "$file: $!"; + open(my $find_defined_symbol, '<', $file); while (<$find_defined_symbol>) { if (/^#define\s+\Q$symbol\E\s+(\S+)/) diff --git a/src/backend/catalog/genbki.pl b/src/backend/catalog/genbki.pl index 94afdc5491d..dc8cba037fd 100644 --- a/src/backend/catalog/genbki.pl +++ b/src/backend/catalog/genbki.pl @@ -15,6 +15,7 @@ use strict; use warnings FATAL => 'all'; +use autodie; use Getopt::Long; use FindBin; @@ -386,7 +387,7 @@ my %encids; my $encfile = $include_path . 'mb/pg_wchar.h'; -open(my $ef, '<', $encfile) || die "$encfile: $!"; +open(my $ef, '<', $encfile); # We're parsing an enum, so start with 0 and increment # every time we find an enum member. @@ -435,23 +436,17 @@ # Open temp files my $tmpext = ".tmp$$"; my $bkifile = $output_path . 'postgres.bki'; -open my $bki, '>', $bkifile . $tmpext - or die "can't open $bkifile$tmpext: $!"; +open my $bki, '>', $bkifile . $tmpext; my $schemafile = $output_path . 'schemapg.h'; -open my $schemapg, '>', $schemafile . $tmpext - or die "can't open $schemafile$tmpext: $!"; +open my $schemapg, '>', $schemafile . $tmpext; my $fk_info_file = $output_path . 'system_fk_info.h'; -open my $fk_info, '>', $fk_info_file . $tmpext - or die "can't open $fk_info_file$tmpext: $!"; +open my $fk_info, '>', $fk_info_file . $tmpext; my $constraints_file = $output_path . 'system_constraints.sql'; -open my $constraints, '>', $constraints_file . $tmpext - or die "can't open $constraints_file$tmpext: $!"; +open my $constraints, '>', $constraints_file . $tmpext; my $syscache_ids_file = $output_path . 'syscache_ids.h'; -open my $syscache_ids_fh, '>', $syscache_ids_file . $tmpext - or die "can't open $syscache_ids_file$tmpext: $!"; +open my $syscache_ids_fh, '>', $syscache_ids_file . $tmpext; my $syscache_info_file = $output_path . 'syscache_info.h'; -open my $syscache_info_fh, '>', $syscache_info_file . $tmpext - or die "can't open $syscache_info_file$tmpext: $!"; +open my $syscache_info_fh, '>', $syscache_info_file . $tmpext; # Generate postgres.bki and pg_*_d.h headers. @@ -469,8 +464,7 @@ # Create one definition header with macro definitions for each catalog. my $def_file = $output_path . $catname . '_d.h'; - open my $def, '>', $def_file . $tmpext - or die "can't open $def_file$tmpext: $!"; + open my $def, '>', $def_file . $tmpext; print_boilerplate($def, "${catname}_d.h", "Macro definitions for $catname"); -- 2.43.0 ^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: What about Perl autodie? 2024-02-07 14:05 What about Perl autodie? Peter Eisentraut <[email protected]> @ 2024-02-07 16:51 ` Greg Sabino Mullane <[email protected]> 0 siblings, 0 replies; 3+ messages in thread From: Greg Sabino Mullane @ 2024-02-07 16:51 UTC (permalink / raw) To: Peter Eisentraut <[email protected]>; +Cc: pgsql-hackers On Wed, Feb 7, 2024 at 9:05 AM Peter Eisentraut <[email protected]> wrote: > I came across the Perl autodie pragma > (https://perldoc.perl.org/autodie). This seems pretty useful; is this > something we can use? Any drawbacks? Any minimum Perl version? Big +1 No drawbacks. I've been using it heavily for many, many years. Came out in 5.10.1, which should be available everywhere at this point (2009 was the year of release) Cheers, Greg ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2024-02-07 16:51 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2021-02-14 04:11 [PATCH v24 4/7] default to --with-lz4 Justin Pryzby <[email protected]> 2024-02-07 14:05 What about Perl autodie? Peter Eisentraut <[email protected]> 2024-02-07 16:51 ` Re: What about Perl autodie? Greg Sabino Mullane <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox