Skip to content
Snippets Groups Projects
Commit 88d1b20d authored by Andreas Romeyke's avatar Andreas Romeyke
Browse files

- added sysseek check to end, to detect if there is an GPFS problem…

parent 617c8934
Branches
No related tags found
No related merge requests found
...@@ -30,6 +30,7 @@ use Getopt::Long; ...@@ -30,6 +30,7 @@ use Getopt::Long;
use constant DEBUG => 0; # no debug use constant DEBUG => 0; # no debug
use Pod::Usage; use Pod::Usage;
use IO::Handle; use IO::Handle;
use Fcntl qw(SEEK_END SEEK_SET);
STDOUT->autoflush(1); STDOUT->autoflush(1);
# guarantee, that output will be UTF8 # guarantee, that output will be UTF8
binmode(STDOUT, ":encoding(UTF-8)"); binmode(STDOUT, ":encoding(UTF-8)");
...@@ -236,6 +237,17 @@ sub check_file_size($$) { ...@@ -236,6 +237,17 @@ sub check_file_size($$) {
return $result; return $result;
} }
sub check_file_seekable($$) {
my $fileobj = shift;
my $result = shift;
my $fh = path($fileobj->{file_mounted})->openr_raw();
$result->{seekable} = sysseek( $fh, 0, SEEK_END );
if (!$result->{seekable}) {
add_error($fileobj, $result, "is not seekable, $!");
}
return $result;
}
# check if referenced file has correct checksum for given algorithm # check if referenced file has correct checksum for given algorithm
sub check_file_fixity($$$) { sub check_file_fixity($$$) {
my $fileobj = shift; my $fileobj = shift;
...@@ -322,14 +334,20 @@ if (defined $search_dir && -d "$search_dir") { ...@@ -322,14 +334,20 @@ if (defined $search_dir && -d "$search_dir") {
my $result; my $result;
$result->{errors} = 0; $result->{errors} = 0;
$result = check_if_file_exist($fileobj, $result); $result = check_if_file_exist($fileobj, $result);
if ($result->{exist}) { # only if file exists, do additional checks if ($result->{exist}) {
# only if file exists, do additional checks
$result = check_file_size($fileobj, $result); $result = check_file_size($fileobj, $result);
if ($result->{size}) {
$result = check_file_seekable($fileobj, $result);
if ($result->{seekable}) {
foreach my $fixity_algorithm (@algorithms) { foreach my $fixity_algorithm (@algorithms) {
if ($fileobj->{fixity}->{$fixity_algorithm}) { if ($fileobj->{fixity}->{$fixity_algorithm}) {
$result = check_file_fixity($fileobj, $result, $fixity_algorithm); $result = check_file_fixity($fileobj, $result, $fixity_algorithm);
} }
} }
} }
}
}
if ($result->{errors} > 0) { if ($result->{errors} > 0) {
path($report_file)->append_utf8("IE $_ with following errors:\n"); path($report_file)->append_utf8("IE $_ with following errors:\n");
foreach my $errors (@{ $result->{error_description} }) { foreach my $errors (@{ $result->{error_description} }) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment