https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8319

            Bug ID: 8319
           Summary: DMARC policy logging causes exception and test failure
           Product: Spamassassin
           Version: SVN Trunk (Latest Devel Version)
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Plugins
          Assignee: dev@spamassassin.apache.org
          Reporter: andr...@andreasvoegele.com
  Target Milestone: Undefined

Created attachment 6003
  --> https://bz.apache.org/SpamAssassin/attachment.cgi?id=6003&action=edit
Warp $result->published with eval

Mail::SpamAssassin::Plugin::DMARC logs the DMARC policy since February.  But
the result object's policy attribute may be undefined, which causes
$result->published to raise an exception:

    Error: Found anti-pattern: warn = (?^: warn: [...]) at t/all_modules.t line
90.
    Mar  3 06:47:26.111 [45379] dbg: DMARC: using Mail::DMARC::PurePerl for
DMARC checks
    Mar  3 06:47:26.600 [45379] warn: plugin: eval failed: no policy
discovered.
    Did you validate() , or at least fetch_dmarc_record() first? Or inspected
results to
    detect a 'No Results Found' type error? at
../blib/lib/Mail/SpamAssassin/Plugin/DMARC.pm
    line 394.

The most recent Mail::DMARC version sets $result->result to "none" if no policy
was found.  But older versions use "fail".  Thus, I think it's best to wrap
$result->published with eval in lib/Mail/SpamAssassin/Plugin/DMARC.pm.

Current version:
https://github.com/msimerson/mail-dmarc/blob/df107c6784b19b7fcd3a2407fe61a2ca9db1f3ad/lib/Mail/DMARC/PurePerl.pm#L37
Previous version:
https://github.com/msimerson/mail-dmarc/blob/e5301eb43679e89460f1023e28e9c1fa62f74374/lib/Mail/DMARC/PurePerl.pm#L37

Exception thrown by published:
https://github.com/msimerson/mail-dmarc/blob/master/lib/Mail/DMARC/Result.pm#L19

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to