l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
November 4: Social gathering
Next Installfest:
TBD
Latest News:
Oct. 24: LUGOD election season has begun!
Page last updated:
2009 Aug 12 13:52

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] Net::FTP - filesize difference
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] Net::FTP - filesize difference



On Tue, 2009-08-11 at 17:40 -0400, Peter Jay Salzman wrote:
> Remote site:
> 
>    150 Here comes the directory listing.
>    -rw-r--r--    1 504      507      204942095 Aug 07 19:58 bvd.zip
>    drwxrwxrwx    2 504      0           16384 Aug 05 16:00 lost+found
>    226 Directory send OK.
> 
> 
> My code:
> 
>    sub downloadFile()
>    {
>       use vars qw( %props );
> 
>       my $ftp = Net::FTP->new( $props->{'ftp.hostname'}, Debug => DEBUG )
>          or die "Cannot connect to some.host.name: $@";
>       $ftp->binary();
> 
>       $ftp->login( $props->{'ftp.username'}, $props->{'ftp.password'} )
>          or die "Cannot login ", $ftp->message;
>       $ftp->get( $props->{'ftp.filename'} )
>          or die "get failed ", $ftp->message;
> 
>       $ftp->quit;
>    }
> 
> 
> The problem:
> 
>    The downloaded file appears to be either truncated or corrupted.

Which one is it? Truncated or corrupted?

To test this:

SMALLERFILESIZE=204939227
TAILLENGTH=512
xxd -s +$(( $SMALLERFILESIZE - $TAILLENGTH )) -l $TAILLENGTH \
  bvd.zip.byPerl
xxd -s +$(( $SMALLERFILESIZE - $TAILLENGTH )) -l $TAILLENGTH \
  bvd.zip.byhand

If they're the same then the odds are incredibly high that it's
truncation.
If they're different, then there's definitely other corruption as well.

(You could also get a good idea how much corrpution there is by looking
at the size of an xdelta between the two files.)

--Ken
_______________________________________________
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech



LinkedIn
LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
facebook
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
O'Reilly and Associates
For numerous book donations.