cyrusimap / cassandane

Other
6 stars 11 forks source link

ClamAV.pm fail in RH EL8 #84

Closed falon closed 4 years ago

falon commented 4 years ago

Hello, if I try to compile Cyrus IMAP 3.0.13 on Red Hat EL8 with clamav-devel 0.102.2-4 this test fails:

There was 1 failure:
1) test_remove_infected(Cassandane::Cyrus::ClamAV)
 Using ClamAV virus scanner
Loaded 6844166 virus signatures.

Mailbox Name                                       Msg UID      Status  Virus Name
----------------------------------------        ----------      ------  --------------------------------------------------
user.cassandane                                          1      UNREAD  Eicar-Signature

Mailbox Name                                       Msg UID      Status  Virus Name
----------------------------------------        ----------      ------  --------------------------------------------------
shared.folder                                            1      UNREAD  Eicar-Signature

2 mailboxes scanned, 2 infected messages removed
 didn't match /(?^:user\.cassandane\s+1\s+UNREAD\s+Eicar-Test-Signature)/ at Cassandane/Cyrus/ClamAV.pm line 150.
        Cassandane::Cyrus::ClamAV::test_remove_infected(Cassandane::Cyrus::ClamAV=HASH(0x55c89ed16198)) called at /usr/share/perl5/vendor_perl/Test/Unit/TestCase.pm line 75
        [...framework calls elided...]

Ouch, the virus name changed! I had to patch ClamAV.pm to pass the test:

--- Cassandane/Cyrus/ClamAV.pm.orig     2018-06-01 06:57:02.000000000 +0200
+++ Cassandane/Cyrus/ClamAV.pm  2020-04-27 14:45:54.085422249 +0200
@@ -147,9 +147,9 @@
        xlog $out;
     }
     # XXX is there a better way than hard coding UID:1 ?
-    $self->assert_matches(qr/user\.cassandane\s+1\s+UNREAD\s+Eicar-Test-Signature/,
+    $self->assert_matches(qr/user\.cassandane\s+1\s+UNREAD\s+Eicar(?:-Test){0,1}-Signature/,
                          $out);
-    $self->assert_matches(qr/shared\.folder\s+1\s+UNREAD\s+Eicar-Test-Signature/,
+    $self->assert_matches(qr/shared\.folder\s+1\s+UNREAD\s+Eicar(?:-Test){0,1}-Signature/,
                          $out);

     # make sure the infected ones were expunged, but the clean ones weren't
elliefm commented 4 years ago

Yeah wow, good catch, nice patch. Thanks :)

elliefm commented 4 years ago

Needed some massaging to apply to current Cassandane, but it's now there as 38b64cb. Thanks!