You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by he...@apache.org on 2022/04/22 06:40:42 UTC
svn commit: r1900137 - in /spamassassin/trunk: sa-learn.raw t/bayesbdb.t t/bayesdbm.t t/bayessql.t
Author: hege
Date: Fri Apr 22 06:40:42 2022
New Revision: 1900137
URL: http://svn.apache.org/viewvc?rev=1900137&view=rev
Log:
Bug 7674 - sa-learn learns all messages as ham even if --spam is specified
Modified:
spamassassin/trunk/sa-learn.raw
spamassassin/trunk/t/bayesbdb.t
spamassassin/trunk/t/bayesdbm.t
spamassassin/trunk/t/bayessql.t
Modified: spamassassin/trunk/sa-learn.raw
URL: http://svn.apache.org/viewvc/spamassassin/trunk/sa-learn.raw?rev=1900137&r1=1900136&r2=1900137&view=diff
==============================================================================
--- spamassassin/trunk/sa-learn.raw (original)
+++ spamassassin/trunk/sa-learn.raw Fri Apr 22 06:40:42 2022
@@ -173,15 +173,14 @@ if ( !defined $isspam
&& !defined $opt{'folders'} )
{
usage( 0,
-"Please select either --spam, --ham, --folders, --forget, --sync, --import,\n--dump, --clear, --backup or --restore"
+ "Please select either --spam, --ham, --folders, --forget, --sync, --import,\n--dump, --clear, --backup or --restore"
);
}
# We need to make sure the journal syncs pre-forget...
if ( defined $forget && $opt{'nosync'} ) {
$opt{'nosync'} = 0;
- warn
-"sa-learn warning: --forget requires read/write access to the database, and is incompatible with --no-sync\n";
+ warn "sa-learn warning: --forget requires read/write access to the database, and is incompatible with --no-sync\n";
}
if ( defined $opt{'old_format'} ) {
@@ -517,10 +516,10 @@ sub killed {
sub target {
my ($target) = @_;
- if (!defined $isspam)
+ if (!defined $isspam && !$forget)
{
usage( 0,
- "Please select either --spam or --ham before the first target"
+ "Please select either --spam or --ham or --forget before the first target"
);
}
my $class = ( $isspam ? "spam" : "ham" );
@@ -626,7 +625,7 @@ Options:
--ham Learn the following messages as ham (non-spam)
--spam Learn the following messages as spam
- --forget Forget a message
+ --forget Forget the following messages
--use-ignores Use bayes_ignore_from and bayes_ignore_to
--sync Synchronize the database and the journal if needed
--force-expire Force a database sync and expiry run
@@ -767,7 +766,8 @@ into the Bayes databases.
=item B<--forget>
-Forget a given message previously learnt.
+Forget the input message(s) in the files following the option as previously
+learnt.
=item B<--dbpath>
Modified: spamassassin/trunk/t/bayesbdb.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/bayesbdb.t?rev=1900137&r1=1900136&r2=1900137&view=diff
==============================================================================
--- spamassassin/trunk/t/bayesbdb.t (original)
+++ spamassassin/trunk/t/bayesbdb.t Fri Apr 22 06:40:42 2022
@@ -16,7 +16,7 @@ plan skip_all => "BerkeleyDB is unavaila
plan skip_all => "BerkeleyDB >= 4.6 is required" unless $BerkeleyDB::db_version >= 4.6;
}
-plan tests => 46;
+plan tests => 48;
tstprefs ("
@@ -175,6 +175,10 @@ $wanted_examined = 3;
ok(salearnrun("--ham --mbox < data/nice.mbox", \&check_examined));
ok_all_patterns();
+$wanted_examined = 3;
+ok(salearnrun("--forget --mbox data/nice.mbox", \&check_examined));
+ok_all_patterns();
+
%patterns = ( 'non-token data: bayes db version' => 'db version' );
ok(salearnrun("--dump magic", \&patterns_run_cb));
ok_all_patterns();
Modified: spamassassin/trunk/t/bayesdbm.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/bayesdbm.t?rev=1900137&r1=1900136&r2=1900137&view=diff
==============================================================================
--- spamassassin/trunk/t/bayesdbm.t (original)
+++ spamassassin/trunk/t/bayesdbm.t Fri Apr 22 06:40:42 2022
@@ -10,7 +10,7 @@ use Test::More;
plan skip_all => "Long running tests disabled" unless conf_bool('run_long_tests');
plan skip_all => "DB_File is unavailable" unless HAS_DB_FILE;
-plan tests => 52;
+plan tests => 54;
tstprefs ("
bayes_learn_to_journal 0
@@ -195,6 +195,10 @@ $wanted_examined = 3;
ok(salearnrun("--ham --mbox < data/nice.mbox", \&check_examined));
ok_all_patterns();
+$wanted_examined = 3;
+ok(salearnrun("--forget --mbox data/nice.mbox", \&check_examined));
+ok_all_patterns();
+
%patterns = ( 'non-token data: bayes db version' => 'db version' );
ok(salearnrun("--dump magic", \&patterns_run_cb));
ok_all_patterns();
Modified: spamassassin/trunk/t/bayessql.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/bayessql.t?rev=1900137&r1=1900136&r2=1900137&view=diff
==============================================================================
--- spamassassin/trunk/t/bayessql.t (original)
+++ spamassassin/trunk/t/bayessql.t Fri Apr 22 06:40:42 2022
@@ -15,8 +15,8 @@ plan skip_all => "DBI is unavailable on
plan skip_all => "Bayes SQL tests are disabled or DBD::SQLite not found" unless (SQLITE || SQL);
my $tests = 0;
-$tests += 57 if (SQLITE);
-$tests += 57 if (SQL);
+$tests += 59 if (SQLITE);
+$tests += 59 if (SQL);
plan tests => $tests;
diag "Note: Failure may be due to an incorrect config.";
@@ -360,6 +360,10 @@ $wanted_examined = 3;
ok(salearnrun("--ham --mbox < data/nice.mbox", \&check_examined));
ok_all_patterns();
+$wanted_examined = 3;
+ok(salearnrun("--forget --mbox data/nice.mbox", \&check_examined));
+ok_all_patterns();
+
%patterns = ( 'non-token data: bayes db version' => 'db version' );
ok(salearnrun("--dump magic", \&patterns_run_cb));
ok_all_patterns();