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 2011/11/05 11:09:50 UTC

[Bug 6692] New: add_header - "template tag" conditional

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

             Bug #: 6692
           Summary: add_header - "template tag" conditional
           Product: Spamassassin
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: spamassassin
        AssignedTo: dev@spamassassin.apache.org
        ReportedBy: anfi@onet.eu
    Classification: Unclassified


It would be helpful to extend add header to allow adding header only when
template tag is non empty.
e.g.
 add_header_cond all Languages _LANGUAGES_ _LANGUAGES_
instead of
 add_header all Languages _LANGUAGES_
to avoid adding empty X-Spam-Languages header.

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

[Bug 6692] add_header - "template tag" conditional

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6692

--- Comment #5 from anfi <an...@onet.eu> 2011-11-06 00:38:05 UTC ---
Case 3a and 3b)
think about add_header_cond all _FOO_ text1 _FOO_ text2 _FOO_1_ text3 _FOO_1_

I suggested syntaxt intendedfor "set of tags" where  _FOO_1_ and i_FOO_2_ are
expected to be set only when _FOO_ is set

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

[Bug 6692] add_header - "template tag" conditional

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6692

anfi <an...@onet.eu> changed:

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

--- Comment #2 from anfi <an...@onet.eu> 2011-11-05 23:14:41 UTC ---
6092 is about changing behavior of add_header unconditionally.
6692 is about providing user with option to change behavior in SOME cases by
supporting new add_header_cond.

It is about leaving user the choice.

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

[Bug 6692] add_header - "template tag" conditional

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6692

Karsten Bräckelmann <gu...@rudersport.de> changed:

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

--- Comment #1 from Karsten Bräckelmann <gu...@rudersport.de> 2011-11-05 21:00:16 UTC ---
Duplicate of bug 6092 and bug 6208.

In particular, bug 6092 comment 3 (difference between empty and non-existent
header) and bug 6208 comment 1 are noteworthy.

*** This bug has been marked as a duplicate of bug 6092 ***

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

[Bug 6692] add_header - "template tag" conditional

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6692

anfi <an...@onet.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |anfi@onet.eu

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

[Bug 6692] add_header - "template tag" conditional

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6692

--- Comment #4 from Karsten Bräckelmann <gu...@rudersport.de> 2011-11-06 00:14:06 UTC ---
(In reply to comment #3)
>     add_header_cond all _FOO_ _BAR_

Ah, the "languages" repetition in the original example! Forgot the header name,
should have been

      add_header_cond all HeaderName _FOO_ _BAR_

Same with (b) of course.


> An alternative would be, to implement an option to remove headers if empty.
> 
>   add_header  all Languages _LANGUAGES_
>   hack_header all Languages
> 
> The first option is the traditional, unconditional add_header, or possibly the
> default as with the Level header. The second marks the header for suppression,
> if empty. This also works out of the box with stock headers, without resorting
> to the remove_header option.

And also can be used to specify a different type for conditional removal, if
desired, like "ham" or "spam" even if the stock header is added to "all".

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

[Bug 6692] add_header - "template tag" conditional

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6692

--- Comment #6 from Karsten Bräckelmann <gu...@rudersport.de> 2011-11-06 00:48:32 UTC ---
(In reply to comment #5)
> Case 3a and 3b)

I don't understand where you're heading at. Please clarify that use case with
correct, matching Template Tags and a more verbose explanation.

Anyway, that most likely is too complicated, and hard to parse, if there may be
spaces and quoted strings. With the add_header syntax as-is, the Template Tags
are nothing else than a string (without spaces, so no quotes required).
Template Tags may, however, be part of a quoted string...

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

[Bug 6692] add_header - "template tag" conditional

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6692

--- Comment #3 from Karsten Bräckelmann <gu...@rudersport.de> 2011-11-06 00:03:22 UTC ---
(In reply to comment #2)
> 6092 is about changing behavior of add_header unconditionally.
> 6692 is about providing user with option to change behavior in SOME cases by
> supporting new add_header_cond.

Well then...

So there are two Template Tags in your proposed new option. One being the
conditional to test for emptiness, one being the actual header's value.

This seems slightly redundant, unless specifically intended to also support
weird edge cases:

(a) Adding a header with a value of _BAR_ based on the template tag expansion
    of _FOO_.

    add_header_cond all _FOO_ _BAR_

    In particluar this scenario can result in seriously confusing header's
    added, and even in adding an empty header.

(b) Additionally add static text to the header's value.

    add_header_cond all _FOO_ "This header's value is _FOO_"


Unless one these really is desired, I'd propose to drop the condition and add
the header based on it's value being empty or not.

  add_header_cond all Languages _LANGUAGES_


An alternative would be, to implement an option to remove headers if empty.

  add_header  all Languages _LANGUAGES_
  hack_header all Languages

The first option is the traditional, unconditional add_header, or possibly the
default as with the Level header. The second marks the header for suppression,
if empty. This also works out of the box with stock headers, without resorting
to the remove_header option.

I can offer a hack-ish proof-of-concept implementation (hence the option's
name) for this concept, which I wrote quite a while ago. Probably needs
re-view, though, haven't used it in a while.

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