Package: spamassassin
Version: 3.2.5-1
Severity: normal
Tags: patch
$ sa-learn -f /dev/stdin < /dev/null
Learned tokens from 1 message(s) (1 message(s) examined)
I call sa-learn in a script, and give it a list of messages that I
know are ham or spam, using -f. Sometimes the list is empty, and to
my surprise sa-learn always reports that it has learned from 1
message.
The problem is that on line 379, sa-learn decides that if its list of
targets is empty, it must be reading a message from stdin. But that's
not true if it's been given an empty list of messages. The attached
patch corrects the error.
Thanks,
Andrew.
-- System Information:
Debian Release: lenny/sid
APT prefers testing
APT policy: (990, 'testing'), (300, 'unstable'), (200, 'stable'), (1,
'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.24 (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1) (ignored: LC_ALL set to
en_US)
Shell: /bin/sh linked to /bin/bash
Versions of packages spamassassin depends on:
ii libdigest-sha1-perl 2.11-2+b1 NIST SHA-1 message digest algorith
ii libhtml-parser-perl 3.56-1+b1 A collection of modules that parse
ii libnet-dns-perl 0.63-2 Perform DNS queries from a Perl sc
ii libsocket6-perl 0.20-1 Perl extensions for IPv6
ii libsys-hostname-long-perl 1.4-2 Figure out the long (fully-qualifi
ii libwww-perl 5.812-1 WWW client/server library for Perl
ii perl 5.10.0-11 Larry Wall's Practical Extraction
ii perl-modules [libarchive-tar- 5.10.0-11 Core Perl modules
Versions of packages spamassassin recommends:
ii gcc 4:4.3.1-1 The GNU C compiler
ii gnupg 1.4.9-2 GNU privacy guard - a free PGP rep
ii libc6-dev 2.7-10 GNU C Library: Development Librari
pn libmail-spf-perl <none> (no description available)
pn libsys-syslog-perl <none> (no description available)
ii make 3.81-5 The GNU version of the "make" util
pn re2c <none> (no description available)
ii spamc 3.2.5-1 Client for SpamAssassin spam filte
-- no debconf information
--- /usr/bin/sa-learn.orig 2008-07-17 05:58:03.000000000 -0400
+++ /usr/bin/sa-learn 2008-07-17 05:58:05.000000000 -0400
@@ -376,7 +376,7 @@
my $tempfile; # will be defined if stdin -> tempfile
push(@targets, @ARGV);
- @targets = ('-') unless @targets;
+ @targets = ('-') unless @targets || $opt{folders};
for(my $elem = 0; $elem <= $#targets; $elem++) {
# ArchiveIterator doesn't really like STDIN, so if "-" is specified