Package: sa-learn-cyrus Version: 0.3.2-1 Severity: wishlist Tags: patch -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
- -- System Information: Debian Release: lenny/sid APT prefers testing-proposed-updates APT policy: (500, 'testing-proposed-updates'), (500, 'testing') Architecture: i386 (i686) Kernel: Linux 2.6.26-1-686 (SMP w/1 CPU core) Locale: LANG=C, LC_CTYPE=pt_PT.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash The script doesn't deal well with SpamAssassin when this one is configured to store AWL and Bayesian rules in SQL containers. Attached is a patch with some minor changes to make it work without complaints. The main changes are that it won't die if 'bayes_path' isn't defined and it will pass 'sa:user' on the '--username=' parameter to 'sa-learn', which makes 'sa:user' have a different meaning with SQL than with BDB. A reorder of the parameters passed to 'sa-learn' was also done. It may benefit with better error checking, especially if 'bayes_path' isn't defined but SQL isn't configured as the storage for SpamAssassin, and the dual meaning of 'sa:user' should be documented in the configuration file or a new option should be defined to allow loading AWL and Bayesian rules to a single user ('amavis' should be the default) on the SQL database. Also some pointers to the configuration of SpamAssassin for SQL would ease the usage of this package in those circunstances, for instance a reference to </usr/share/doc/spamassassin/sql/README*>. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkkNbkEACgkQCXRGvVwdwgXQmACfdrLuN25LxxTIQTQEp0G8urp5 6IIAnjimTDFtQEpBIwEtC2+8bUCGBva5 =0B82 -----END PGP SIGNATURE-----
--- /usr/sbin/sa-learn-cyrus 2008-04-28 10:26:42.000000000 +0100 +++ /usr/local/sbin/sa-learn-cyrus 2008-11-02 06:45:12.000000000 +0000 @@ -241,7 +241,7 @@ create_lock_file(\%conf); # read SA configuraion -read_sa_config(\%conf) or bye('ex_SANotFound', "Check your configuration!"); +read_sa_config(\%conf); my %mailboxes = find_mailboxes(\%conf); unless (keys %mailboxes) { @@ -274,11 +274,12 @@ my @args; my ($tmp, $tmp_file) = new_temp_file(\%conf); $args[0] = $conf{'sa:learn_cmd'}; - $args[0] .= " --prefspath=$conf{'sa:prefs_file'}"; + $args[0] .= " --debug" if $conf{'sa:debug'} =~ /^[yY]/; $args[0] .= " --siteconfigpath=$conf{'sa:site_config_path'}"; + $args[0] .= " --prefspath=$conf{'sa:prefs_file'}"; + $args[0] .= " --username=$conf{'sa:user'}"; $args[0] .= ' --' . $learn; $args[0] .= " --dir $learn_path"; - $args[0] .= " -D" if $conf{'sa:debug'} =~ /^[yY]/; $args[0] .= " 1>$tmp_file"; $args[0] .= ' 2>&1'; @@ -332,7 +333,7 @@ log_msg('error', " Purging learned $learn mails using command '@args' failed: $?") unless $result == 0 ; } } else { - log_msg('error', " Learnig $learn using command '@args' failed: $?"); + log_msg('error', " Learning $learn using command '@args' failed: $?"); } } else { @@ -616,8 +617,9 @@ } } close(SAC); - log_msg('error', "'bayes_path' not found in '$conf_file'"); - return undef; + log_msg('warn', "'bayes_path' not found in '$conf_file'") if $OPT{'verbose'} > 0; + $conf->{'sa:bayes_path'} = ''; + return 0; } #---------------------------------------------------------------