Bug 5647 - spamcop reports truncation differennt than at spamcop.net
Summary: spamcop reports truncation differennt than at spamcop.net
Status: RESOLVED INVALID
Alias: None
Product: Spamassassin
Classification: Unclassified
Component: Plugins (show other bugs)
Version: 3.2.1
Hardware: Other other
: P5 normal
Target Milestone: Undefined
Assignee: SpamAssassin Developer Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-14 01:13 UTC by Andrzej Filip
Modified: 2011-11-07 19:07 UTC (History)
3 users (show)



Attachment Type Modified Status Actions Submitter/CLA Status

Note You need to log in before you can comment on or make changes to this bug.
Description Andrzej Filip 2007-09-14 01:13:04 UTC
1) SC javascript truncates after 50*1000 Bytes, SA trcuncates after 50*1024 Bytes
2) SC check that appended "truncated" message will not cross the above limit

Possible fix:

if (length($original) > $self->{main}->{conf}->{spamcop_max_report_size} * 1000) {
    my $msg = "\n[truncated by SpamAssassin]\n";
    substr($original, ($self->{main}->{conf}->{spamcop_max_report_size} * 1000 -
length($msg))) =
      $msg;
  }
Comment 1 D. Stussy 2011-11-06 21:08:34 UTC
What does SC's documentation say?  I couldn't find anything that addresses truncation, but if it says 50k vs. 50,000 bytes, I would oppose this change.
Comment 2 anfi 2011-11-07 06:25:08 UTC
AFAIR SC Documentation says 50KB without specifying iso(1000) or binary(1024) Kilos.
  http://www.spamcop.net/fom-serve/cache/166.html
  How do I submit spam via email?
  The maximum size for the overall submission must not exceed 50 KB.
The java script code conducting before submission size checks uses 50000 size limit.
  http://www.spamcop.net/
    <p><form method="post" action="/sc" name="submitspam"
    onsubmit="return formval(50000);
  http://www.spamcop.net/js/script.js
    function formval(maxlength) {
    var textval = document.forms['submitspam'].spam.value;
    var warning = "\n[truncated by SpamCop]\n";
    if (textval.length > maxlength) {
      ...
Comment 3 Kevin A. McGrail 2011-11-07 14:28:26 UTC
(In reply to comment #2)
> AFAIR SC Documentation says 50KB without specifying iso(1000) or binary(1024)
> Kilos.
>   http://www.spamcop.net/fom-serve/cache/166.html
>   How do I submit spam via email?
>   The maximum size for the overall submission must not exceed 50 KB.
> The java script code conducting before submission size checks uses 50000 size
> limit.
>   http://www.spamcop.net/
>     <p><form method="post" action="/sc" name="submitspam"
>     onsubmit="return formval(50000);
>   http://www.spamcop.net/js/script.js
>     function formval(maxlength) {
>     var textval = document.forms['submitspam'].spam.value;
>     var warning = "\n[truncated by SpamCop]\n";
>     if (textval.length > maxlength) {
>       ...

I'm asking SC to weigh in and make the documentation definitive.
Comment 4 Kevin A. McGrail 2011-11-07 14:56:24 UTC
Per Richard @ SpamCop:

"This is one I actually know the answer to as it has come up before. Anyone who knows Julian knows he is a stickler for protocol.  No need for things like "www", a kilobyte is a kilobyte.

When he wrote the script, 50KB = 50 * 1024"

SA's code is therefore correct and this bug is invalid.  Thanks for double-checking though!
Comment 5 D. Stussy 2011-11-07 18:33:30 UTC
Since it says 50kB, to me that's 50 * 1024; no question.

This "k=1,000" view was introduced by engineers who don't understand and are ignorant of computer science's 50+ year history that a kilobyte has always been 2^10 or 1,024 bytes.

I agree:  Bug is invalid/won't fix.
Comment 6 anfi 2011-11-07 18:44:52 UTC
The bug report has been caused by difference in implementation by
a) java-script code at spamcop.net page (50*1_000)
b) sa spamcop plugin (50*1024)
Comment 7 Kevin A. McGrail 2011-11-07 18:47:03 UTC
(In reply to comment #5)
> Since it says 50kB, to me that's 50 * 1024; no question.
> 
> This "k=1,000" view was introduced by engineers who don't understand and are
> ignorant of computer science's 50+ year history that a kilobyte has always been
> 2^10 or 1,024 bytes.
> 
> I agree:  Bug is invalid/won't fix.


First time I ever saw this was from MARKETING people for HDs so they could define 1000 * 1000 * 1000 as a GB instead of 1024 * 1024 * 1024 so that drive could be advertised at "larger" than actual capacities.

Apparently IEEE is a shill for them as well ;-) (http://en.wikipedia.org/wiki/Gigabyte)

You'll find this type of warning on probably every storage item on the planet (this one is from Western Digital):

As used for storage capacity, one megabyte (MB) = one million bytes, one gigabyte (GB) = one billion bytes, and one terabyte (TB) = one trillion bytes. Total accessible capacity varies depending on operating environment. As used for buffer or cache, one megabyte (MB) = 1,048,576 bytes. As used for transfer rate or interface, megabyte per second (MB/s) = one million bytes per second, megabit per second (Mb/s) = one million bits per second, and gigabit per second (Gb/s) = one billion bits per second. 

In the end, I blame marketing people.  Even if I'm wrong, I still blame marketing on general principle.
Comment 8 Kevin A. McGrail 2011-11-07 18:48:02 UTC
(In reply to comment #6)
> The bug report has been caused by difference in implementation by
> a) java-script code at spamcop.net page (50*1_000)
> b) sa spamcop plugin (50*1024)

We have confirmed with SC that our implementation is correct.  You might email them to fix their javascript to match their API but technically BOTH are correct since BOTH are under 50 * 1024.

As I said, it's a good catch but our implementation appears ok.

regards,
KAM
Comment 9 anfi 2011-11-07 19:07:33 UTC
(In reply to comment #8)
AFAIR I was developing my own spamcop reporter reporting batches of spam (multiple spams in single email/report). I reported it here as a bug based on good practice "when in doubt look at the implementation by THE authors" ;-)