Bug 4910 - spamc with -E option returns wrong exit code
Summary: spamc with -E option returns wrong exit code
Status: NEW
Alias: None
Product: Spamassassin
Classification: Unclassified
Component: spamc/spamd (show other bugs)
Version: 3.0.5
Hardware: Other Linux
: P5 normal
Target Milestone: Undefined
Assignee: SpamAssassin Developer Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-26 09:08 UTC by Yan Kuligin
Modified: 2007-09-09 02:28 UTC (History)
0 users



Attachment Type Modified Status Actions Submitter/CLA Status

Note You need to log in before you can comment on or make changes to this bug.
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?