Bug 2354 - header options should be more backward compatible
Summary: header options should be more backward compatible
Status: RESOLVED FIXED
Alias: None
Product: Spamassassin
Classification: Unclassified
Component: Libraries (show other bugs)
Version: SVN Trunk (Latest Devel Version)
Hardware: Other other
: P3 normal
Target Milestone: 2.60
Assignee: Daniel Quinlan
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-08-24 20:34 UTC by Theo Van Dinter
Modified: 2003-08-26 10:27 UTC (History)
1 user (show)



Attachment Type Modified Status Actions Submitter/CLA Status
first part of proposed fix patch None Daniel Quinlan [HasCLA]
first part of proposed fix patch None Daniel Quinlan [HasCLA]
complete fix patch None Daniel Quinlan [HasCLA]

Note You need to log in before you can comment on or make changes to this bug.
Description Theo Van Dinter 2003-08-24 20:34:51 UTC
Since we removed the verbose report header, use_terse_report now just toggles whether a X-
Spam-Report header should be added at all.

So I think we should rename it (and rewrite the docs) to be more meaningful.  I was thinking 
"report_header", but that'll probably confuse people with the old report_header option.  Perhaps 
"add_header_report" or "header_report"?
Comment 1 Theo Van Dinter 2003-08-24 20:36:25 UTC
aiming at 2.60
Comment 2 Malte S. Stretz 2003-08-25 01:55:43 UTC
Hmmm... we already have "always_add_report" so I'd merge those two to 
  add_report_header {0 | 1 | 2} 
where 
  0 = never 
  1 = spam only 
  2 = always 
(and make the old ones still work to annoy the updating users as less as 
possible) 
Comment 3 Theo Van Dinter 2003-08-25 05:02:32 UTC
Subject: Re:  Rename "use_terse_report" to be more meaningful?

On Mon, Aug 25, 2003 at 02:01:45AM -0700, bugzilla-daemon@bugzilla.spamassassin.org wrote:
> Hmmm... we already have "always_add_report" so I'd merge those two to 
>   add_report_header {0 | 1 | 2} 
> where 
>   0 = never 
>   1 = spam only 
>   2 = always 
> (and make the old ones still work to annoy the updating users as less as 
> possible) 

Well, I like the idea of merging the two together, but there would
unfortunately need to be 4 different options:

0 = never (Default)
1 = ham only
2 = spam only
3 = always

and "use_terse_report" would be an alias for "always_add_report 2".
The code would also have to deal with having both always_add_report
and use_terse_report.  Something like:

if /always_add_report/: $always_add_report = $_;
if /use_terse_report/: {
	if ( $always_add_report ) {
		$always_add_report = 3 if ( $always_add_report == 1 );
	}
	else {
		$always_add_report = 2;
	}
}

Since both use_terse_report and always_add_report are both deprecated
in 2.60, it's not a big deal imho.

Thoughts?

Comment 4 Justin Mason 2003-08-25 10:17:57 UTC
I like that.  Keeping backwards compat IMO is key, as I don't think we should
"break" the report-tweaking config settings again, as we've been churning these
on pretty much every major release AFAICS.
Comment 5 Malte S. Stretz 2003-08-25 14:58:38 UTC
  0 = never (Default) 
  1 = spam only   
  2 = ham only 
  3 = always 
is better I think; normally if you go and switch this option on, you want to 
do it on spam. So our "standard" true value 1 should equal "spam". 
 
The nice thing is that those are bitmasks. So the code could look like this: 
  $add_report_header = 0 
  foreach line do 
    if /add_report_header/: $add_report_header  = $_ 
    if /always_add_report/: $add_report_header  = 3 
    if /use_terse_report/:  $add_report_header |= 1 
  end for 
 
Comment 6 Daniel Quinlan 2003-08-25 15:19:31 UTC
Created attachment 1269 [details]
first part of proposed fix

Okay, this patch restores backward compatibility with 2.5x for use_terse_report

and always_add_report.	It also adds a _LONGREPORT_ header symbol which someone

still needs to code up.
Comment 7 Justin Mason 2003-08-25 16:23:18 UTC
+.5: missing 1 thing, the suggested replacement for always_add_report should use
_LONGREPORT_.
Comment 8 Daniel Quinlan 2003-08-25 22:11:33 UTC
Created attachment 1279 [details]
first part of proposed fix

Still missing LONGREPORT, but it will at least work until someone fixes it,
enough to +1 for now?
Comment 9 Daniel Quinlan 2003-08-26 00:59:46 UTC
Created attachment 1280 [details]
complete fix

This patch fixes the current problems with 2.60-rc2:

1. various documentation improvements and corrections
2. always_add_headers is made backward-compatible with 2.5x by moving the
   defaults code into two functions (one is needed for "always_add_headers 1")
3. always_add_report is made backward-compatible with 2.5x
4. use_terse_report is made to do nothing (the current code behaves in a very
   unexpected fashion) and is deprecated
5. X-Spam-Report: is disabled if report_safe is enabled for
   backward-compatibility with 2.5x
6. make X-Spam-Report: headers less ugly

Nobody has even fixed the terse report format to look nice, so I see zero
point in supporting two formats for header reports (terse and verbose).
Header reports have also been less important since 2.50 added report_safe so
reports could be added to the body without destroying the original message.

However, since it's possible to provide backward-compatibility with almost
everything else, I think we should make a reasonable effort.
Comment 10 Daniel Quinlan 2003-08-26 01:01:49 UTC
diffstat:

 lib/Mail/SpamAssassin/Conf.pm         |  100 ++++++++++++++++------------------
 lib/Mail/SpamAssassin/PerMsgStatus.pm |    6 +-
 rules/10_misc.cf                      |   12 ++--
 3 files changed, 59 insertions(+), 59 deletions(-)

ah, yes :-)
Comment 11 Daniel Quinlan 2003-08-26 01:02:19 UTC
assigning bug
Comment 12 Malte S. Stretz 2003-08-26 01:25:09 UTC
adding CC ;) 
Comment 13 Malte S. Stretz 2003-08-26 01:52:17 UTC
+1 1280  
 
Some non-show-stopping issues: 
* I don't like what always_add_report does compared to its semantic but as its 
deprecated renaming it isnt worth it (and it behaves like 2.5x did). 
* If somebody wants both the Report header and report_safe but happens to 
specify the add_header before the report_safe, his header will be removed 
again. Could be worked around but I don't think its worth it -- we can fix it 
if somebody complains ;-) 
Comment 14 Justin Mason 2003-08-26 12:11:10 UTC
+1 1280.

Does anyone really want _LONGREPORT_?  Simon, you reading?
Comment 15 Daniel Quinlan 2003-08-26 12:53:19 UTC
committed 1280
Comment 16 Justin Mason 2003-08-26 18:27:37 UTC
OK, we've decided not to support a long report in the headers for rc3 to reduce
the support required for 2 header report formats.  If anyone wants it in 2.60
release, please speak up ASAP!