You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by bu...@spamassassin.apache.org on 2022/10/11 13:14:47 UTC

[Bug 8061] New: Fix meta handling for $suppl_attrib->{rule_hits}

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

            Bug ID: 8061
           Summary: Fix meta handling for $suppl_attrib->{rule_hits}
           Product: Spamassassin
           Version: SVN Trunk (Latest Devel Version)
          Hardware: All
                OS: All
            Status: NEW
          Severity: blocker
          Priority: P2
         Component: Libraries
          Assignee: dev@spamassassin.apache.org
          Reporter: apache@hege.li
  Target Milestone: Undefined

Per list discussion, meta handling breaks when amavisd for example supplies
$suppl_attrib->{rule_hits} for Check.pm.

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

[Bug 8061] Fix meta handling for $suppl_attrib->{rule_hits}

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8061

Henrik Krohns <ap...@hege.li> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|Undefined                   |4.0.0
                 CC|                            |apache@hege.li

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

[Bug 8061] Fix meta handling for $suppl_attrib->{rule_hits}

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8061

--- Comment #2 from Henrik Krohns <ap...@hege.li> ---
Note, the above patch does not prevent using "meta __TRUNCATE 0" in the case of
rule_hits API, it will work too.

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

[Bug 8061] Fix meta handling for $suppl_attrib->{rule_hits}

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8061

spamassassin@arcsin.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |spamassassin@arcsin.de

--- Comment #4 from spamassassin@arcsin.de ---
Many thanks, V2 works for us.

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

[Bug 8061] [review] Fix meta handling for $suppl_attrib->{rule_hits}

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8061
Bug 8061 depends on bug 7735, which changed state.

Bug 7735 Summary: Meta rules need to handle missing/unrun dependencies
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7735

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---

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

[Bug 8061] Fix meta handling for $suppl_attrib->{rule_hits}

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8061

Henrik Krohns <ap...@hege.li> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #5842|0                           |1
        is obsolete|                            |

--- Comment #3 from Henrik Krohns <ap...@hege.li> ---
Created attachment 5843
  --> https://bz.apache.org/SpamAssassin/attachment.cgi?id=5843&action=edit
Fix rule_hits, meta declaration V2

This V2 version should fix undefined warnings that result from () returning
undef.

(Note, currently parser accepts all sorts of funky things like "meta FOOBAR
&&", probably should be a bit more strict, but that's for another day and bug)

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

[Bug 8061] [review] Fix meta handling for $suppl_attrib->{rule_hits}

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8061

Henrik Krohns <ap...@hege.li> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #5843|0                           |1
        is obsolete|                            |

--- Comment #7 from Henrik Krohns <ap...@hege.li> ---
Created attachment 5851
  --> https://bz.apache.org/SpamAssassin/attachment.cgi?id=5851&action=edit
Fix rule_hits, meta declaration V3

Mentioned in Bug 7735, added the missing final do_meta_tests to V3 version,
some metas might have left unrun if check_post_dnsbl, check_cleanup hit or
shortcircuit/deadline hit.

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

[Bug 8061] Fix meta handling for $suppl_attrib->{rule_hits}

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8061

--- Comment #1 from Henrik Krohns <ap...@hege.li> ---
Created attachment 5842
  --> https://bz.apache.org/SpamAssassin/attachment.cgi?id=5842&action=edit
Fix rule_hits, meta declaration

So the problem here is any rule that is not pre-declared in ruleset. If such
rule is used in a meta as dependency, it will be considered unrun and the whole
meta will not evaluate - unless of course got_hit() is called by rule_hits API.

A good real-world example is __TRUNCATE rule that amavisd may dynamically hit,
if a message is truncated.

meta FOOBAR  OTHER_RULE && !__TRUNCATE

In that case FOOBAR will never be run if __TRUNCATE does not hit.

In the case of rule_hits API, pre-declaring with "meta __TRUNCATE 0" could work
as rule_hits is processed right at the start of Check.pm, but that does not
work for other types of plugins that may dynamically hit some rule at later
stage.

So I propose a following format to be future-proof:

meta __TRUNCATE ()

That would be considered a declaration, which will not be evaluated immediately
(which other metas without dependencies currently do).

Attached patch for your consideration. May add tests and doc later.

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

[Bug 8061] [review] Fix meta handling for $suppl_attrib->{rule_hits}

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8061
Bug 8061 depends on bug 7735, which changed state.

Bug 7735 Summary: Meta rules need to handle missing/unrun dependencies
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7735

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |FIXED

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

[Bug 8061] [review] Fix meta handling for $suppl_attrib->{rule_hits}

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8061
Bug 8061 depends on bug 7735, which changed state.

Bug 7735 Summary: Meta rules need to handle missing/unrun dependencies
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7735

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |FIXED

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

[Bug 8061] [review] Fix meta handling for $suppl_attrib->{rule_hits}

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8061

Henrik Krohns <ap...@hege.li> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Fix meta handling for       |[review] Fix meta handling
                   |$suppl_attrib->{rule_hits}  |for
                   |                            |$suppl_attrib->{rule_hits}

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

[Bug 8061] Fix meta handling for $suppl_attrib->{rule_hits}

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8061

Henrik Krohns <ap...@hege.li> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |7735


Referenced Bugs:

https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7735
[Bug 7735] Meta rules need to handle missing/unrun dependencies
-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 8061] [review] Fix meta handling for $suppl_attrib->{rule_hits}

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8061

