aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Thauvin <nanardon@mandriva.org>2004-12-05 07:13:01 +0000
committerOlivier Thauvin <nanardon@mandriva.org>2004-12-05 07:13:01 +0000
commite13a7b1806e5b9f04def1f67f897bd8695b2e91a (patch)
tree6916399bdb2268767d4af9405f1f1be7f4a79ccd
parent740584c3e5d64c76819992c85ae10d109993c612 (diff)
downloadrpmtools-e13a7b1806e5b9f04def1f67f897bd8695b2e91a.tar
rpmtools-e13a7b1806e5b9f04def1f67f897bd8695b2e91a.tar.gz
rpmtools-e13a7b1806e5b9f04def1f67f897bd8695b2e91a.tar.bz2
rpmtools-e13a7b1806e5b9f04def1f67f897bd8695b2e91a.tar.xz
rpmtools-e13a7b1806e5b9f04def1f67f897bd8695b2e91a.zip
- fix data length to write
- test: use strict ;) then fix it !!
-rw-r--r--packdrakeng.pm4
-rwxr-xr-xt/01packdrakeng.t10
2 files changed, 8 insertions, 6 deletions
diff --git a/packdrakeng.pm b/packdrakeng.pm
index 3db9a9f..1ccb7e6 100644
--- a/packdrakeng.pm
+++ b/packdrakeng.pm
@@ -464,7 +464,7 @@ sub gzip_uncompress {
$read += $l;
if ($read <= $fileinfo->{off}) { next }
- my $bw = $byteswritten + $l > $fileinfo->{size} ? $fileinfo->{size} - $byteswritten : $l;
+ my $bw = $byteswritten + length($out) > $fileinfo->{size} ? $fileinfo->{size} - $byteswritten : length($out);
syswrite($destfh, $out, $bw) == $bw or do {
warn "Can't write data into dest";
return -1;
@@ -476,7 +476,7 @@ sub gzip_uncompress {
}
###################
-# Dubug functions #
+# Debug functions #
###################
# This function extract in $dest the whole bloc containing $file, can be usefull for debugging
diff --git a/t/01packdrakeng.t b/t/01packdrakeng.t
index 27f0527..0273604 100755
--- a/t/01packdrakeng.t
+++ b/t/01packdrakeng.t
@@ -2,6 +2,7 @@
# $Id$
+use strict;
use Test::More tests => 16;
use Digest::MD5;
@@ -16,7 +17,7 @@ sub clean_test_files {
sub create_test_files {
my ($number) = @_;
my %created;
- -d test or mkdir test;
+ -d "test" or mkdir "test";
foreach my $n (1 .. $number||10) {
my $size = int(rand(1024));
# push(@created, "test/$size");
@@ -29,7 +30,8 @@ sub create_test_files {
}
sub create_know_file {
- foreach my $letter (a..z) {
+ my %created;
+ foreach my $letter ('a' .. 'z') {
open(my $h, "> test/$letter");
foreach (1 .. 3456) {
printf $h "%s\n", $letter x 33;
@@ -72,8 +74,8 @@ sub test_packing {
clean_test_files();
ok($pack = packdrakeng->open(%$pack_param), "Re-opening the archive");
- ok($pack->extract(undef, keys(%createdfiles)), "extracting files");
- ok(check_files(%createdfiles), "Checking md5sum for extracted files");
+ ok($pack->extract(undef, keys(%$listfiles)), "extracting files");
+ ok(check_files(%$listfiles), "Checking md5sum for extracted files");
$pack = undef;
}