diff --git a/Build.PL b/Build.PL index e1ebb44..5c4ac7a 100644 --- a/Build.PL +++ b/Build.PL @@ -71,6 +71,11 @@ $class->new( requires => { 'aliased' => '0.30', 'Archive::Extract' => '0.88', + 'Archive::Tar' => '2.32', + 'Compress::Zlib' => '2.084', + 'IO::Uncompress::Bunzip2' => '2.084', + 'IO::Uncompress::UnXz' => '2.084', + 'IO::Zlib' => '1.10', 'Archive::Zip' => '1.30', 'Class::ISA' => '0.36', 'Cwd' => '3.33', diff --git a/Changes b/Changes index 23c1229..a9ec065 100644 --- a/Changes +++ b/Changes @@ -5,6 +5,14 @@ Revision history for Perl extension PGXN::Manager from appearing in stack traces. - Enabled fixup mode for the database connection, so the service can auto-recover from database downtimes. + - Switched from command-line binaries to pure Perl modules for + extracting archives. Not sure why it preferred binaries up to now, + but preferring Pure Perl eliminates a lot of IO::Select warnings that + were really messing with things. + - Changed some internal error propagation to use blessed arrays + rather than plain arrays, to prevent confusing any doe that might + try to call isa() on them (as was happening when preferring + command-line tools for extraction). 0.21.0 2021-07-05T22:30:54Z - Updated the password hashing to a much slower and therefor more @@ -14,7 +22,7 @@ Revision history for Perl extension PGXN::Manager - Changed the minimum password length from 4 to 8 characters. - Added clear_password() SQL function as a tool for admins to set a user password to a random string and create a reset token. - - Added the `reset_password` command to pgxn_maint for admins to use + - Added the `reset_password` command to `pgxn_maint` for admins to use to clear one or more user passwords and send emails to those users with links to create new passwords. diff --git a/lib/PGXN/Manager/Distribution.pm b/lib/PGXN/Manager/Distribution.pm index 41822e4..4c351e2 100644 --- a/lib/PGXN/Manager/Distribution.pm +++ b/lib/PGXN/Manager/Distribution.pm @@ -109,7 +109,7 @@ sub extract { my $ae = do { my $extract_dir = File::Spec->catdir($workdir, 'source'); local $Archive::Extract::WARN = 1; - local $Archive::Extract::PREFER_BIN = 1; + # local $Archive::Extract::PREFER_BIN = 1; # local $Archive::Extract::DEBUG = 1; local $SIG{__WARN__} = \&_ae_error_handler; my $ae = Archive::Extract->new( @@ -129,7 +129,7 @@ sub extract { } return $self; } catch { - die $_ unless ref $_ eq 'ARRAY'; + die $_ unless ref $_ eq '::_ERR'; $self->error([@{ $_ }, $self->basename]); return; }; @@ -352,16 +352,16 @@ sub DEMOLISH { sub _zip_error_handler { for (shift) { if (/format error: can't find EOCD signature/) { - die ['“[_1]” doesn’t look like a distribution archive']; + die bless ['“[_1]” doesn’t look like a distribution archive'], '::_ERR'; } - die [$_]; + die bless [$_], '::_ERR'; } } my $CWD = cwd; sub _ae_error_handler { chdir $CWD; # Go back to where we belong. - die ['“[_1]” doesn’t look like a distribution archive']; + die bless ['“[_1]” doesn’t look like a distribution archive'], '::_ERR'; } __PACKAGE__->meta->make_immutable(inline_constructor => 0); diff --git a/t/distribution.t b/t/distribution.t index fecb613..d5ae231 100644 --- a/t/distribution.t +++ b/t/distribution.t @@ -110,7 +110,7 @@ is $dist->localized_error, # Try an invalid zip file. my $badzip = __FILE__ . '.zip'; copy __FILE__, $badzip; -END { unlink $badzip } +END { unlink $badzip if $badzip } isa_ok $dist = new_dist($badzip), $CLASS, 'Bad zip distribution'; ok !$dist->extract, 'Try to extract it'; @@ -122,7 +122,7 @@ is_deeply scalar $dist->error, [ # Try an invalid tgz file. my $badtgz = __FILE__ . '.tgz'; copy __FILE__, $badtgz; -END { unlink $badtgz } +END { unlink $badtgz if $badtgz } isa_ok $dist = new_dist($badtgz), $CLASS, 'Bad tgz distribution'; ok !$dist->extract, 'Try to extract it';