You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jm...@apache.org on 2007/10/08 21:49:43 UTC

svn commit: r582949 - in /spamassassin/trunk: lib/Mail/SpamAssassin/ArchiveIterator.pm masses/mass-check

Author: jm
Date: Mon Oct  8 12:49:43 2007
New Revision: 582949

URL: http://svn.apache.org/viewvc?rev=582949&view=rev
Log:
bug 5669: mass-check should simply ignore 0-length files entirely, by skipping them in ArchiveIterator

Modified:
    spamassassin/trunk/lib/Mail/SpamAssassin/ArchiveIterator.pm
    spamassassin/trunk/masses/mass-check

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/ArchiveIterator.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/ArchiveIterator.pm?rev=582949&r1=582948&r2=582949&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/ArchiveIterator.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/ArchiveIterator.pm Mon Oct  8 12:49:43 2007
@@ -124,6 +124,10 @@
 it's a good idea to set this to 0 if you can, as it imposes a performance
 hit.
 
+=item opt_skip_empty_messages
+
+Set to 1 if you want to skip corrupt, 0-byte messages.  The default is 0.
+
 =item opt_cache
 
 Set to 0 (default) if you don't want to use cached information to help speed
@@ -699,6 +703,9 @@
         $header .= $_;
       }
       close(INPUT);
+
+      return if ($self->{opt_skip_empty_messages} && $header eq '');
+
       $date = Mail::SpamAssassin::Util::receive_date($header);
       if (defined $AICache) {
         $AICache->update($mail, $date);
@@ -708,6 +715,9 @@
     return if !$self->_message_is_useful_by_date($date);
     return if !$self->_scanprob_says_scan();
   }
+  else {
+    return if ($self->{opt_skip_empty_messages} && (-z $mail));
+  }
 
   &{$bkfunc}($self, $date, $class, 'f', $mail);
 
@@ -793,6 +803,7 @@
 	  $where = tell INPUT;
         }
         if ($header) {
+          next if ($self->{opt_skip_empty_messages} && $header eq '');
           $self->_bump_scan_progress();
 	  $info->{$offset} = Mail::SpamAssassin::Util::receive_date($header);
 	}
@@ -895,8 +906,10 @@
 	    $header .= $_;
 	  }
 
-          $self->_bump_scan_progress();
-	  $info->{$offset} = Mail::SpamAssassin::Util::receive_date($header);
+          if (!($self->{opt_skip_empty_messages} && $header eq '')) {
+            $self->_bump_scan_progress();
+            $info->{$offset} = Mail::SpamAssassin::Util::receive_date($header);
+          }
 
 	  # go onto the next message
 	  seek(INPUT, $offset + $size, 0);

Modified: spamassassin/trunk/masses/mass-check
URL: http://svn.apache.org/viewvc/spamassassin/trunk/masses/mass-check?rev=582949&r1=582948&r2=582949&view=diff
==============================================================================
--- spamassassin/trunk/masses/mass-check (original)
+++ spamassassin/trunk/masses/mass-check Mon Oct  8 12:49:43 2007
@@ -349,7 +349,8 @@
 
 my $AIopts = {
 	'opt_all' => $opt_all,
-	};
+        'opt_skip_empty_messages' => 1,
+      };
 
 if (!$opt_client) {
   # Deal with --rewrite