Mail::ClamAV [was: Re: SAVI-Perl/Sophos on RedHat Enterprise 4]

David Lee t.d.lee at DURHAM.AC.UK
Fri Mar 4 17:08:10 GMT 2005


On Fri, 4 Mar 2005, Randal, Phil wrote:

> Installing Mail::ClamAV 0.14 fails on Fedora Core 1 too.  Haven't the
> time to look at it right now, alas:
>
> Running make test
> PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e"
> "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
> t/Mail-ClamAV....ok 5/13#     Failed test (t/Mail-ClamAV.t at line 82)
> t/Mail-ClamAV....NOK 6#     Failed test (t/Mail-ClamAV.t at line 84)
> t/Mail-ClamAV....NOK 7#     Failed test (t/Mail-ClamAV.t at line 87)
> t/Mail-ClamAV....NOK 8#     Failed test (t/Mail-ClamAV.t at line 90)
> t/Mail-ClamAV....ok 10/13#     Failed test (t/Mail-ClamAV.t at line 100)
> t/Mail-ClamAV....NOK 11#     Failed test (t/Mail-ClamAV.t at line 101)
> t/Mail-ClamAV....NOK 12#     Failed test (t/Mail-ClamAV.t at line 102)
> t/Mail-ClamAV....NOK 13# Looks like you failed 7 tests of 13.
> t/Mail-ClamAV....dubious
>        Test returned status 7 (wstat 1792, 0x700)
> [...]

We too have this problem (FC3, also ancient RH 7.3).  Rick Cooper has
found that this seems to be an error within its tests (i.e. Mail::ClamAV
itself is OK).  From an amended version of its "t/Mail-ClamAV.t" that he
gave me, I derived the following patch.

All the hard work was done by Rick, not me.  So any credit should go to
him.

I intend to report this to the author of Mail::ClamAV.  But could folk
here (MailScanner community) who have encountered the problem quickly
check that the patch fixes it?  If building from CPAN, probably something
like:
    cd .cpan/build/Mail-ClamAV-0.14
    make test       ### should fail as above
    <apply patch>
    make test       ### should succeed

<geek>
The main purpose of the patch is to add the "|CL_SCAN_ARCHIVE()".

There is a separate aspect: the reduction from 13 tests to 11, because of
removing the "scanbuff" tests near the end, as "scanbuff" is apparently
now deprecated .
</geek>

====================== snip =====================
--- t/Mail-ClamAV.t.orig        2005-02-25 19:00:15.000000000 +0000
+++ t/Mail-ClamAV.t     2005-03-04 16:06:36.293652780 +0000
@@ -4,7 +4,7 @@

  #########################

-use Test::More tests => 13;
+use Test::More tests => 11;
  use strict;
  BEGIN { use_ok('Mail::ClamAV') };

@@ -78,26 +78,20 @@
  ok(($c->maxfilesize == (1024 * 1028 * 20)), 'Set/Get maxfilesize');

  my $f = "t/virus.eml";
-my $status = $c->scan($f, CL_SCAN_MAIL());
+my $status = $c->scan($f, CL_SCAN_MAIL()|CL_SCAN_ARCHIVE());
  ok("$status" eq "Eicar-Test-Signature", 'Scan File');
  open my $fh, "<", $f;
-ok($c->scan($fh, CL_SCAN_MAIL())->virus, 'Scan FileHandle');
+ok($c->scan($fh, CL_SCAN_MAIL()|CL_SCAN_ARCHIVE())->virus, 'Scan FileHandle');

-$status = $c->scan($f, CL_SCAN_MAIL());
+$status = $c->scan($f, CL_SCAN_MAIL()|CL_SCAN_ARCHIVE());
  ok("$status" eq "Eicar-Test-Signature", 'Scan File overload');
  seek $fh, 0, 0;
-$status = $c->scan($fh, CL_SCAN_MAIL());
+$status = $c->scan($fh, CL_SCAN_MAIL()|CL_SCAN_ARCHIVE());
  ok("$status" eq "Eicar-Test-Signature", 'Scan FileHandle overload');

-eval { $status = $c->scan($f.substr($0, 0, 0), CL_SCAN_MAIL()) };
+eval { $status = $c->scan($f.substr($0, 0, 0),
+CL_SCAN_MAIL()|CL_SCAN_ARCHIVE()) };
  ok($@ and $@ =~ /tainted/, 'Scan tainted croaks');

-
-open $fh, "<", "t/eicarcom2.zip";
-my $msg = do { local $/; <$fh> };
-$msg = $1 if $msg =~ /(.*)/s;
-$status = $c->scanbuff($msg);
-ok("$status" eq "Eicar-Test-Signature", 'Scan Buffer');
-ok($status->virus == 1, "Scan Buffer virus status");
  ok((0 + $status) == 1, "Overload status");

====================== snip =====================


--

:  David Lee                                I.T. Service          :
:  Senior Systems Programmer                Computer Centre       :
:                                           University of Durham  :
:  http://www.dur.ac.uk/t.d.lee/            South Road            :
:                                           Durham                :
:  Phone: +44 191 334 2752                  U.K.                  :

------------------------ MailScanner list ------------------------
To unsubscribe, email jiscmail at jiscmail.ac.uk with the words:
'leave mailscanner' in the body of the email.
Before posting, read the MAQ (http://www.mailscanner.biz/maq/) and
the archives (http://www.jiscmail.ac.uk/lists/mailscanner.html).

Support MailScanner development - buy the book off the website!




More information about the MailScanner mailing list