Skip Menu |

This queue is for tickets about the CPANPLUS CPAN distribution.

Report information
The Basics
Id: 20005
Status: resolved
Priority: 0/
Queue: CPANPLUS

People
Owner: Nobody in particular
Requestors: Alexandr
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.061
Fixed in: (no value)



Subject: alexchorny@gmail.com
CPANPLUS does not check size of downloaded module. On disk size of module is 0, but CPANPLUS complains about bad MD5. It is not obvious that module was not downloaded right. I think, in case that size of module does not match to CHECKSUMS info, CPANPLUS should try downloading again at least once. Here is patch to check size and report errors. Done against CPANPLUS 0.70.04. Verified manually. ------- Alexandr Ciornii, http://chorny.net
Subject: size.patch
--- lib/CPANPLUS/Module/Checksums.pm 2006-06-06 14:05:20.000000000 +0300 +++ lib/CPANPLUS/Module/Checksums-SC.pm 2006-06-20 14:37:31.781250000 +0300 @@ -61,7 +61,7 @@ ### checks if the package checksum matches the one ### from the checksums file sub _validate_checksum { - my $self = shift; + my $self = shift; #must be isa CPANPLUS::Module my $conf = $self->parent->configure_object; my %hash = @_; @@ -76,16 +76,35 @@ ### if we can't check it, we must assume it's ok ### return $self->status->checksum_ok(1) unless can_load( modules => { 'Digest::MD5' => '0.0' } ); + #class CPANPLUS::Module::Status is runtime-generated my $file = $self->_get_checksums_file( verbose => $verbose ) or ( error(loc(q[Could not fetch '%1' file], CHECKSUMS)), return ); $self->_check_signature_for_checksum_file( file => $file ) or ( error(loc(q[Could not verify '%1' file], CHECKSUMS)), return ); + #for whole CHECKSUMS file my $href = $self->_parse_checksums_file( file => $file ) or ( error(loc(q[Could not parse '%1' file], CHECKSUMS)), return ); + my $size = $href->{ $self->package }->{'size'}; + + if( defined $size ) { + my $flag = (-s $self->status->fetch == $size); + #$self->status->fetch - the location this distribution was fetched to + $flag + ? msg(loc("Size matches for '%1'", $self->package),$verbose) + : error(loc("Size does not match for '%1': " . + "size is '%2' but should be '%3'", + $self->package, -s $self->status->fetch, $size),$verbose); + return $self->status->checksum_ok(0) if !$flag; + #$self->status->checksum_ok=0 and return 0 + } else { + msg(loc("Size is not known for '%1'",$self->package),$verbose); + } + + my $md5 = $href->{ $self->package }->{'md5'}; unless( defined $md5 ) {
Subject: Sorry for error
From: Alexandr Ciornii <alexchorny [...] gmail.com>
Sorry for errorn in subject - recovered session after a reboot.
On Tue Jun 20 08:01:12 2006, guest wrote: Show quoted text
> CPANPLUS does not check size of downloaded module.
[...] Show quoted text
> Here is patch to check size and report errors. Done against CPANPLUS > 0.70.04. Verified manually.
Thanks for the patch. It's applied with small tweaks as change 12531 and will be in the upcoming 0.072 release. -- Jos