update_spamassassin does unnecessary sa_compile and doesn't remove log.

Mark Sapiro mark at msapiro.net
Sun Dec 27 16:47:29 GMT 2009


The /usr/sbin/update_spamassassin script doesn't properly handle the
exit status from sa_update.

In particular, an exit status of 1 means no fresh updates were
available. In this case and also probably in error cases (exit status
> 1), sa-compile should not be run. Also, an exit status of 1 should
not retain the log.

I suggest the patch in the attached diff.txt to fix both issues.

-- 
Mark Sapiro <mark at msapiro.net>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan

-------------- next part --------------
--- /usr/sbin/update_spamassassin.4.79.2	2009-11-12 01:57:57.000000000 -0800
+++ /usr/sbin/update_spamassassin	2009-12-27 08:28:42.000000000 -0800
@@ -25,6 +25,7 @@
 $SAUPDATE $SAUPDATEARGS >$LOGFILE 2>&1
 UPDATESUCCESS=$?
 
+if [ $UPDATESUCCESS = 0 ] ; then
 # If we have sa-compile and they are using the Rule2XSBody plugin then compile
 if test -x $SACOMPILE && grep -q '^loadplugin.*Rule2XSBody' /etc/mail/spamassassin/*pre 2>/dev/null ; then
   $SACOMPILE >>$LOGFILE 2>&1
@@ -35,9 +36,10 @@
 fi
 
 /etc/init.d/MailScanner reload >>$LOGFILE 2>&1
+fi
 
 # Only delete the logfile if the update succeeded
-if [ $UPDATESUCCESS = 0 -a $COMPILESUCCESS = 0 ]; then
+if [ $UPDATESUCCESS = 0 -a $COMPILESUCCESS = 0 -o $UPDATESUCCESS = 1 ]; then
   rm -f $LOGFILE
 fi
 


More information about the MailScanner mailing list