Bug 4910

Summary: spamc with -E option returns wrong exit code
Product: Spamassassin Reporter: Yan Kuligin <spamassassin-dev>
Component: spamc/spamdAssignee: SpamAssassin Developer Mailing List <dev>
Status: NEW ---    
Severity: normal    
Priority: P5    
Version: 3.0.5   
Target Milestone: Undefined   
Hardware: Other   
OS: Linux   

Description Yan Kuligin 2006-05-26 09:08:16 UTC
spamc man page tells us that -E option means "Filter according to the other
options, but set the process exitcode to 1 if message is spam, 0 if not spam or
processing failure occurs."
But if the failure occurs (e.g. socket specified with -U doesn't exist or spamd
is not running, etc.) spamc -E doesn't returns zero. It returns error code instead.

The following spamc options were used:
-E -u -U -s
-x was NOT used so 'safe fallback' is enabled.

I suppose that spamc -E must return zero if the failure occurs and 'safe
fallback' is enabled.
Comment 1 Rob Janssen 2007-09-09 02:28:55 UTC
Confirmed.  We run a weekly sa-update in a cronjob and when this returns zero a
/etc/rc.d/spamd restart is done.
(the /etc/rc.d/spamd is an init script provided by SuSE.  it does a killproc and
a startproc of /usr/bin/spamd.  this apparently is failing, probably because the
start is done too quickly after the stop)

So, for a few hours there was no spamd running, and spamc -E returned 98 in this
case, where it is supposed to return 0.
(causing lots of mail to be rejected as spam)

Should it be considered a documentation error, or should it be fixed in spamc?