"unmatched" test in nested rules does not behave as documented

Bug #1081063 reported by Steve Dodd
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
fdm (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

I have been trying to use the "unmatched" test in a nested rule as follows:

action "digest" {
        add-to-cache $digdb key "%1"
        action "inbox"
}

match "^List-.*wbf3digest" in headers and "^Message-ID:.*<(.*)>" in headers {
        match not in-cache $digdb key "%1" action "digest"
        match unmatched action drop
}

(The idea being to deliver only the first copy of a message from a particular list to the inbox.)

The man page says:

"The inner rules will not be evaluated unless the outer one matches. Rules may be multiply nested. Note that the outer rule does not count as a match for the purposes of the matched and unmatched conditions."

However, looking at the source in mail-state.c:

...
        /* If the result was false, skip to find the next rule. */
        if (!mctx->result)
                goto next_rule;
        mctx->matched = 1;
        log_debug2("%s: matched to rule %u", a->name, mctx->rule->idx);

        /*
         * If this rule is stop, mark the context so when we get back after
         * delivery we know to stop.
         */
        if (mctx->rule->stop)
                mctx->done = 1;

        /* Handle nested rules. */
        if (!TAILQ_EMPTY(&mctx->rule->rules)) {
                log_debug2("%s: entering nested rules", a->name);
...

The "mctx->matched=1" line marks the message as matched when the outer rule matches, and it is not obviously cleared anywhere, contradicting the documentation..

ProblemType: Bug
DistroRelease: Ubuntu 10.04
Package: fdm 1.6-2
ProcVersionSignature: Ubuntu 2.6.32-45.99-generic 2.6.32.60+drm33.26
Uname: Linux 2.6.32-45-generic i686
Architecture: i386
Date: Tue Nov 20 11:01:28 2012
InstallationMedia: Ubuntu 10.04 LTS "Lucid Lynx" - Release i386 (20100427.1)
ProcEnviron:
 PATH=(custom, user)
 LANG=en_GB.utf8
 SHELL=/bin/bash
SourcePackage: fdm

Revision history for this message
Steve Dodd (anarchetic) wrote :
Revision history for this message
Steve Dodd (anarchetic) wrote :
Revision history for this message
dino99 (9d9) wrote :

That version is no more supported; and backport is not expected as its not a 'security' problem

Changed in fdm (Ubuntu):
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.