diff --git a/deep_fixitycheck.pl b/deep_fixitycheck.pl index fe69cdb427a17ffcef1c3868e7dd2516c36d5efd..b7089bd99ad0c99d20ddcb81901381b34b2a008f 100644 --- a/deep_fixitycheck.pl +++ b/deep_fixitycheck.pl @@ -33,6 +33,7 @@ use Digest::MD5; use Digest::SHA; use Pod::Usage; use IO::Handle; +use POSIX qw(strftime); use Fcntl qw(SEEK_END SEEK_SET); STDOUT->autoflush(1); # guarantee, that output will be UTF8 @@ -265,17 +266,20 @@ sub check_file_fixities($$) { my $fh = path($fileobj->{file_mounted})->openr(); binmode($fh); my $buffer; + my $block=0; + my $blocksize = 8*1024; # 8kB blocks while (1) { - my $ret = read($fh, $buffer, 128*1024);# 128kB blocks + my $ret = read($fh, $buffer, $blocksize); if (defined $ret) { last if 0 == $ret; # EOF foreach my $fixity_algorithm (keys %digest_mapping) { $digest_mapping{$fixity_algorithm}->add($buffer); } } else { - add_error($fileobj, $result, "read error, $!"); + add_error($fileobj, $result, "read error in block $block (blocksize=$blocksize), $!"); last; } + $block++; } close ($fh); foreach my $fixity_algorithm (keys %digest_mapping) { @@ -367,8 +371,9 @@ if (defined $search_dir && -d "$search_dir") { } } } + if ($result->{errors} > 0) { - my $timestamp = localtime; + my $timestamp = strftime("%Y-%m-%d %H:%M:%S", gmtime(time)); path($report_file)->append_utf8("$timestamp, IE $_ with following errors:\n"); foreach my $errors (@{ $result->{error_description} }) { path($report_file)->append_utf8("\t$errors\n");