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...@bugzilla.spamassassin.org on 2009/07/21 19:12:41 UTC

[Bug 6162] New: Template TAGS don't allow underscores

https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6162

           Summary: Template TAGS don't allow underscores
           Product: Spamassassin
           Version: 3.2.5
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: trivial
          Priority: P5
         Component: Libraries
        AssignedTo: dev@spamassassin.apache.org
        ReportedBy: guenther@rudersport.de


$pms->set_tag ('TAG_WITH_UNDERSCORE', 'value');

does return the actual value, suggesting the tag indeed has been defined, as
per M::SA::PerMsgStatus set_tag() documentation, since the returned value is
not undef.

Using a a template with underscores however, is not expanded to the value, but
used literally.

  add_header all  Foo  _TAG_WITH_UNDERSCORES_

results in the following header in the mail.

  X-Spam-Foo: _TAG_WITH_UNDERSCORES_


$pms->{tag_data}->{TAG_WITH_UNDERSCORES} does hold the correct 'value'. And the
winner is...

Somewhere between _process_header(), _replace_tags() and _get_tag(), it seems.
After quite a long hunt, I believe I finally got the little bugger.

PerMsgStatus _replace_tags(), who came up with *that* wonderful line of code?

  $text =~ s{(_(\w+?)(?:\((.*?)\))?_)}{

The fact that RE is not anchored, but the $2 match is not greedy, results in
the RE missing TAG_WITH_UNDERSCORE. Did not test this, though, because...

Any fix, if any, needs to carefully consider bug 4793.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.