--- Comment #6 from Henrik Krohns <ap...@hege.li> ---
One more vote required.

The whole $suppl_attrib API is very vaguely documented, so I'm not sure how to
even document this. The "meta FOOBAR ()" stanza would only be needed for
extremely rare users using amavisd with custom code plugins, giving rule_hits
and depending on them in metas. So if someone wants this documented, feel free
to contrib, but otherwise it'll stay "for those who know".

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

[Bug 8061] [review] Fix meta handling for $suppl_attrib->{rule_hits}

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8061

Henrik Krohns <ap...@hege.li> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #11 from Henrik Krohns <ap...@hege.li> ---
Sending        lib/Mail/SpamAssassin/Conf/Parser.pm
Sending        lib/Mail/SpamAssassin/Plugin/Check.pm
Transmitting file data ..done
Committing transaction...
Committed revision 1904797.

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

[Bug 8061] [review] Fix meta handling for $suppl_attrib->{rule_hits}

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8061
Bug 8061 depends on bug 7735, which changed state.

Bug 7735 Summary: Meta rules need to handle missing/unrun dependencies
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7735

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |FIXED

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

[Bug 8061] [review] Fix meta handling for $suppl_attrib->{rule_hits}

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8061
Bug 8061 depends on bug 7735, which changed state.

Bug 7735 Summary: Meta rules need to handle missing/unrun dependencies
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7735

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---

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

[Bug 8061] [review] Fix meta handling for $suppl_attrib->{rule_hits}

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8061

Bill Cole <bi...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |billcole@apache.org

--- Comment #9 from Bill Cole <bi...@apache.org> ---
(In reply to Henrik Krohns from comment #8)
> Created attachment 5852 [details]
> Fix rule_hits, meta declaration V4
> 
> Patch V4
> 
> Also fix logging of unrun rules (per Bug 7735 comment 56)

+1 to commit.

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

[Bug 8061] [review] Fix meta handling for $suppl_attrib->{rule_hits}

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8061

Giovanni Bechis <gi...@paclan.it> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |giovanni@paclan.it

--- Comment #10 from Giovanni Bechis <gi...@paclan.it> ---
+1 to commit latest patch

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

[Bug 8061] Fix meta handling for $suppl_attrib->{rule_hits}

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8061

Kevin A. McGrail <km...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kmcgrail@apache.org

--- Comment #5 from Kevin A. McGrail <km...@apache.org> ---
+1 from me

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

[Bug 8061] [review] Fix meta handling for $suppl_attrib->{rule_hits}

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8061
Bug 8061 depends on bug 7735, which changed state.

Bug 7735 Summary: Meta rules need to handle missing/unrun dependencies
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7735

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---

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

[Bug 8061] [review] Fix meta handling for $suppl_attrib->{rule_hits}

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8061

Henrik Krohns <ap...@hege.li> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #5851|0                           |1
        is obsolete|                            |

--- Comment #8 from Henrik Krohns <ap...@hege.li> ---
Created attachment 5852
  --> https://bz.apache.org/SpamAssassin/attachment.cgi?id=5852&action=edit
Fix rule_hits, meta declaration V4

Patch V4

Also fix logging of unrun rules (per Bug 7735 comment 56)

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