Skip to content

Commit

Permalink
Prefer pure Perl archive tools
Browse files Browse the repository at this point in the history
Was getting a lot of noisy warnings from the command-line tools for some
reason. Preferring Perl modules fixed the issue. So add the complete list to
the list of dependencies. May be more; will watch jib/archive-extract#10
to expand the list if necessary.
  • Loading branch information
theory committed Jan 16, 2022
1 parent d693198 commit ba65ee1
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
5 changes: 5 additions & 0 deletions Build.PL
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
10 changes: 9 additions & 1 deletion Changes
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.

Expand Down
10 changes: 5 additions & 5 deletions lib/PGXN/Manager/Distribution.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -129,7 +129,7 @@ sub extract {
}
return $self;
} catch {
die $_ unless ref $_ eq 'ARRAY';
die $_ unless ref $_ eq '::_ERR';
$self->error([@{ $_ }, $self->basename]);
return;
};
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions t/distribution.t
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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';
Expand Down

0 comments on commit ba65ee1

Please sign in to comment.